Provides object for storing named sequnces. More...
Go to the source code of this file.
Typedefs | |
typedef struct Chain | Chain |
Chain object used for storing named sequnces. More... | |
Functions | |
Chain * | chainCreate (char *name, int nameLen, char *string, int stringLen) |
Chain object constructor. More... | |
void | chainDelete (Chain *chain) |
Chain destructor. More... | |
char | chainGetChar (Chain *chain, int index) |
Chain char getter. More... | |
char | chainGetCode (Chain *chain, int index) |
Chain code getter. More... | |
int | chainGetLength (Chain *chain) |
Chain length getter. More... | |
const char * | chainGetName (Chain *chain) |
Chain name getter. More... | |
Chain * | chainCreateView (Chain *chain, int start, int end, int reverse) |
Creates a view to the chain object. More... | |
void | chainCopyCodes (Chain *chain, char *dest) |
Copies chain code to a buffer. More... | |
Chain * | chainDeserialize (char *bytes) |
Chain deserialization method. More... | |
void | chainSerialize (char **bytes, int *bytesLen, Chain *chain) |
Chain serialization method. More... | |
Provides object for storing named sequnces.
Chain object used for storing named sequnces.
Chain object is created from a named sequences and is used for alignment. Chain characters are coded with scorerEncode(char) function. Chain object provides view method for creating subchains and reverse subchains in constant time. On that behalf every chain object uses approximately 2 times more memory than the input sequence.
void chainCopyCodes | ( | Chain * | chain, |
char * | dest | ||
) |
Copies chain code to a buffer.
Destination buffer should be allocated and its length should be greater or equal to chain length.
chain | chain object |
dest | pointer to the destination buffer |
Chain* chainCreate | ( | char * | name, |
int | nameLen, | ||
char * | string, | ||
int | stringLen | ||
) |
Chain object constructor.
Method constructs the chain object with a given name and character sequence. All given data is copied. Any non-alphabetical characters in the sequence are ignored. All characters in the sequence are changed to uppercase.
name | chain name |
nameLen | chain name length |
string | chain characters |
stringLen | chain characters length |
Creates a view to the chain object.
Method creates a subchain from the input chain. It doesn't copy the data since the original chain object is immutable. However the top parent chain object (one created via the constructor), should not be deleted before the views are deleted. Both the start and end indexes shoulde be greater than 1 and less than the chain length.
chain | chain object |
start | start index, inclusive |
end | end index, inclusive |
reverse | bool, 1 if the view should be reverse 0 otherwise |
void chainDelete | ( | Chain * | chain | ) |
Chain destructor.
chain | chain object |
Chain* chainDeserialize | ( | char * | bytes | ) |
Chain deserialization method.
Method deserializes chain object from a byte buffer.
bytes | byte buffer |
char chainGetChar | ( | Chain * | chain, |
int | index | ||
) |
Chain char getter.
Method retrives the char from the index position. Index must be greater or equal to zero and less than chain length.
chain | chain object |
index | chain char index |
char chainGetCode | ( | Chain * | chain, |
int | index | ||
) |
Chain code getter.
Method retrives the code from the index position. Index must be greater or equal to zero and less than chain length. Chain caracter is coded with the scorerEncode(char) function.
chain | chain object |
index | chain code index |
int chainGetLength | ( | Chain * | chain | ) |
Chain length getter.
chain | chain object |
const char* chainGetName | ( | Chain * | chain | ) |
Chain name getter.
chain | chain object |
void chainSerialize | ( | char ** | bytes, |
int * | bytesLen, | ||
Chain * | chain | ||
) |
Chain serialization method.
Method serializes chain object to a byte buffer.
bytes | output byte buffer |
bytesLen | output byte buffer length |
chain | chain object |