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

Database alignment oriented functions header. More...

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

Go to the source code of this file.

Typedefs

typedef struct ChainDatabase ChainDatabase
 Ddatabase scoring object. More...
 
typedef void(* ValueFunction )(double *values, int *scores, Chain *query, Chain **database, int databaseLen, void *param)
 

Functions

ChainDatabasechainDatabaseCreate (Chain **database, int databaseStart, int databaseLen, int *cards, int cardsLen)
 ChainDatabase constructor. More...
 
void chainDatabaseDelete (ChainDatabase *chainDatabase)
 ChainDatabase destructor. More...
 
void alignDatabase (DbAlignment ***dbAlignments, int *dbAlignmentsLen, int type, Chain *query, ChainDatabase *chainDatabase, Scorer *scorer, int maxAlignments, ValueFunction valueFunction, void *valueFunctionParam, double valueThreshold, int *indexes, int indexesLen, int *cards, int cardsLen, Thread *thread)
 Database aligning function. More...
 
void shotgunDatabase (DbAlignment ****dbAlignments, int **dbAlignmentsLen, int type, Chain **queries, int queriesLen, ChainDatabase *chainDatabase, Scorer *scorer, int maxAlignments, ValueFunction valueFunction, void *valueFunctionParam, double valueThreshold, int *indexes, int indexesLen, int *cards, int cardsLen, Thread *thread)
 Shotgun aligning function. More...
 

Detailed Description

Database alignment oriented functions header.

Typedef Documentation

typedef struct ChainDatabase ChainDatabase

Ddatabase scoring object.

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

typedef void(* ValueFunction)(double *values, int *scores, Chain *query, Chain **database, int databaseLen, void *param)

Database alignments are often scored by other methods than the alignment score. ValueFunction defines function type for valueing the align scores between a query and the database. Function should calculate the values and store them in the values array which has length equal to databaseLen. Better alignment scores should have smaller value.

Parameters
valuesoutput, values of the align scores
scoresscores between the query and targets in the database
queryquery chain
databasetarget chain array
databaseLentarget chain array length
paramadditional parameters for the value function

Function Documentation

void alignDatabase ( DbAlignment ***  dbAlignments,
int *  dbAlignmentsLen,
int  type,
Chain query,
ChainDatabase chainDatabase,
Scorer scorer,
int  maxAlignments,
ValueFunction  valueFunction,
void *  valueFunctionParam,
double  valueThreshold,
int *  indexes,
int  indexesLen,
int *  cards,
int  cardsLen,
Thread thread 
)

Database aligning function.

Function scores the query with every target in the chainDatabase, in other words with every chain in the database array with witch the chainDatabase was created. After the scoring function values the scores with the valueFunction and every pair with value over the valueThreshold is discarded. If there is more than maxAlignments pairs left only the best maxAlignments pairs are aligned and returned. If the indexes array is given only the targets with given indexes will be considered, other will be ignored.

Parameters
dbAlignmentsoutput dbAlignments array, new array is created
dbAlignmentsLenoutput, length of the output dbAlignments array
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queryquery chain
chainDatabasechain database object
scorerscorer object used for alignment
maxAlignmentsmaximum number of alignments to return, if negative number of alignments wont be limited
valueFunctionfunction for valueing the alignment scores
valueThresholdmaximum value of returned alignments
valueFunctionParamadditional parameters for the value function
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
ChainDatabase* chainDatabaseCreate ( Chain **  database,
int  databaseStart,
int  databaseLen,
int *  cards,
int  cardsLen 
)

ChainDatabase constructor.

Parameters
databasechain array
databaseStartindex of the first chain to solve
databaseLenlength offset from databaseStart to last chain that needs to be solved
cardscuda cards index array which the database will be available on
cardsLencuda cards index array length, greater or equal to 1
Returns
chainDatabase object
void chainDatabaseDelete ( ChainDatabase chainDatabase)

ChainDatabase destructor.

Parameters
chainDatabasechainDatabase object
void shotgunDatabase ( DbAlignment ****  dbAlignments,
int **  dbAlignmentsLen,
int  type,
Chain **  queries,
int  queriesLen,
ChainDatabase chainDatabase,
Scorer scorer,
int  maxAlignments,
ValueFunction  valueFunction,
void *  valueFunctionParam,
double  valueThreshold,
int *  indexes,
int  indexesLen,
int *  cards,
int  cardsLen,
Thread thread 
)

Shotgun aligning function.

Function is the same as the alignDatabase() but it works on the array of queries. As result of the an array of arrays of alignments is outputed as well as the array of coresponding lengths. This function is faster than calling alignDatabase() for every query separately.

Parameters
dbAlignmentsoutput dbAlignments array of arrays, one for each query, new array of arrays is created
dbAlignmentsLenoutput, lengths of the output dbAlignments arrays, one for each query, new array is created
typealigning type, can be SW_ALIGN, NW_ALIGN, HW_ALIGN or OV_ALIGN
queriesquery chains array
queriesLenquery chains array length
chainDatabasechain database object
scorerscorer object used for alignment
maxAlignmentsmaximum number of alignments to return, if negative number of alignments wont be limited
valueFunctionfunction for valueing the alignment scores
valueThresholdmaximum value of returned alignments
valueFunctionParamadditional parameters for the value function
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