![]() |
Version 4.1.5 |
#include <seqpp/Translator.h>
Public Member Functions | |
Translator (const string &alpha_file) | |
Constructor from a configuration file. | |
Translator (const string &line2parse, short mode, bool case_sensivity=true) | |
Constructor from an expression. | |
Translator (const Translator &t) | |
Copy constructor. | |
Translator () | |
Default constructor. | |
~Translator () | |
Destructor. | |
short | tell_alphabet_size () const |
Returns alphabet size. | |
short | tell_nb_inv () const |
Return the number of invalid code. | |
short | tell_alphabet_mode () const |
Return alphabet mode, the number of characters of a token. | |
bool | is_complementary_ok () const |
Checks if complementary codes are defined. | |
bool | is_label_ok () const |
Checks if labels are defined. | |
short int | char_to_int (const char *source) const |
Returns the int code for a given char *. | |
short int | str_to_int (const string &source) const |
Returns the int code for a given string. | |
short | complementary_char_to_int (const char *source) const |
Returns the complementary int code for a given char *. | |
short int | complementary_str_to_int (const string &source) const |
Returns the complementary int code for a given string. | |
short | complementary_int (short source) const |
Returns the complementary int code for a given code. | |
void | int_to_char (char *dest, short source) const |
Initialize dest to the word corresponding to the int source. | |
string | int_to_str (short source) const |
returns the word corresponding to the int source | |
void | complementary_char (char *dest, const char *source) const |
Initialize dest to the word corresponding to the complementary of word source. | |
string | complementary_str (const string &source) const |
returns the token corresponding to the inverse complementary of a token source | |
string | complementary_int_to_str (short source) const |
returns the string corresponding to the complementary of int source | |
string | complementary_strw (const string &wordsource) const |
returns the inverse complementary string-word of source | |
void | vect_to_word (char *worddest, const short *vectsource, short sizeword) const |
a char-word <- an int-vect | |
void | vect_to_word (char *worddest, const vector< short > &vectsource) const |
a char-word <- an int-vect | |
string | vect_to_strw (const short *vectsource, short sizeword) const |
a string-word <- an int-vect | |
string | vect_to_strw (const vector< short > &vectsource) const |
a string-word <- an int-vect | |
void | word_to_vect (short *vectdest, const char *wordsource, short sizeword) const |
a char-word -> an int-vect | |
void | word_to_vect (vector< short > &vectdest, const char *wordsource) const |
a char-word -> an int-vect | |
void | strw_to_vect (vector< short > &vectdest, const string &wordsource) const |
a char-word -> an int-vect | |
long | word_to_coded_int (const char *wordsource, int &l) const |
a char-word -> an int code (base alphabet_size) | |
long | strw_to_coded_int (const string &wordsource) const |
a string-word -> an int code (base alphabet_size) | |
long | complementary_coded_int (long codesource, short sizeword) const |
Returns the complementary int code for a given coded int. | |
short | isInvalid (const char *source) const |
checks if source is invalid | |
short | isInvalid (const string &source) const |
checks if source is invalid | |
string | int_to_label (short source) const |
returns the label corresponding to the source | |
string | vect_to_labelstrw (const vector< short > &vectsource) const |
a string-word of label <- an int-vect | |
Protected Attributes | |
short | _alphabet_size |
number of tokens describing the alphabet | |
short | _alphabet_mode |
number of characters of each token | |
short | _nb_inv |
number of invalid tokens | |
bool | _complementary_ok |
checks if complementary is defined | |
bool | _label_ok |
checks if labels are defined |
The key of the seq++ flexibility is the translator object. It defines a mapping between the alphabet and integer values. In seq++, a letter of an alphabet, called a token, can be made of one or more characters, for instance to manage n-uplets like codons. It is associated to its rank integer position in the alphabet.
A simple configuration file is required, containing synonymous tokens, complementary tokens (if exist) and labels. A label aims to be the explicit name of a token. Moreover, invalid tokens can be declared and associated to negative values.
Use a initial file containing same size(alphabet_mode characters) tokens (the letters of the alphabet)
exple :
#codons
ttt TTT -> F1
ttc TTC -> F2
tta TTA -> L1
...
ggg GGG -> G4
? taa TAA tag TAG tga TGA
#dna
a A : t T
g G : c C
c C : g G
t T : a A
? n N
#secondary structures
H -> HELIX
B -> BETA
C -> COIL
acgt:tgca # dna alphabet, mode = 1 R1R2T1T2T3X1Y1Y2 # other alphabet, with mode = 2 (R1 is the first token...)
|
Constructor from a configuration file.
|
|
Constructor from an expression.
|
|
Returns the int code for a given char *.
|
|
Initialize dest to the word corresponding to the complementary of word source.
|
|
Returns the complementary int code for a given char *.
|
|
Returns the complementary int code for a given code.
|
|
Returns the complementary int code for a given string.
|
|
Initialize dest to the word corresponding to the int source.
|
|
Returns the int code for a given string.
|
|
a string-word -> an int code (base alphabet_size)
|
|
a char-word -> an int-vect a string-word -> an int-vect |
|
a char-word <- an int-vect
|
|
a char-word -> an int code (base alphabet_size)
|
|
a char-word -> an int-vect
|
Download seq++ 4.1.5 |
Download previous versions |
Statistique & Genome Home |
Contributors : M.Baudry, P.Y.Bourguignon, M.Hoebeke, V.Miele, P.Nicolas, G.Nuel, H.Richard, D.Robelin |