bpp-seq  2.4.0
bpp::CoreWordAlphabet Class Referenceabstract

The interface class for word alphabets. More...

#include <Bpp/Seq/Alphabet/WordAlphabet.h>

+ Inheritance diagram for bpp::CoreWordAlphabet:

Public Member Functions

 CoreWordAlphabet ()
 
virtual ~CoreWordAlphabet ()
 
virtual unsigned int getLength () const =0
 
virtual unsigned int getSize () const =0
 
virtual bool hasUniqueAlphabet () const =0
 
virtual const AlphabetgetNAlphabet (size_t n) const =0
 
virtual int getWord (const Sequence &seq, size_t pos=0) const =0
 
virtual int getWord (const std::vector< int > &vint, size_t pos=0) const =0
 Get the int code for a word given the int code of the underlying positions. More...
 
virtual std::string getWord (const std::vector< std::string > &vpos, size_t pos=0) const =0
 Get the char code for a word given the char code of the underlying positions. More...
 
virtual int getNPosition (int word, size_t n) const =0
 Get the int code of the n-position of a word given its int description. More...
 
virtual std::vector< int > getPositions (int word) const =0
 Get the int codes of each position of a word given its int description. More...
 
virtual std::string getNPosition (const std::string &word, size_t n) const =0
 Get the char code of the n-position of a word given its char description. More...
 
virtual std::vector< std::string > getPositions (const std::string &word) const =0
 Get the char codes of each position of a word given its char description. More...
 
virtual Sequencetranslate (const Sequence &sequence, size_t pos=0) const =0
 Translate a whole sequence from letters alphabet to words alphabet. More...
 
virtual Sequencereverse (const Sequence &sequence) const =0
 Translate a whole sequence from words alphabet to letters alphabet. More...
 

Private Member Functions

Inner utilitary functions
virtual bool containsUnresolved (const std::string &state) const =0
 
virtual bool containsGap (const std::string &state) const =0
 

Detailed Description

The interface class for word alphabets.

Definition at line 59 of file WordAlphabet.h.

Constructor & Destructor Documentation

bpp::CoreWordAlphabet::CoreWordAlphabet ( )
inline

Definition at line 62 of file WordAlphabet.h.

virtual bpp::CoreWordAlphabet::~CoreWordAlphabet ( )
inlinevirtual

Member Function Documentation

virtual bool bpp::CoreWordAlphabet::containsGap ( const std::string &  state) const
privatepure virtual
virtual bool bpp::CoreWordAlphabet::containsUnresolved ( const std::string &  state) const
privatepure virtual
virtual unsigned int bpp::CoreWordAlphabet::getLength ( ) const
pure virtual

Implemented in bpp::CodonAlphabet, and bpp::WordAlphabet.

Referenced by ~CoreWordAlphabet().

virtual const Alphabet* bpp::CoreWordAlphabet::getNAlphabet ( size_t  n) const
pure virtual

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

Referenced by ~CoreWordAlphabet().

virtual int bpp::CoreWordAlphabet::getNPosition ( int  word,
size_t  n 
) const
pure virtual

Get the int code of the n-position of a word given its int description.

Parameters
wordThe int description of the word.
nThe position in the word (starting at 0).
Returns
The int description of the n-position of the word.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

Referenced by ~CoreWordAlphabet().

virtual std::string bpp::CoreWordAlphabet::getNPosition ( const std::string &  word,
size_t  n 
) const
pure virtual

Get the char code of the n-position of a word given its char description.

Parameters
wordThe char description of the word.
nThe position in the word (starting at 0).
Returns
The char description of the n-position of the word.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

virtual std::vector<int> bpp::CoreWordAlphabet::getPositions ( int  word) const
pure virtual

Get the int codes of each position of a word given its int description.

Parameters
wordThe int description of the word.
Returns
The int description of the positions of the codon.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

Referenced by ~CoreWordAlphabet().

virtual std::vector<std::string> bpp::CoreWordAlphabet::getPositions ( const std::string &  word) const
pure virtual

Get the char codes of each position of a word given its char description.

Parameters
wordThe char description of the word.
Returns
The char description of the three positions of the word.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

virtual unsigned int bpp::CoreWordAlphabet::getSize ( ) const
pure virtual
virtual int bpp::CoreWordAlphabet::getWord ( const Sequence seq,
size_t  pos = 0 
) const
pure virtual
virtual int bpp::CoreWordAlphabet::getWord ( const std::vector< int > &  vint,
size_t  pos = 0 
) const
pure virtual

Get the int code for a word given the int code of the underlying positions.

The int code of each position must match the corresponding alphabet specified at this position.

Parameters
vintdescription for all the positions.
posthe start position to match in the vector.
Returns
The int code of the word.
Exceptions
IndexOutOfBoundsExceptionIn case of wrong position.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

virtual std::string bpp::CoreWordAlphabet::getWord ( const std::vector< std::string > &  vpos,
size_t  pos = 0 
) const
pure virtual

Get the char code for a word given the char code of the underlying positions.

The char code of each position must match the corresponding alphabet specified at this position.

Parameters
vposvector description for all the positions.
posthe start position to match in the vector.
Returns
The string of the word.
Exceptions
IndexOutOfBoundsExceptionIn case of wrong position.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

virtual bool bpp::CoreWordAlphabet::hasUniqueAlphabet ( ) const
pure virtual
virtual Sequence* bpp::CoreWordAlphabet::reverse ( const Sequence sequence) const
pure virtual

Translate a whole sequence from words alphabet to letters alphabet.

Parameters
sequenceA sequence in words alphabet.
Returns
The corresponding sequence in letters alphabet.
Exceptions
AlphabetMismatchExceptionIf the sequence alphabet do not match the target alphabet.
ExceptionOther kind of error, depending on the implementation.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

Referenced by bpp::WordAlphabet::getPositions(), and ~CoreWordAlphabet().

virtual Sequence* bpp::CoreWordAlphabet::translate ( const Sequence sequence,
size_t  pos = 0 
) const
pure virtual

Translate a whole sequence from letters alphabet to words alphabet.

Parameters
sequenceA sequence in letters alphabet.
posthe start postion (default 0)
Returns
The corresponding sequence in words alphabet.
Exceptions
AlphabetMismatchExceptionIf the sequence alphabet do not match the source alphabet.
ExceptionOther kind of error, depending on the implementation.

Implemented in bpp::WordAlphabet, and bpp::CodonAlphabet.

Referenced by bpp::WordAlphabet::getPositions(), and ~CoreWordAlphabet().


The documentation for this class was generated from the following file: