libuproc  1.2.0
Data Structures | Functions

Amino acid alphabet. More...

Data Structures

struct  uproc_alphabet
 Amino acid alphabet. More...
 

Functions

uproc_alphabetuproc_alphabet_create (const char *s)
 Create alphabet object. More...
 
void uproc_alphabet_destroy (uproc_alphabet *alpha)
 Destroy alphabet object. More...
 
uproc_amino uproc_alphabet_char_to_amino (const uproc_alphabet *alpha, int c)
 Translate character to amino acid. More...
 
int uproc_alphabet_amino_to_char (const uproc_alphabet *alpha, uproc_amino a)
 Translate amino acid to character. More...
 
const char * uproc_alphabet_str (const uproc_alphabet *alpha)
 Return the underlying string. More...
 

Detailed Description

Amino acid alphabet.

An object of this type is required to translate between characters and the internal representation of amino acids. The order of this alphabet is very significant to the results. Each uproc_ecurve has an "intrinsic" alphabet and should not be used with a uproc_substmat that was derived from a different alphabet.

Function Documentation

uproc_alphabet* uproc_alphabet_create ( const char *  s)

Create alphabet object.

The first argument string s must be a string exactly UPROC_ALPHABET_SIZE characters long which consists only of uppercase letters. No letter shall appear twice. Passing an unterminated char array results in undefined behaviour.

void uproc_alphabet_destroy ( uproc_alphabet alpha)

Destroy alphabet object.

uproc_amino uproc_alphabet_char_to_amino ( const uproc_alphabet alpha,
int  c 
)

Translate character to amino acid.

Parameters
alphaalphabet object
ccharacter to translate
Returns
The value (between 0 and UPROC_ALPHABET_SIZE) of the corresponding amino acid or -1 if c is a non-alphabetic character.

Does not set uproc_errno.

int uproc_alphabet_amino_to_char ( const uproc_alphabet alpha,
uproc_amino  a 
)

Translate amino acid to character.

Parameters
alphaalphabet object
aamino acid to translate
Returns
Corresponding character, or -1 if a is not between 0 and UPROC_ALPHABET_SIZE.

Does not set uproc_errno.

const char* uproc_alphabet_str ( const uproc_alphabet alpha)

Return the underlying string.

Returns a pointer to the underlying string, which is a copy of the argument passed to uproc_alphabet_create().