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

Provides object used for alignment scoring. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct Scorer Scorer
 Scorer object used for alignment scoring. More...
 

Functions

ScorerscorerCreate (const char *name, int *scores, char maxCode, int gapOpen, int gapExtend)
 Scorer constructor. More...
 
void scorerDelete (Scorer *scorer)
 Scorer destructor. More...
 
int scorerGetGapExtend (Scorer *scorer)
 Gap extend penalty getter. More...
 
int scorerGetGapOpen (Scorer *scorer)
 Gap open penalty getter. More...
 
char scorerGetMaxCode (Scorer *scorer)
 Max code getter. More...
 
int scorerGetMaxScore (Scorer *scorer)
 Max score getter. More...
 
const char * scorerGetName (Scorer *scorer)
 Name getter. More...
 
int scorerIsScalar (Scorer *scorer)
 Scalar getter. More...
 
int scorerScore (Scorer *scorer, char a, char b)
 Scores two codes. More...
 
ScorerscorerDeserialize (char *bytes)
 Scorer deserialization method. More...
 
void scorerSerialize (char **bytes, int *bytesLen, Scorer *scorer)
 Scorer serialization method. More...
 
char scorerDecode (char c)
 Scorer static decoding method. More...
 
char scorerEncode (char c)
 Scorer static encoding method. More...
 

Detailed Description

Provides object used for alignment scoring.

Typedef Documentation

typedef struct Scorer Scorer

Scorer object used for alignment scoring.

Scorer is organized as a similarity table with additional gap penalties. Affine gap penalty model is used. Scorer codes are defined as characters. Scorer works only on input characters coded with the scorerEncode(char) method.

Function Documentation

Scorer* scorerCreate ( const char *  name,
int *  scores,
char  maxCode,
int  gapOpen,
int  gapExtend 
)

Scorer constructor.

Input scores table must be an array which length is equal to maxCode * maxCode. Input scores table must be organized so that columns and rows correspond to the codes shown in scorerEncode(char).

Parameters
namescorer name, copy is made
scoressimilarity table, copy is made
maxCodemaximum code that scorer should work with
gapOpengap open penalty given as a positive integer
gapExtendgap extend penalty given as a positive integer
Returns
scorer object
char scorerDecode ( char  c)

Scorer static decoding method.

Function is exact inverse of scorerEncode(char).

Parameters
cinput character
Returns
decoded character
void scorerDelete ( Scorer scorer)

Scorer destructor.

Parameters
scorerscorer object
Scorer* scorerDeserialize ( char *  bytes)

Scorer deserialization method.

Method deserializes scorer object from a byte buffer.

Parameters
bytesbyte buffer
Returns
scorer object
char scorerEncode ( char  c)

Scorer static encoding method.

Encoding method is case insensitive. Function returns character code which is grater or equal to zero or if the codes are not available -1.

Encoding is done in the following way:

  • characters 'A'-'Z' are encoded to 0-25
  • characters 'a'-'z' are encoded to 0-25
  • characters '0'-'9' are encoded to 26-35
  • all other input characters cannot be encoded
Parameters
cinput character
Returns
encoded character or -1 if coding isn't available
int scorerGetGapExtend ( Scorer scorer)

Gap extend penalty getter.

Gap extend penalty is defined as a positive integer.

Parameters
scorerscorer object
Returns
gap extend penalty
int scorerGetGapOpen ( Scorer scorer)

Gap open penalty getter.

Gap open penalty is defined as a positive integer.

Parameters
scorerscorer object
Returns
gap open penalty
char scorerGetMaxCode ( Scorer scorer)

Max code getter.

Max code is defined as the highest code scorer can work with.

Parameters
scorerscorer object
Returns
max code
int scorerGetMaxScore ( Scorer scorer)

Max score getter.

Max score is defined as the highest score two codes can be scored.

Parameters
scorerscorer object
Returns
max score
const char* scorerGetName ( Scorer scorer)

Name getter.

Scorer name usually coresponds to similarity matrix names.

Parameters
scorerscorer object
Returns
name
int scorerIsScalar ( Scorer scorer)

Scalar getter.

Getter for scalar property. Scorer is scalar if the similarity matrix can be reduced to match, mismatch scorer. In other words scorer is scalar if every two equal codes are scored equaly and every two unequal codes are scored equaly.

Parameters
scorerscorer object
Returns
1 if scorer if scalar 0 otherwise
int scorerScore ( Scorer scorer,
char  a,
char  b 
)

Scores two codes.

Given scorer scores two given codes. Both codes should be greater or equal to 0 and less than maxCode.

Parameters
scorerscorer object
afirst code
bsecond code
Returns
similarity score of a and b
void scorerSerialize ( char **  bytes,
int *  bytesLen,
Scorer scorer 
)

Scorer serialization method.

Method serializes scorer object to a byte buffer.

Parameters
bytesoutput byte buffer
bytesLenoutput byte buffer length
scorerscorer object