SW#
All Files Functions Variables Typedefs Macros
Typedefs | Functions
gpu_module.h File Reference

GPU implementations of common functions. More...

#include "alignment.h"
#include "chain.h"
#include "scorer.h"
#include "thread.h"
Include dependency graph for gpu_module.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct ChainDatabaseGpu ChainDatabaseGpu
 GPU database scoring object. More...
 

Functions

void hwEndDataGpu (int *queryEnd, int *targetEnd, int *outScore, Chain *query, Chain *target, Scorer *scorer, int score, int card, Thread *thread)
 GPU implementation of the semiglobal scoring function. More...
 
void nwFindScoreGpu (int *queryStart, int *targetStart, Chain *query, Chain *target, Scorer *scorer, int score, int card, Thread *thread)
 GPU implementation of score finding function. More...
 
void nwLinearDataGpu (int **scores, int **affines, Chain *query, int queryFrontGap, Chain *target, int targetFrontGap, Scorer *scorer, int pLeft, int pRight, int card, Thread *thread)
 GPU implementation of Needleman-Wunsch scoring function. More...
 
void ovEndDataGpu (int *queryEnd, int *targetEnd, int *outScore, Chain *query, Chain *target, Scorer *scorer, int score, int card, Thread *thread)
 GPU implementation of the overlap scoring function. More...
 
void ovFindScoreGpu (int *queryStart, int *targetStart, Chain *query, Chain *target, Scorer *scorer, int score, int card, Thread *thread)
 GPU implementation of score finding function. More...
 
void swEndDataGpu (int *queryEnd, int *targetEnd, int *outScore, int **scores, int **affines, Chain *query, Chain *target, Scorer *scorer, int score, int card, Thread *thread)
 GPU implementation of Smith-Waterman scoring function. More...
 
ChainDatabaseGpuchainDatabaseGpuCreate (Chain **database, int databaseLen, int *cards, int cardsLen)
 ChainDatabaseGpu constructor. More...
 
void chainDatabaseGpuDelete (ChainDatabaseGpu *chainDatabaseGpu)
 ChainDatabaseGpu destructor. More...
 
void scoreDatabaseGpu (int **scores, int type, Chain *query, ChainDatabaseGpu *chainDatabaseGpu, Scorer *scorer, int *indexes, int indexesLen, int *cards, int cardsLen, Thread *thread)
 GPU database aligning function. More...
 
void scoreDatabasesGpu (int **scores, int type, Chain **queries, int queriesLen, ChainDatabaseGpu *chainDatabaseGpu, Scorer *scorer, int *indexes, int indexesLen, int *cards, int cardsLen, Thread *thread)
 GPU shotgun database aligning function. More...
 

Detailed Description

GPU implementations of common functions.

Typedef Documentation

GPU database scoring object.

In the database aligning, queries are often changed and the database is fairly static. ChainDatabaseGpu is the chain database prepared for GPU usage to reduce the preperation time in repetitive aligning.

Function Documentation

ChainDatabaseGpu* chainDatabaseGpuCreate ( Chain **  database,
int  databaseLen,
int *  cards,
int  cardsLen 
)

ChainDatabaseGpu constructor.

Parameters
databasechain array
databaseLenchain array length
cardscuda cards index array which the database will be available on
cardsLencuda cards index array length, greater or equal to 1
Returns
chainDatabaseGpu object
void chainDatabaseGpuDelete ( ChainDatabaseGpu chainDatabaseGpu)

ChainDatabaseGpu destructor.

Parameters
chainDatabaseGpuchainDatabaseGpu object
void hwEndDataGpu ( int *  queryEnd,
int *  targetEnd,
int *  outScore,
Chain query,
Chain target,
Scorer scorer,
int  score,
int  card,
Thread thread 
)

GPU implementation of the semiglobal scoring function.

Function provides the semiglobal end data, the position of the maximum score on the query and target sequences as well as the maximum score. QueryEnd must be equal to the length of the query minus one.

Parameters
queryEndoutput, position of the maximum score on the query sequences
targetEndoutput, position of the maximum score on the target sequences
outScoreoutput, maximum score
queryquery chain
targettarget chain
scorerscorer object used for alignment
scoreinput alignment score if known, otherwise NO_SCORE
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread
void nwFindScoreGpu ( int *  queryStart,
int *  targetStart,
Chain query,
Chain target,
Scorer scorer,
int  score,
int  card,
Thread thread 
)

GPU implementation of score finding function.

Method uses Needleman-Wunsch algorithm with all of the start conditions set to infinity. This assures path contains the first cell and does not start with gaps. If the score is found it returns the coordinates of the cell with the provided score, (-1, -1) otherwise.

Parameters
queryStartoutput, if found query index of found cell, -1 otherwise
targetStartoutput, if found target index of found cell, -1 otherwise
queryquery chain
targettarget chain
scorerscorer object used for alignment
scoreinput alignment score
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread
void nwLinearDataGpu ( int **  scores,
int **  affines,
Chain query,
int  queryFrontGap,
Chain target,
int  targetFrontGap,
Scorer scorer,
int  pLeft,
int  pRight,
int  card,
Thread thread 
)

GPU implementation of Needleman-Wunsch scoring function.

If scores and/or affines pointers are not equal to NULL method provides the last row of the scoring matrix and the affine deletion matrix, respectively. Method uses Ukkonen's banded optimization with the pLeft and pRight margins. PLeft margin is defined as diagonal left of the diagonal from the (0, 0) cell, and pRight as the right diagonal, respectively. Only the cells lying between those diagonals are calculated.

