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

CPU implementations of common functions. More...

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

Go to the source code of this file.

Functions

void alignPairCpu (Alignment **alignment, int type, Chain *query, Chain *target, Scorer *scorer)
 Pairwise alignment function. More...
 
void alignScoredPairCpu (Alignment **alignment, int type, Chain *query, Chain *target, Scorer *scorer, int score)
 Pairwise alignment function. More...
 
void nwFindScoreCpu (int *queryStart, int *targetStart, Chain *query, Chain *target, Scorer *scorer, int score)
 Score finding function. More...
 
void nwReconstructCpu (char **path, int *pathLen, int *outScore, Chain *query, int queryFrontGap, int queryBackGap, Chain *target, int targetFrontGap, int targetBackGap, Scorer *scorer, int score)
 Needleman-Wunsch reconstruction implementation. More...
 
void ovFindScoreCpu (int *queryStart, int *targetStart, Chain *query, Chain *target, Scorer *scorer, int score)
 Implementation of score finding function. More...
 
int scorePairCpu (int type, Chain *query, Chain *target, Scorer *scorer)
 Pairwise scoring function. More...
 

Detailed Description

CPU implementations of common functions.

Function Documentation

void alignPairCpu ( Alignment **  alignment,
int  type,
Chain query,
Chain target,
Scorer scorer 
)

Pairwise alignment function.

Function aligns query and the target chain with the scorer object.

Parameters
alignmentoutput alignment object
queryquery chain
targettarget chain
scorerscorer object used for alignment
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
void alignScoredPairCpu ( Alignment **  alignment,
int  type,
Chain query,
Chain target,
Scorer scorer,
int  score 
)

Pairwise alignment function.

Function aligns previously score query and the target chain with the scorer object. If the score isn't valid for the produced alignment an error will occur. Function is primaraly provided to get alignments after calling scorePairCpu function.

Parameters
alignmentoutput alignment object
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queryquery chain
targettarget chain
scorerscorer object used for alignment
scorealignment score
void nwFindScoreCpu ( int *  queryStart,
int *  targetStart,
Chain query,
Chain target,
Scorer scorer,
int  score 
)

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 return 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
void nwReconstructCpu ( char **  path,
int *  pathLen,
int *  outScore,
Chain query,
int  queryFrontGap,
int  queryBackGap,
Chain target,
int  targetFrontGap,
int  targetBackGap,
Scorer scorer,
int  score 
)

Needleman-Wunsch reconstruction implementation.

If the score is provided function uses Ukkonen's banded optimization. QueryFrontGap and targetFrontGap arguments can't both be not equal to 0. QueryBackGap and targetBackGap arguments can't both be not equal to 0. For path format see Alignment.

Parameters
pathoutput path
pathLenoutput path length
outScoreoutput score
queryquery chain
queryFrontGapif not equal to 0, force that path starts in MOVE_UP
queryBackGapif not equal to 0, force that path ends in MOVE_UP
targettarget chain
targetFrontGapif not equal to 0, force that path starts in MOVE_LEFT
targetBackGapif not equal to 0, force that path ends in MOVE_LEFT
scorerscorer object used for alignment
scoreinput alignment score if known, otherwise NO_SCORE
void ovFindScoreCpu ( int *  queryStart,
int *  targetStart,
Chain query,
Chain target,
Scorer scorer,
int  score 
)

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
int scorePairCpu ( int  type,
Chain query,
Chain target,
Scorer scorer 
)

Pairwise scoring function.

Function provides only the alignment score without any other information. Scoring types are equivalent to aligning types.

Parameters
typescoring type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queryquery chain
targettarget chain
scorerscorer object used for alignment