bpp-seq3  3.0.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 std::shared_ptr< 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 std::unique_ptr< SequenceInterfacetranslate (const SequenceInterface &sequence, size_t pos=0) const =0
 Translate a whole sequence from letters alphabet to words alphabet. More...
 
virtual std::unique_ptr< SequenceInterfacereverse (const SequenceInterface &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 24 of file WordAlphabet.h.

Constructor & Destructor Documentation

◆ CoreWordAlphabet()

bpp::CoreWordAlphabet::CoreWordAlphabet ( )
inline

Definition at line 27 of file WordAlphabet.h.

◆ ~CoreWordAlphabet()

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

Definition at line 29 of file WordAlphabet.h.

Member Function Documentation

◆ containsGap()

virtual bool bpp::CoreWordAlphabet::containsGap ( const std::string &  state) const
privatepure virtual

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

◆ containsUnresolved()

virtual bool bpp::CoreWordAlphabet::containsUnresolved ( const std::string &  state) const
privatepure virtual

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

◆ getLength()

virtual unsigned int bpp::CoreWordAlphabet::getLength ( ) const
pure virtual

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

◆ getNAlphabet()

virtual std::shared_ptr<const Alphabet> bpp::CoreWordAlphabet::getNAlphabet ( size_t  n) const
pure virtual

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

◆ getNPosition() [1/2]

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.

◆ getNPosition() [2/2]

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.

◆ getPositions() [1/2]

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.

◆ getPositions() [2/2]

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.

◆ getSize()

virtual unsigned int bpp::CoreWordAlphabet::getSize ( ) const
pure virtual

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

◆ getWord() [1/3]

virtual int bpp::CoreWordAlphabet::getWord ( const Sequence seq,
size_t  pos = 0 
) const
pure virtual

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

◆ getWord() [2/3]

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::CodonAlphabet, and bpp::WordAlphabet.

◆ getWord() [3/3]

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.

◆ hasUniqueAlphabet()

virtual bool bpp::CoreWordAlphabet::hasUniqueAlphabet ( ) const
pure virtual

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

◆ reverse()

virtual std::unique_ptr<SequenceInterface> bpp::CoreWordAlphabet::reverse ( const SequenceInterface 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.

◆ translate()

virtual std::unique_ptr<SequenceInterface> bpp::CoreWordAlphabet::translate ( const SequenceInterface 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 position (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.


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