Parameters
scoresoutput, if not NULL the last row of the scoring matrix, new array is created
affinesoutput, if not NULL the last row of the affine deletion matrix, new array is created
queryquery chain
queryFrontGapif not 0, force that alignments start with a query gap
targettarget chain
targetFrontGapif not 0, force that alignments start with a target gap
scorerscorer object used for alignment
pLeftleft Ukkonen's margin
pRightright Ukkonen's margin
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread
void ovEndDataGpu ( int *  queryEnd,
int *  targetEnd,
int *  outScore,
Chain query,
Chain target,
Scorer scorer,
int  score,
int  card,
Thread thread 
)

GPU implementation of the overlap scoring function.

Function provides the overlap end data, the position of the maximum score on the query and target sequences as well as the maximum score. QueryEnd must be equal to the length of the query minus one or targetEnd must be equal to the length of the target minus one.

Parameters
queryEndoutput, position of the maximum score on the query sequences
targetEndoutput, position of the maximum score on the target sequences
outScoreoutput, maximum score
queryquery chain
targettarget chain
scorerscorer object used for alignment
scoreinput alignment score if known, otherwise NO_SCORE
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread
void ovFindScoreGpu ( int *  queryStart,
int *  targetStart,
Chain query,
Chain target,
Scorer scorer,
int  score,
int  card,
Thread thread 
)

GPU implementation of score finding function.

Method uses Needleman-Wunsch algorithm. If the score is found and the indicies of the coresponding cell are on the border of the solving matrix, functions returns the coordinates of the cell with the provided score, (-1, -1) otherwise.

Parameters
queryStartoutput, if found query index of found cell, -1 otherwise
targetStartoutput, if found target index of found cell, -1 otherwise
queryquery chain
targettarget chain
scorerscorer object used for alignment
scoreinput alignment score
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread
void scoreDatabaseGpu ( int **  scores,
int  type,
Chain query,
ChainDatabaseGpu chainDatabaseGpu,
Scorer scorer,
int *  indexes,
int  indexesLen,
int *  cards,
int  cardsLen,
Thread thread 
)

GPU database aligning function.

Function scores the query with every target in the chainDatabaseGpu, in other words with every chain in the database array with witch the chainDatabaseGpu was created. The new score array has legnth of databaseLen, where databaseLen is the argument with which the chainDatabaseGpu was created. If the indexes array is given only the targets with given indexes will be scored, other targets will have the NO_SCORE score. CUDA cards are necessary for this function to work.

Parameters
scoresoutput, array of scores coresponding to every chain in the database array with which the chainDatabaseGpu was created, new array is created
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queryquery chain
chainDatabaseGpugpu chain database object
scorerscorer object used for alignment
indexesarray of indexes of which chains from the database to score, if NULL all are solved
indexesLenindexes array length
cardscuda cards index array
cardsLencuda cards index array length, greater or equal to 1
threadthread on which the function will be executed, if NULL function is executed on the current thread
void scoreDatabasesGpu ( int **  scores,
int  type,
Chain **  queries,
int  queriesLen,
ChainDatabaseGpu chainDatabaseGpu,
Scorer scorer,
int *  indexes,
int  indexesLen,
int *  cards,
int  cardsLen,
Thread thread 
)

GPU shotgun database aligning function.

Function scores every query with every target in the chainDatabaseGpu, in other words with every chain in the database array with witch the chainDatabaseGpu was created. The new score array has legnth of databaseLen * queriesLen, where databaseLen is the argument with which the chainDatabaseGpu was created. Array is organized as a table of databaseLen columns and queriesLen rows, where rows correspond to queries and columns to targets in the database. If the indexes array is given only the targets with given indexes will be scored, other targets will have the NO_SCORE score. CUDA cards are necessary for this function to work. This function is faster than calling scoreDatabaseGpu() for every query separately.

Parameters
scoresoutput, array of scores coresponding to every query scored with every chain in the database array with which the chainDatabaseGpu was created, new array is created
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queriesquery chains array
queriesLenquery chains array length
chainDatabaseGpugpu chain database object
scorerscorer object used for alignment
indexesarray of indexes of which chains from the database to score, if NULL all are solved
indexesLenindexes array length
cardscuda cards index array
cardsLencuda cards index array length, greater or equal to 1
threadthread on which the function will be executed, if NULL function is executed on the current thread
void swEndDataGpu ( int *  queryEnd,
int *  targetEnd,
int *  outScore,
int **  scores,
int **  affines,
Chain query,
Chain target,
Scorer scorer,
int  score,
int  card,
Thread thread 
)

GPU implementation of Smith-Waterman scoring function.

Function provides the Smith-Waterman end data, the position of the maximum score on the query and target sequences as well as the maximum score. Additionally if scores and/or affines pointers are not equal to NULL method provides the last row of the scoring matrix and the affine deletion matrix, respectively.

Parameters
queryEndoutput, position of the maximum score on the query sequences
targetEndoutput, position of the maximum score on the target sequences
scoresoutput, if not NULL the last row of the scoring matrix, new array is created
affinesoutput, if not NULL the last row of the affine deletion matrix, new array is created
outScoreoutput, maximum score
queryquery chain
targettarget chain
scorerscorer object used for alignment
scoreinput alignment score if known, otherwise NO_SCORE
cardCUDA card on which the function will be executed
threadthread on which the function will be executed, if NULL function is executed on the current thread