MASA-Core
Public Member Functions | Protected Member Functions | Private Attributes
AbstractAligner Class Reference

Detailed Description

Abstract class that executes the Alignment procedure.

The AbstractAligner class is the basic implementation of the interface between the portable code and the non-portable code of MASA (Malleable Architecture for Sequence Aligners). Each MASA extension must create its own Aligner class that extend the AbstractAligner class. The Aligner class has 3 group of methods:

Although all the abstract methods must be implemented, the Aligner must also be compliant with many requirements in order to produce a proper integration. If the Aligner is fully compliant with a given requirement, we say that the Aligner has that capability. See the aligner_capabilities_t struct to see all the proposed requirements.

Definition at line 64 of file AbstractAligner.hpp.

#include <AbstractAligner.hpp>

Inheritance diagram for AbstractAligner:
IAligner AbstractAlignerSafe AbstractBlockAligner AbstractDiagonalAligner

List of all members.

Public Member Functions

 AbstractAligner ()
 AbstractAligner contructor.
virtual ~AbstractAligner ()
 AbstractAligner destructor.
virtual void setManager (IManager *manager)
 Defines the IManager to be associated with this aligner.
virtual const int * getForkWeights ()
 Supply the computational power weight defined after the AbstractAligner::setForkCount.
virtual match_result_t matchLastColumn (const cell_t *buffer, const cell_t *base, int len, int goalScore)
 Executes the matching procedure in CPU.

Protected Member Functions

void setForkCount (const int forkCount, const int *forkWeights=NULL)
 Defines how many processes may be forked for this aligner and the computation weight for each process.
GridcreateGrid (Partition partition)
 Creates a new grid using the given partition coordinates.
virtual const GridgetGrid () const
 Returns the grid created by the last call to the AbstractAligner::createGrid method.
void initializeBlockPruning (AbstractBlockPruning *blockPruner)
 Initializes the pruner object.
int getRecurrenceType () const
 Delegates to IManager::getRecurrenceType()
int getSpecialRowInterval () const
 Delegates to IManager::getSpecialRowInterval()
int getSpecialColumnInterval () const
 Delegates to IManager::getSpecialColumnInterval()
int getFirstColumnInitType ()
 Delegates to IManager::getFirstColumnInitType()
Partition getSuperPartition ()
 Delegates to IManager::getSuperPartition()
int getFirstRowInitType ()
 Delegates to IManager::getFirstRowInitType()
void receiveFirstRow (cell_t *buffer, int len)
 Delegates to IManager::receiveFirstRow()
void receiveFirstColumn (cell_t *buffer, int len)
 Delegates to IManager::receiveFirstColumn()
void dispatchColumn (int j, const cell_t *buffer, int len)
 Delegates to IManager::dispatchColumn()
void dispatchRow (int i, const cell_t *buffer, int len)
 Delegates to IManager::dispatchRow()
void dispatchScore (score_t score, int bx=-1, int by=-1)
 Delegates to IManager::dispatchScore()
bool mustContinue ()
 Delegates to IManager::mustContinue()
bool mustDispatchLastCell ()
 Delegates to IManager::mustDispatchLastCell()
bool mustDispatchLastRow ()
 Delegates to IManager::mustDispatchLastRow()
bool mustDispatchLastColumn ()
 Delegates to IManager::mustDispatchLastColumn()
bool mustDispatchSpecialRows ()
 Delegates to IManager::mustDispatchSpecialRows()
bool mustDispatchSpecialColumns ()
 Delegates to IManager::mustDispatchSpecialColumns()
bool mustDispatchScores ()
 Delegates to IManager::mustDispatchScores()
bool mustPruneBlocks ()
 Delegates to IManager::mustPruneBlocks()
cell_t getFirstColumnTail () const
cell_t getFirstRowTail () const

Private Attributes

IManagermanager
 Manager object that receives calls from Aligner to MASA-Core.
int * forkWeights
 The computational power weights of each forked processes.
int forkCount
 Maximum number of forked proceess.
Gridgrid
 The processing grid.
cell_t firstColumnTail
 Last cell read in the first column.
cell_t firstRowTail
 Last cell read in the first row.

Constructor & Destructor Documentation

AbstractAligner contructor.

