libak  0.4.0
Data Structures | Functions
Alignment of samples with character sequences
Algorithms

Data Structures

struct  akSegment
 Alignment. More...

Functions

void ak_aligner_free (akAligner *aligner)
 Frees memory.
akAligner * ak_aligner_new (akCModel *cmodel, const akSeqs *seqs, const akBool statealign, char **err)
 Gets an akAligner.
int ak_align (akAligner *aligner, const akFea *fea, const size_t seq, akSegment **alignment, size_t *size, akFloat *prob)
 Aligns a sample with a character sequence.

Function Documentation

int ak_align ( akAligner *  aligner,
const akFea fea,
const size_t  seq,
akSegment **  alignment,
size_t *  size,
akFloat prob 
)

Aligns a sample with a character sequence.

This function finds the maximum probability path of a given sample, feature vector sequence, for a provided character sequence, and gets the alignment. The sequence is specified as integer code according to the sequence manager used during the creation of the aligner. The resulting alignment is returned into the variable alignment. The alignment is terminated with a akSegment with length -1. If alignment points to NULL the needed memory is allocated and the number of allocated segments is stored in the variable size. If alignment doesn't point to NULL then alignment will be reallocated if needed, according to the value stored in size, and the variable size will be updated.

Parameters:
alignerThe aligner.
feaA feature vector manager, which must contain a sequence of feature vectors of an adequate type for the cmodel.
seqThe code of the character sequence which will be aligned.
alignmentPointer to the address where the alignment will be stored. It can be point to NULL.
sizeMemory address where the number of allocated segments of alignment is stored.
probThe probability of the sample.
Returns:
0 if the sample has been successfully aligned, -1 in other case.
void ak_aligner_free ( akAligner *  aligner)

Frees memory.

Frees the memory allocated for the aligner.

Parameters:
alignerThe aligner
akAligner* ak_aligner_new ( akCModel cmodel,
const akSeqs seqs,
const akBool  statealign,
char **  err 
)

Gets an akAligner.

This function creates an aligner used to align samples with character sequences. This data only can be used to align samples, using the provided character models, with the character sequences stored in seqs during the creation of the aligner. Alignment can be done at character level or state level. This structure stores a reference to the provided character models and sequence manager, thus, the character models and sequence manager must not be freed. Currently supported types are: Bernoulli, DGaussian, Mixture and TiedStates.

Parameters:
cmodelThe character models.
seqsA character sequence manager containing the character sequences which can be used to align samples.
statealignIf TRUE alignment is performed at state level, else at character level.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
Aligner or NULL in case of error.
 All Data Structures Variables