|
MASA-Core
|
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>
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. | |
| Grid * | createGrid (Partition partition) |
| Creates a new grid using the given partition coordinates. | |
| virtual const Grid * | getGrid () 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 | |
| IManager * | manager |
| 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. | |
| Grid * | grid |
| The processing grid. | |
| cell_t | firstColumnTail |
| Last cell read in the first column. | |
| cell_t | firstRowTail |
| Last cell read in the first row. | |
AbstractAligner contructor.
Definition at line 33 of file AbstractAligner.cpp.
| AbstractAligner::~AbstractAligner | ( | ) | [virtual] |
AbstractAligner destructor.
Definition at line 48 of file AbstractAligner.cpp.
| 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.
| partition | the 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.
| j | the column to be dispatched. |
| buffer | the vector containing the data (starting from cell 0). |
| len | the number of cells that will be read from the vector. |
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.
| i | the row to be dispatched. |
| buffer | the vector containing the data (starting from cell 0). |
| len | the number of cells that will be read from the vector. |
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.
| score | the score to be dispatched |
| bx | the block position in the horizontal direction, starting from 0 up to AbstractAligner::getGridWidth() minus 1. |
| by | the block position in the vertical direction, starting from 0 up to AbstractAligner::getGridHeight() minus 1. |
Reimplemented in AbstractAlignerSafe.
Definition at line 262 of file AbstractAligner.cpp.
| int AbstractAligner::getFirstColumnInitType | ( | ) | [protected] |
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:
INIT_WITH_GAPS_OPENED: the first column must be initialized considering gaps, but without gap opening penalty. The initialization equation is:
INIT_WITH_ZEROES: the first column must be initialized considering zero values. The initialization equation is:
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).
Definition at line 211 of file AbstractAligner.cpp.
| cell_t AbstractAligner::getFirstColumnTail | ( | ) | const [protected] |
Definition at line 333 of file AbstractAligner.cpp.
| int AbstractAligner::getFirstRowInitType | ( | ) | [protected] |
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:
INIT_WITH_GAPS_OPENED: the first column must be initialized considering gaps, but without gap opening penalty. The initialization equation is:
INIT_WITH_ZEROES: the first row must be initialized considering zero values. The initialization equation is:
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).
Definition at line 219 of file AbstractAligner.cpp.
| cell_t AbstractAligner::getFirstRowTail | ( | ) | const [protected] |
Definition at line 340 of file AbstractAligner.cpp.
| const int * AbstractAligner::getForkWeights | ( | ) | [virtual] |
Supply the computational power weight defined after the AbstractAligner::setForkCount.
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.
Implements IAligner.
Definition at line 121 of file AbstractAligner.cpp.
| int AbstractAligner::getRecurrenceType | ( | ) | const [protected] |
Delegates to IManager::getRecurrenceType()
Definition at line 179 of file AbstractAligner.cpp.
| int AbstractAligner::getSpecialColumnInterval | ( | ) | const [protected] |
Delegates to IManager::getSpecialColumnInterval()
Definition at line 195 of file AbstractAligner.cpp.
| int AbstractAligner::getSpecialRowInterval | ( | ) | const [protected] |
Delegates to IManager::getSpecialRowInterval()
Definition at line 187 of file AbstractAligner.cpp.
| Partition AbstractAligner::getSuperPartition | ( | ) | [protected] |
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.
Definition at line 203 of file AbstractAligner.cpp.
| void AbstractAligner::initializeBlockPruning | ( | AbstractBlockPruning * | blockPruner | ) | [protected] |
Initializes the pruner object.
It must be called after the grid is created by the AbstractAligner::createGrid method.
| blockPruner | the 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.
| buffer | the vector with the last column data. |
| base | the vector with the special row in the reverse direction. |
| len | Defines that we must match the buffers in the range [0,len). |
| goalScore | the score that will be searched during the matching procedure. |
Implements IAligner.
Definition at line 158 of file AbstractAligner.cpp.
| bool AbstractAligner::mustContinue | ( | ) | [protected] |
Delegates to IManager::mustContinue()
Definition at line 270 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchLastCell | ( | ) | [protected] |
Delegates to IManager::mustDispatchLastCell()
Definition at line 278 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchLastColumn | ( | ) | [protected] |
Delegates to IManager::mustDispatchLastColumn()
Definition at line 294 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchLastRow | ( | ) | [protected] |
Delegates to IManager::mustDispatchLastRow()
Definition at line 286 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchScores | ( | ) | [protected] |
Delegates to IManager::mustDispatchScores()
Definition at line 310 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchSpecialColumns | ( | ) | [protected] |
Delegates to IManager::mustDispatchSpecialColumns()
Definition at line 318 of file AbstractAligner.cpp.
| bool AbstractAligner::mustDispatchSpecialRows | ( | ) | [protected] |
Delegates to IManager::mustDispatchSpecialRows()
Definition at line 302 of file AbstractAligner.cpp.
| bool AbstractAligner::mustPruneBlocks | ( | ) | [protected] |
Delegates to 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.
| buffer | the vector where the first column data will be stored. |
| len | the number of cells that will be read. |
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.
| buffer | the vector where the first row data will be stored. |
| len | the number of cells that will be read. |
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.
| forkCount | number of processes allowed. |
| forkWeights | vector 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.
| manager | the interface to the MASA-Core. |
Implements IAligner.
Definition at line 59 of file AbstractAligner.cpp.
cell_t AbstractAligner::firstColumnTail [private] |
Last cell read in the first column.
Definition at line 127 of file AbstractAligner.hpp.
cell_t AbstractAligner::firstRowTail [private] |
Last cell read in the first row.
Definition at line 130 of file AbstractAligner.hpp.
int AbstractAligner::forkCount [private] |
Maximum number of forked proceess.
Definition at line 121 of file AbstractAligner.hpp.
int* AbstractAligner::forkWeights [private] |
The computational power weights of each forked processes.
Definition at line 118 of file AbstractAligner.hpp.
Grid* AbstractAligner::grid [private] |
The processing grid.
Definition at line 124 of file AbstractAligner.hpp.
IManager* AbstractAligner::manager [private] |
Manager object that receives calls from Aligner to MASA-Core.
Definition at line 115 of file AbstractAligner.hpp.
1.7.6.1