Definition at line 33 of file AbstractAligner.cpp.

AbstractAligner destructor.

Definition at line 48 of file AbstractAligner.cpp.


Member Function Documentation

Grid * AbstractAligner::createGrid ( Partition  partition) [protected]

Creates a new grid using the given partition coordinates.

If there is a previously created grid, it is deleted and overwritten.

Parameters:
partitionthe partition to be split in a grid of blocks.

Definition at line 106 of file AbstractAligner.cpp.

void AbstractAligner::dispatchColumn ( int  j,
const cell_t buffer,
int  len 
) [protected]

Delegates to IManager::dispatchColumn()

Notifies to the MASA framework that some cells of a column has been processed.

This function must be called serially for each column. For example, the invocation of dispatchColumn(50000, vector, 100) will dispatch the first 100 cells of the column 50000 to MASA, and the cells are read from the vector[0..99] elements. After this, a call to dispatchColumn(50000, vector, 50) will dispatch the next 50 cells of the same column 5000, and the cells are read from the vector[0..49] elements.

Parameters:
jthe column to be dispatched.
bufferthe vector containing the data (starting from cell 0).
lenthe number of cells that will be read from the vector.
See also:
IManager::dispatchColumn()

Reimplemented in AbstractAlignerSafe.

Definition at line 246 of file AbstractAligner.cpp.

void AbstractAligner::dispatchRow ( int  i,
const cell_t buffer,
int  len 
) [protected]

Delegates to IManager::dispatchRow()

Notifies to the MASA framework that some cells of a row has been processed.

This function must be called serially for each row, analogous to the AbstractAligner::dispatchLastColumn method.

Parameters:
ithe row to be dispatched.
bufferthe vector containing the data (starting from cell 0).
lenthe number of cells that will be read from the vector.
See also:
IManager::dispatchRow()

Reimplemented in AbstractAlignerSafe.

Definition at line 254 of file AbstractAligner.cpp.

void AbstractAligner::dispatchScore ( score_t  score,
int  bx = -1,
int  by = -1 
) [protected]

Delegates to IManager::dispatchScore()

Notifies to the MASA framework that a new score has been computed.

This method may be called as many times it is necessary, and the best score will be calculated among all calls of this method.

If the Aligner supports the aligner_capabilities_t::dispatch_block_scores capability, them it must dispatch the score with the bx, by parameters set to the block indices and this method must be called only once for each block.

Parameters:
scorethe score to be dispatched
bxthe block position in the horizontal direction, starting from 0 up to AbstractAligner::getGridWidth() minus 1.
bythe block position in the vertical direction, starting from 0 up to AbstractAligner::getGridHeight() minus 1.
See also:
IManager::dispatchScore()

Reimplemented in AbstractAlignerSafe.

Definition at line 262 of file AbstractAligner.cpp.

Delegates to IManager::getFirstColumnInitType()

Returns the initialization type of the first column.

Possible values are

  • INIT_WITH_CUSTOM_DATA: the first column must be initialized with custom data that can only be obtained by the AbstractAligner::receiveFirstColumn method.

  • INIT_WITH_GAPS: the first column must be initialized considering gaps. The initialization equation is:

    \begin{eqnarray*}H_{0,0} &=& 0 \\ H_{k,0} &=& -k.G_{ext}-G_{open} \\ F_{k,0} &=& -\infty \end{eqnarray*}

  • INIT_WITH_GAPS_OPENED: the first column must be initialized considering gaps, but without gap opening penalty. The initialization equation is:

    \begin{eqnarray*}H_{k,0} &=& -k.G_{ext} \\ F_{k,0} &=& -\infty \end{eqnarray*}

  • INIT_WITH_ZEROES: the first column must be initialized considering zero values. The initialization equation is:

    \begin{eqnarray*}H_{k,0} &=& 0 \\ F_{k,0} &=& -\infty \end{eqnarray*}

    The initialization data of all types may be obtained by the AbstractAligner::receiveFirstColumn method, but the subclass of AbstractAligner may implement the initialization functions using some architectural dependent code (for example, using vectorial hardware instructions).

Returns:
the initialization type.
See also:
IManager::getFirstColumnInitType()

Definition at line 211 of file AbstractAligner.cpp.

Returns:
the last cell read from the first column

Definition at line 333 of file AbstractAligner.cpp.

Delegates to IManager::getFirstRowInitType()

Returns the initialization type of the first row.

Possible values are

  • INIT_WITH_CUSTOM_DATA: the first row must be initialized with custom data that can only be obtained by the AbstractAligner::receiveFirstRow method.

  • INIT_WITH_GAPS: the first column must be initialized considering gaps. The initialization equation is:

    \begin{eqnarray*}H_{0,0} &=& 0 \\ H_{0,k} &=& -k.G_{ext}-G_{open} \\ F_{0,k} &=& -\infty \end{eqnarray*}

  • INIT_WITH_GAPS_OPENED: the first column must be initialized considering gaps, but without gap opening penalty. The initialization equation is:

    \begin{eqnarray*}H_{0,k} &=& -k.G_{ext} \\ F_{0,k} &=& -\infty \end{eqnarray*}

  • INIT_WITH_ZEROES: the first row must be initialized considering zero values. The initialization equation is:

    \begin{eqnarray*}H_{0,k} &=& 0 \\ F_{0,k} &=& -\infty \end{eqnarray*}

    The initialization data of all types may be obtained by the AbstractAligner::receiveFirstRow method, but the subclass of AbstractAligner may implement the initialization functions using some architectural dependent code (for example, using vectorial hardware instructions).

Returns:
the initialization type.
See also:
IManager::getFirstRowInitType()

Definition at line 219 of file AbstractAligner.cpp.

Returns:
the last cell read from the first row

Definition at line 340 of file AbstractAligner.cpp.

const int * AbstractAligner::getForkWeights ( ) [virtual]

Supply the computational power weight defined after the AbstractAligner::setForkCount.

Returns:
the weights for each process.
See also:
IAligner::getForkWeights()

Implements IAligner.

Definition at line 96 of file AbstractAligner.cpp.

const Grid * AbstractAligner::getGrid ( ) const [protected, virtual]

Returns the grid created by the last call to the AbstractAligner::createGrid method.

Returns:
the current grid object.

Implements IAligner.

Definition at line 121 of file AbstractAligner.cpp.

int AbstractAligner::getRecurrenceType ( ) const [protected]

Delegates to IManager::getRecurrenceType()

Returns:
the recurrence type of the alignment. Possible values are SMITH_WATERMAN and NEEDLEMAN_WUNSCH.
See also:
IManager::getRecurrenceType()

Definition at line 179 of file AbstractAligner.cpp.

int AbstractAligner::getSpecialColumnInterval ( ) const [protected]

Delegates to IManager::getSpecialColumnInterval()

Returns:
the minimum distance between two special columns, or 0 if it must not save special columns.
See also:
IManager::getSpecialColumnInterval()

Definition at line 195 of file AbstractAligner.cpp.

int AbstractAligner::getSpecialRowInterval ( ) const [protected]

Delegates to IManager::getSpecialRowInterval()

Returns:
the minimum distance between two special rows, or 0 if it must not save special rows.
See also:
IManager::getSpecialRowInterval()

Definition at line 187 of file AbstractAligner.cpp.

Delegates to IManager::getSuperPartition()

Returns the super partition that includes all sub partitions being aligned.

This method must be used only by block pruning algorithms in order to obtain the corner coordinates of the matrix.

A super partition is a set of many smaller partitions and this occurs in two situations. The first is when we are running stage1 in a multiprocess environment, where we have one sub partition for each process. The second situation happens when the aligner cannot handle the full size of the matrix, so the partition is split in parts smaller than the max sequence size capability of the aligner.

Returns:
the super partition.
See also:
IManager::getSuperPartition()

Definition at line 203 of file AbstractAligner.cpp.

Initializes the pruner object.

It must be called after the grid is created by the AbstractAligner::createGrid method.

Parameters:
blockPrunerthe pruner object to be initialized.

Definition at line 131 of file AbstractAligner.cpp.

match_result_t AbstractAligner::matchLastColumn ( const cell_t buffer,
const cell_t base,
int  len,
int  goalScore 
) [virtual]

Executes the matching procedure in CPU.

This method is a default implementation that works in any condition, but a subclass may override it in order to create a faster matching procedure for the MASA extension.

Parameters:
bufferthe vector with the last column data.
basethe vector with the special row in the reverse direction.
lenDefines that we must match the buffers in the range [0,len).
goalScorethe score that will be searched during the matching procedure.
Returns:
the match result.
See also:
IAligner::matchLastColumn for a better explanation of the parameters.

Implements IAligner.

Definition at line 158 of file AbstractAligner.cpp.

bool AbstractAligner::mustContinue ( ) [protected]

Delegates to IManager::mustContinue()

Returns:
true if the execution must continue.
See also:
IManager::mustContinue()

Definition at line 270 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchLastCell()

Returns:
true if the last cell must be dispatched.
See also:
IManager::mustDispatchLastCell()

Definition at line 278 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchLastColumn()

Returns:
true if the last column must be dispatched.
See also:
IManager::mustDispatchLastColumn()

Definition at line 294 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchLastRow()

Returns:
true if the last row must be dispatched.
See also:
IManager::mustDispatchLastRow()

Definition at line 286 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchScores()

Returns:
true if intermediate scores must be dispatched.
See also:
IManager::mustDispatchScores()

Definition at line 310 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchSpecialColumns()

Returns:
true if special columns must be dispatched.
See also:
IManager::mustDispatchSpecialColumns()

Definition at line 318 of file AbstractAligner.cpp.

Delegates to IManager::mustDispatchSpecialRows()

Returns:
true if special rows must be dispatched.
See also:
IManager::mustDispatchSpecialRows()

Definition at line 302 of file AbstractAligner.cpp.

bool AbstractAligner::mustPruneBlocks ( ) [protected]

Delegates to IManager::mustPruneBlocks()

Returns:
true if block pruning optimization may be used.
See also:
IManager::mustPruneBlocks()

Definition at line 326 of file AbstractAligner.cpp.

void AbstractAligner::receiveFirstColumn ( cell_t buffer,
int  len 
) [protected]

Delegates to IManager::receiveFirstColumn()

Receives the first column of the partition.

This function may block until all the requested data is ready. So prefer to read data in chunks instead of reading the full first row. The data will be stored from 0 to len-1 positions of the vector passed in the parameters.

Parameters:
bufferthe vector where the first column data will be stored.
lenthe number of cells that will be read.
See also:
IManager::receiveFirstColumn()

Definition at line 236 of file AbstractAligner.cpp.

void AbstractAligner::receiveFirstRow ( cell_t buffer,
int  len 
) [protected]

Delegates to IManager::receiveFirstRow()

Receives the first row of the partition.

This function may block until all the requested data is ready. So prefer to read data in chunks instead of reading the full first row. The data will be stored from 0 to len-1 positions of the vector passed in the parameters.

Parameters:
bufferthe vector where the first row data will be stored.
lenthe number of cells that will be read.
See also:
IManager::receiveFirstRow()

Definition at line 227 of file AbstractAligner.cpp.

void AbstractAligner::setForkCount ( const int  forkCount,
const int *  forkWeights = NULL 
) [protected]

Defines how many processes may be forked for this aligner and the computation weight for each process.

Parameters:
forkCountnumber of processes allowed.
forkWeightsvector containing $forkCount$ weights. If NULL, all the processes will have the same weight.

Definition at line 71 of file AbstractAligner.cpp.

void AbstractAligner::setManager ( IManager manager) [virtual]

Defines the IManager to be associated with this aligner.

Parameters:
managerthe interface to the MASA-Core.

Implements IAligner.

Definition at line 59 of file AbstractAligner.cpp.


Member Data Documentation

Last cell read in the first column.

Definition at line 127 of file AbstractAligner.hpp.

Last cell read in the first row.

Definition at line 130 of file AbstractAligner.hpp.

Maximum number of forked proceess.

Definition at line 121 of file AbstractAligner.hpp.

The computational power weights of each forked processes.

Definition at line 118 of file AbstractAligner.hpp.

The processing grid.

Definition at line 124 of file AbstractAligner.hpp.

Manager object that receives calls from Aligner to MASA-Core.

Definition at line 115 of file AbstractAligner.hpp.


The documentation for this class was generated from the following files: