|
bpp-seq
2.1.0
|
The abstract base class for codon alphabets. More...
#include <Bpp/Seq/Alphabet/CodonAlphabet.h>
Inheritance diagram for bpp::CodonAlphabet:
Collaboration diagram for bpp::CodonAlphabet:Public Member Functions | |
| CodonAlphabet (const NucleicAlphabet *alpha) | |
| Builds a new codon alphabet from a nucleic alphabet. | |
| virtual | ~CodonAlphabet () |
| virtual std::string | getAlphabetType () const =0 |
| Identification method. | |
| bool | hasUniqueAlphabet () const |
| Returns True if the Alphabet of the letters in the word are the same type. | |
| unsigned int | getLength () const |
| Returns the length of the word. | |
| unsigned int | getNumberOfTypes () const |
| Returns the number of resolved states + one for unresolved. | |
| int | getUnknownCharacterCode () const |
| bool | isUnresolved (int state) const |
| bool | isUnresolved (const std::string &state) const |
| std::vector< int > | getAlias (int state) const throw (BadIntException) |
| Get all resolved states that match a generic state. | |
| std::vector< std::string > | getAlias (const std::string &state) const throw (BadCharException) |
| Get all resolved states that match a generic state. | |
| int | getGeneric (const std::vector< int > &states) const throw (BadIntException) |
| Get the generic state that match a set of states. | |
| std::string | getGeneric (const std::vector< std::string > &states) const throw (BadCharException) |
| Get the generic state that match a set of states. | |
Codon specific methods | |
| unsigned int | numberOfStopCodons () const |
| Returns the number of stop codons. | |
| const std::vector< int > & | stopCodons () const |
| Returns the vector of the numbers of the stop codon states. | |
| virtual int | getCodon (int pos1, int pos2, int pos3) const throw (BadIntException) |
| Get the int code for a codon given the int code of the three underlying positions. | |
| virtual std::string | getCodon (const std::string &pos1, const std::string &pos2, const std::string &pos3) const throw (BadCharException) |
| Get the char code for a codon given the char code of the three underlying positions. | |
| virtual int | getFirstPosition (int codon) const throw (BadIntException) |
| Get the int code of the first position of a codon given its int description. | |
| virtual int | getSecondPosition (int codon) const throw (BadIntException) |
| Get the int code of the second position of a codon given its int description. | |
| virtual int | getThirdPosition (int codon) const throw (BadIntException) |
| Get the int code of the third position of a codon given its int description. | |
| virtual std::string | getFirstPosition (const std::string &codon) const throw (BadCharException) |
| Get the char code of the first position of a codon given its char description. | |
| virtual std::string | getSecondPosition (const std::string &codon) const throw (BadCharException) |
| Get the char code of the second position of a codon given its char description. | |
| virtual std::string | getThirdPosition (const std::string &codon) const throw (BadCharException) |
| Get the char code of the third position of a codon given its char description. | |
| bool | isStop (int codon) const |
| Tell whether a particular codon is a stop codon. | |
| bool | isStop (const std::string &codon) const |
| Tell whether a particular codon is a stop codon. | |
| bool | isInit (int codon) const |
| Tell whether a particular codon is the init codon. | |
| bool | isInit (const std::string &codon) const |
| Tell whether a particular codon is the init codon. | |
| virtual const NucleicAlphabet *const | getNucleicAlphabet () const |
Methods redefined from Alphabet | |
| std::string | getName (const std::string &state) const throw (BadCharException) |
| Get the complete name of a state given its string description. | |
| int | charToInt (const std::string &state) const throw (BadCharException) |
| Give the int description of a state given its string description. | |
| unsigned int | getSize () const |
| Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet). This is the method you'll need in most cases. | |
Implement these methods from the Alphabet interface. | |
| std::string | getName (int state) const throw (BadIntException) |
| Get the complete name of a state given its int description. | |
| unsigned int | getNumberOfChars () const |
| Get the number of supported characters in this alphabet, including generic characters (e.g. return 20 for DNA alphabet). | |
| std::string | intToChar (int state) const throw (BadIntException) |
| Give the string description of a state given its int description. | |
| bool | isIntInAlphabet (int state) const |
| Tell if a state (specified by its int description) is allowed by the the alphabet. | |
| bool | isCharInAlphabet (const std::string &state) const |
| Tell if a state (specified by its string description) is allowed by the the alphabet. | |
| const std::vector< int > & | getSupportedInts () const |
| const std::vector< std::string > & | getSupportedChars () const |
| int | getGapCharacterCode () const |
| bool | isGap (int state) const |
| bool | isGap (const std::string &state) const |
Word specific methods | |
| const Alphabet * | getNAlphabet (size_t n) const |
| Get the pointer to the Alphabet of the n-position. | |
| virtual int | getWord (const std::vector< int > &vint, size_t pos=0) const throw (IndexOutOfBoundsException) |
| Get the int code for a word given the int code of the underlying positions. | |
| virtual std::string | getWord (const std::vector< std::string > &vpos, size_t pos=0) const throw (IndexOutOfBoundsException, BadCharException) |
| Get the char code for a word given the char code of the underlying positions. | |
| int | getNPosition (int word, size_t n) const throw (BadIntException) |
| Get the int code of the n-position of a word given its int description. | |
| std::string | getNPosition (const std::string &word, size_t n) const throw (BadCharException) |
| Get the char code of the n-position of a word given its char description. | |
| std::vector< int > | getPositions (int word) const throw (BadIntException) |
| Get the int codes of each position of a word given its int description. | |
| std::vector< std::string > | getPositions (const std::string &word) const throw (BadCharException) |
| Get the char codes of each position of a word given its char description. | |
| Sequence * | translate (const Sequence &sequence, size_t=0) const throw (AlphabetMismatchException, Exception) |
| Translate a whole sequence from letters alphabet to words alphabet. | |
| Sequence * | reverse (const Sequence &sequence) const throw (AlphabetMismatchException, Exception) |
| Translate a whole sequence from words alphabet to letters alphabet. | |
Overloaded AbstractAlphabet methods. | |
| unsigned int | getStateCodingSize () const |
| Get the size of the string coding a state. | |
Specific methods to access AlphabetState | |
| const AlphabetState & | getState (const std::string &letter) const throw (BadCharException) |
| Get a state by its letter. | |
| const AlphabetState & | getState (int num) const throw (BadIntException) |
| Get a state by its num. | |
Static Public Attributes | |
| static const std::string | STOP = "Stop" |
Protected Member Functions | |
| virtual void | registerState (const AlphabetState &st) |
| Add a state to the Alphabet. | |
| virtual void | setState (size_t pos, const AlphabetState &st) throw (IndexOutOfBoundsException) |
| Set a state in the Alphabet. | |
| void | resize (unsigned int size) |
| Resize the private alphabet_ vector. | |
| virtual AlphabetState & | getStateAt (size_t pos) throw (IndexOutOfBoundsException) |
| Get a state at a position in the alphabet_ vector. | |
| virtual const AlphabetState & | getStateAt (size_t pos) const throw (IndexOutOfBoundsException) |
| Get a state at a position in the alphabet_ vector. | |
| void | remap () |
| Re-update the maps using the alphabet_ vector content. | |
Protected Attributes | |
| std::vector< int > | stopCodons_ |
| the vector of the numbers of the stop codon states. | |
| int | initCodon_ |
| std::vector< const Alphabet * > | vAbsAlph_ |
Available codes | |
These vectors will be computed the first time you call the getAvailableInts or getAvailableChars method. | |
| std::vector< std::string > | charList_ |
| std::vector< int > | intList_ |
The abstract base class for codon alphabets.
Since codons are made of 3 nucleic bases (RNA or DNA), this class has a NucleicAlphabet field used to check char description. This nucleic alphabet is passed to the constructor. This class also adds some methods specific to codon manipulation.
Definition at line 62 of file CodonAlphabet.h.
| bpp::CodonAlphabet::CodonAlphabet | ( | const NucleicAlphabet * | alpha | ) | [inline] |
Builds a new codon alphabet from a nucleic alphabet.
| alpha | The nucleic alphabet to be used. |
Definition at line 86 of file CodonAlphabet.h.
| virtual bpp::CodonAlphabet::~CodonAlphabet | ( | ) | [inline, virtual] |
Definition at line 88 of file CodonAlphabet.h.
| int bpp::WordAlphabet::charToInt | ( | const std::string & | state | ) | const throw (BadCharException) [inline, virtual, inherited] |
Give the int description of a state given its string description.
| state | The string description. |
| BadCharException | When state is not a valid char description. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 113 of file WordAlphabet.h.
References bpp::WordAlphabet::containsGap(), bpp::WordAlphabet::containsUnresolved(), bpp::WordAlphabet::getSize(), and bpp::WordAlphabet::vAbsAlph_.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::WordAlphabet::getNPosition(), bpp::WordAlphabet::getPositions(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), isInit(), bpp::WordAlphabet::isUnresolved(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
| std::vector< int > WordAlphabet::getAlias | ( | int | state | ) | const throw (BadIntException) [virtual, inherited] |
Get all resolved states that match a generic state.
If the given state is not a generic code then the output vector will contain this unique code.
| state | The alias to resolve. |
| BadIntException | When state is not a valid integer. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 200 of file WordAlphabet.cpp.
| std::vector< std::string > WordAlphabet::getAlias | ( | const std::string & | state | ) | const throw (BadCharException) [virtual, inherited] |
Get all resolved states that match a generic state.
If the given state is not a generic code then the output vector will contain this unique code.
| state | The alias to resolve. |
| BadCharException | When state is not a valid char description. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 224 of file WordAlphabet.cpp.
References bpp::TextTools::toUpper().
| virtual std::string bpp::CodonAlphabet::getAlphabetType | ( | ) | const [pure virtual] |
Identification method.
Used to tell if two alphabets describe the same type of sequences. For instance, this method is used by sequence containers to compare two alphabets and allow or deny addition of sequences.
Reimplemented from bpp::WordAlphabet.
Implemented in bpp::InvertebrateMitochondrialCodonAlphabet, bpp::YeastMitochondrialCodonAlphabet, bpp::EchinodermMitochondrialCodonAlphabet, bpp::VertebrateMitochondrialCodonAlphabet, and bpp::StandardCodonAlphabet.
| int CodonAlphabet::getCodon | ( | int | pos1, |
| int | pos2, | ||
| int | pos3 | ||
| ) | const throw (BadIntException) [virtual] |
Get the int code for a codon given the int code of the three underlying positions.
The int code of each position must match the nucleic alphabet specified for this alphabet.
| pos1 | Int description for position 1. |
| pos2 | Int description for position 2. |
| pos3 | Int description for position 3. |
Definition at line 59 of file CodonAlphabet.cpp.
Referenced by bpp::GeneticCode::isFourFoldDegenerated(), bpp::CodonSiteTools::numberOfSynonymousDifferences(), and bpp::CodonSiteTools::numberOfSynonymousPositions().
| string CodonAlphabet::getCodon | ( | const std::string & | pos1, |
| const std::string & | pos2, | ||
| const std::string & | pos3 | ||
| ) | const throw (BadCharException) [virtual] |
Get the char code for a codon given the char code of the three underlying positions.
The char code of each position must match the nucleic alphabet specified for this alphabet. NB: This performs pos1 + pos2 + pos3 after checking for each position validity.
| pos1 | Char description for position 1. |
| pos2 | Char description for position 2. |
| pos3 | Char description for position 3. |
Definition at line 72 of file CodonAlphabet.cpp.
| int CodonAlphabet::getFirstPosition | ( | int | codon | ) | const throw (BadIntException) [virtual] |
Get the int code of the first position of a codon given its int description.
| codon | The int description of the codon. |
Definition at line 85 of file CodonAlphabet.cpp.
Referenced by bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::numberOfDifferences(), and bpp::CodonSiteTools::numberOfSubsitutions().
| string CodonAlphabet::getFirstPosition | ( | const std::string & | codon | ) | const throw (BadCharException) [virtual] |
Get the char code of the first position of a codon given its char description.
| codon | The char description of the codon. |
Definition at line 106 of file CodonAlphabet.cpp.
| int bpp::AbstractAlphabet::getGapCharacterCode | ( | ) | const [inline, virtual, inherited] |
Implements bpp::Alphabet.
Definition at line 132 of file AbstractAlphabet.h.
Referenced by bpp::SequenceTools::replaceStopsWithGaps().
| int WordAlphabet::getGeneric | ( | const std::vector< int > & | states | ) | const throw (BadIntException) [virtual, inherited] |
Get the generic state that match a set of states.
If the given states contain generic code, each generic code is first resolved and then the new generic state is returned. If only a single resolved state is given the function return this state.
| states | A vector of states to resolve. |
| BadIntException | When a state is not a valid integer. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 256 of file WordAlphabet.cpp.
| std::string WordAlphabet::getGeneric | ( | const std::vector< std::string > & | states | ) | const throw (BadCharException) [virtual, inherited] |
Get the generic state that match a set of states.
If the given states contain generic code, each generic code is first resolved and then the new generic state is returned. If only a single resolved state is given the function return this state.
| states | A vector of states to resolve. |
| BadCharException | when a state is not a valid char description. |
| CharStateNotSupportedException | when the alphabet does not support Char state for unresolved state. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 263 of file WordAlphabet.cpp.
| unsigned int bpp::WordAlphabet::getLength | ( | ) | const [inline, inherited] |
Returns the length of the word.
Definition at line 142 of file WordAlphabet.h.
References bpp::WordAlphabet::vAbsAlph_.
| const Alphabet* bpp::WordAlphabet::getNAlphabet | ( | size_t | n | ) | const [inline, inherited] |
Get the pointer to the Alphabet of the n-position.
| n | The position in the word (starting at 0). |
Definition at line 195 of file WordAlphabet.h.
References bpp::WordAlphabet::vAbsAlph_.
| std::string WordAlphabet::getName | ( | const std::string & | state | ) | const throw (BadCharException) [virtual, inherited] |
Get the complete name of a state given its string description.
In case of undefined characters (i.e. N and X for nucleic alphabets), this method will return the name of the undefined word.
| state | The string description of the given state. |
| BadCharException | When state is not a valid char description. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 186 of file WordAlphabet.cpp.
References bpp::AbstractAlphabet::getName().
Referenced by isStop().
| std::string AbstractAlphabet::getName | ( | int | state | ) | const throw (BadIntException) [virtual, inherited] |
Get the complete name of a state given its int description.
In case of several states with identical number (i.e. N and X for nucleic alphabets), this method returns the name of the first found in the vector.
| state | The int description of the given state. |
| BadIntException | When state is not a valid integer. |
Implements bpp::Alphabet.
Definition at line 130 of file AbstractAlphabet.cpp.
| int bpp::WordAlphabet::getNPosition | ( | int | word, |
| size_t | n | ||
| ) | const throw (BadIntException) [inline, inherited] |
Get the int code of the n-position of a word given its int description.
| word | The int description of the word. |
| n | The position in the word (starting at 0). |
Definition at line 233 of file WordAlphabet.h.
References bpp::AbstractAlphabet::intToChar(), and bpp::WordAlphabet::vAbsAlph_.
Referenced by bpp::SequenceContainerTools::getCodonPosition().
| std::string bpp::WordAlphabet::getNPosition | ( | const std::string & | word, |
| size_t | n | ||
| ) | const throw (BadCharException) [inline, inherited] |
Get the char code of the n-position of a word given its char description.
| word | The char description of the word. |
| n | The position in the word (starting at 0). |
Definition at line 267 of file WordAlphabet.h.
References bpp::WordAlphabet::charToInt(), and bpp::WordAlphabet::vAbsAlph_.
| virtual const NucleicAlphabet* const bpp::CodonAlphabet::getNucleicAlphabet | ( | ) | const [inline, virtual] |
Definition at line 230 of file CodonAlphabet.h.
References bpp::WordAlphabet::vAbsAlph_.
Referenced by bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SequenceContainerTools::getCodonPosition(), bpp::CodonSiteTools::isMonoSitePolymorphic(), and bpp::CodonSiteTools::numberOfSubsitutions().
| unsigned int bpp::AbstractAlphabet::getNumberOfChars | ( | ) | const [inline, virtual, inherited] |
Get the number of supported characters in this alphabet, including generic characters (e.g. return 20 for DNA alphabet).
Implements bpp::Alphabet.
Definition at line 119 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::alphabet_.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::WordAlphabet::getNumberOfTypes(), bpp::WordAlphabet::getSize(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::NucleicAlphabet::registerState(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
| unsigned int bpp::WordAlphabet::getNumberOfTypes | ( | ) | const [inline, virtual, inherited] |
Returns the number of resolved states + one for unresolved.
Implements bpp::Alphabet.
Definition at line 152 of file WordAlphabet.h.
References bpp::AbstractAlphabet::getNumberOfChars().
| std::vector<int> bpp::WordAlphabet::getPositions | ( | int | word | ) | const throw (BadIntException) [inline, inherited] |
Get the int codes of each position of a word given its int description.
| word | The int description of the word. |
Definition at line 249 of file WordAlphabet.h.
References bpp::WordAlphabet::charToInt(), bpp::AbstractAlphabet::intToChar(), and bpp::WordAlphabet::vAbsAlph_.
Referenced by bpp::GeneticCode::isFourFoldDegenerated(), bpp::CodonSiteTools::numberOfSynonymousDifferences(), and bpp::CodonSiteTools::numberOfSynonymousPositions().
| std::vector<std::string> bpp::WordAlphabet::getPositions | ( | const std::string & | word | ) | const throw (BadCharException) [inline, inherited] |
Get the char codes of each position of a word given its char description.
| word | The char description of the word. |
Definition at line 285 of file WordAlphabet.h.
References bpp::WordAlphabet::charToInt().
| int CodonAlphabet::getSecondPosition | ( | int | codon | ) | const throw (BadIntException) [virtual] |
Get the int code of the second position of a codon given its int description.
| codon | The int description of the codon. |
Definition at line 92 of file CodonAlphabet.cpp.
Referenced by bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::numberOfDifferences(), and bpp::CodonSiteTools::numberOfSubsitutions().
| string CodonAlphabet::getSecondPosition | ( | const std::string & | codon | ) | const throw (BadCharException) [virtual] |
Get the char code of the second position of a codon given its char description.
| codon | The char description of the codon. |
Definition at line 114 of file CodonAlphabet.cpp.
| unsigned int bpp::WordAlphabet::getSize | ( | ) | const [inline, virtual, inherited] |
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet). This is the method you'll need in most cases.
Implements bpp::Alphabet.
Definition at line 124 of file WordAlphabet.h.
References bpp::AbstractAlphabet::getNumberOfChars().
Referenced by bpp::WordAlphabet::build_(), bpp::WordAlphabet::charToInt(), and bpp::WordAlphabet::getUnknownCharacterCode().
| const AlphabetState & AbstractAlphabet::getState | ( | const std::string & | letter | ) | const throw (BadCharException) [virtual, inherited] |
Get a state by its letter.
This method must be overloaded in specialized classes to send back a reference of the corect type.
| letter | The letter of the state to find. |
| BadCharException | If the letter is not in the Alphabet. |
Implements bpp::Alphabet.
Reimplemented in bpp::NucleicAlphabet, and bpp::ProteicAlphabet.
Definition at line 89 of file AbstractAlphabet.cpp.
Referenced by bpp::CaseMaskedAlphabet::CaseMaskedAlphabet().
| const AlphabetState & AbstractAlphabet::getState | ( | int | num | ) | const throw (BadIntException) [virtual, inherited] |
Get a state by its num.
This method must be overloaded in specialized classes to send back a reference of the corect type.
| num | The num of the state to find. |
| BadIntException | If the num is not in the Alphabet. |
Implements bpp::Alphabet.
Reimplemented in bpp::NucleicAlphabet, and bpp::ProteicAlphabet.
Definition at line 98 of file AbstractAlphabet.cpp.
| AlphabetState & AbstractAlphabet::getStateAt | ( | size_t | pos | ) | throw (IndexOutOfBoundsException) [protected, virtual, inherited] |
Get a state at a position in the alphabet_ vector.
This method must be overloaded in specialized classes to send back a reference of the corect type.
| pos | The index of the state in the alphabet_ vector. |
| IndexOutOfBoundsException | If pos is out of the vector. |
Definition at line 107 of file AbstractAlphabet.cpp.
Referenced by bpp::WordAlphabet::build_(), bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
| const AlphabetState & AbstractAlphabet::getStateAt | ( | size_t | pos | ) | const throw (IndexOutOfBoundsException) [protected, virtual, inherited] |
Get a state at a position in the alphabet_ vector.
This method must be overloaded in specialized classes to send back a reference of the corect type.
| pos | The index of the state in the alphabet_ vector. |
| IndexOutOfBoundsException | If pos is out of the vector. |
Definition at line 115 of file AbstractAlphabet.cpp.
| unsigned int bpp::WordAlphabet::getStateCodingSize | ( | ) | const [inline, virtual, inherited] |
Get the size of the string coding a state.
Reimplemented from bpp::AbstractAlphabet.
Definition at line 324 of file WordAlphabet.h.
References bpp::WordAlphabet::vAbsAlph_.
| const std::vector< std::string > & AbstractAlphabet::getSupportedChars | ( | ) | const [virtual, inherited] |
Note for developers of new alphabets: we return a const reference here since the list is supposed to be stored within the class and should not be modified outside the class.
Implements bpp::Alphabet.
Definition at line 260 of file AbstractAlphabet.cpp.
Referenced by bpp::CaseMaskedAlphabet::CaseMaskedAlphabet().
| const std::vector< int > & AbstractAlphabet::getSupportedInts | ( | ) | const [virtual, inherited] |
Note for developers of new alphabets: we return a const reference here since the list is supposed to be stored within the class and should not be modified outside the class.
Implements bpp::Alphabet.
Definition at line 243 of file AbstractAlphabet.cpp.
| int CodonAlphabet::getThirdPosition | ( | int | codon | ) | const throw (BadIntException) [virtual] |
Get the int code of the third position of a codon given its int description.
| codon | The int description of the codon. |
Definition at line 99 of file CodonAlphabet.cpp.
Referenced by bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::numberOfDifferences(), and bpp::CodonSiteTools::numberOfSubsitutions().
| string CodonAlphabet::getThirdPosition | ( | const std::string & | codon | ) | const throw (BadCharException) [virtual] |
Get the char code of the third position of a codon given its char description.
| codon | The char description of the codon. |
Definition at line 122 of file CodonAlphabet.cpp.
| int bpp::WordAlphabet::getUnknownCharacterCode | ( | ) | const [inline, virtual, inherited] |
Implements bpp::Alphabet.
Definition at line 158 of file WordAlphabet.h.
References bpp::WordAlphabet::getSize().
Referenced by bpp::WordAlphabet::isUnresolved().
| int WordAlphabet::getWord | ( | const std::vector< int > & | vint, |
| size_t | pos = 0 |
||
| ) | const throw (IndexOutOfBoundsException) [virtual, inherited] |
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.
| vint | description for all the positions. |
| pos | the start position to match in the vector. |
| IndexOutOfBoundsException | In case of wrong position. |
Definition at line 270 of file WordAlphabet.cpp.
| std::string WordAlphabet::getWord | ( | const std::vector< std::string > & | vpos, |
| size_t | pos = 0 |
||
| ) | const throw (IndexOutOfBoundsException, BadCharException) [virtual, inherited] |
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.
| vpos | vector description for all the positions. |
| pos | the start position to match in the vector. |
| IndexOutOfBoundsException | In case of wrong position. |
Definition at line 286 of file WordAlphabet.cpp.
| bool WordAlphabet::hasUniqueAlphabet | ( | ) | const [inherited] |
Returns True if the Alphabet of the letters in the word are the same type.
Definition at line 140 of file WordAlphabet.cpp.
References bpp::WordAlphabet::getAlphabetType(), and bpp::WordAlphabet::vAbsAlph_.
| std::string AbstractAlphabet::intToChar | ( | int | state | ) | const throw (BadIntException) [virtual, inherited] |
Give the string description of a state given its int description.
| state | The int description. |
| BadIntException | When state is not a valid integer. |
Implements bpp::Alphabet.
Reimplemented in bpp::RNY.
Definition at line 144 of file AbstractAlphabet.cpp.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::RNY::getAlias(), bpp::GeneticCode::getCodingSequence(), bpp::WordAlphabet::getNPosition(), bpp::NucleicAlphabet::getOverlap(), bpp::WordAlphabet::getPositions(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), isStop(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::NucleicAlphabet::subtract(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
| bool AbstractAlphabet::isCharInAlphabet | ( | const std::string & | state | ) | const [virtual, inherited] |
Tell if a state (specified by its string description) is allowed by the the alphabet.
| state | The string description. |
Implements bpp::Alphabet.
Reimplemented in bpp::LetterAlphabet.
Definition at line 161 of file AbstractAlphabet.cpp.
| bool bpp::AbstractAlphabet::isGap | ( | int | state | ) | const [inline, virtual, inherited] |
| state | The state to test. |
Implements bpp::Alphabet.
Reimplemented in bpp::RNY.
Definition at line 133 of file AbstractAlphabet.h.
| bool bpp::AbstractAlphabet::isGap | ( | const std::string & | state | ) | const [inline, virtual, inherited] |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 134 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::charToInt().
| bool bpp::CodonAlphabet::isInit | ( | int | codon | ) | const [inline] |
Tell whether a particular codon is the init codon.
| codon | The int description of the codon to test. |
Definition at line 211 of file CodonAlphabet.h.
References initCodon_.
Referenced by bpp::SequenceTools::getCDS().
| bool bpp::CodonAlphabet::isInit | ( | const std::string & | codon | ) | const [inline] |
Tell whether a particular codon is the init codon.
| codon | The char description of the codon to test. |
Definition at line 222 of file CodonAlphabet.h.
References bpp::WordAlphabet::charToInt(), and initCodon_.
| bool AbstractAlphabet::isIntInAlphabet | ( | int | state | ) | const [virtual, inherited] |
Tell if a state (specified by its int description) is allowed by the the alphabet.
| state | The int description. |
Implements bpp::Alphabet.
Definition at line 151 of file AbstractAlphabet.cpp.
| bool bpp::CodonAlphabet::isStop | ( | int | codon | ) | const [inline] |
Tell whether a particular codon is a stop codon.
| codon | The int description of the codon to test. |
Definition at line 189 of file CodonAlphabet.h.
References bpp::WordAlphabet::getName(), bpp::AbstractAlphabet::intToChar(), and STOP.
Referenced by bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SequenceTools::getCDS(), bpp::SequenceTools::getSequenceWithoutStops(), bpp::SiteTools::hasStopCodon(), bpp::GeneticCode::isFourFoldDegenerated(), bpp::CodonSiteTools::numberOfSynonymousDifferences(), bpp::CodonSiteTools::numberOfSynonymousPositions(), bpp::SequenceTools::removeStops(), and bpp::SequenceTools::replaceStopsWithGaps().
| bool bpp::CodonAlphabet::isStop | ( | const std::string & | codon | ) | const [inline] |
Tell whether a particular codon is a stop codon.
| codon | The char description of the codon to test. |
Definition at line 200 of file CodonAlphabet.h.
References bpp::WordAlphabet::getName(), and STOP.
| bool bpp::WordAlphabet::isUnresolved | ( | int | state | ) | const [inline, virtual, inherited] |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 163 of file WordAlphabet.h.
References bpp::WordAlphabet::getUnknownCharacterCode().
Referenced by bpp::CodonSiteTools::numberOfSynonymousPositions().
| bool bpp::WordAlphabet::isUnresolved | ( | const std::string & | state | ) | const [inline, virtual, inherited] |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 164 of file WordAlphabet.h.
References bpp::WordAlphabet::charToInt(), and bpp::WordAlphabet::getUnknownCharacterCode().
| unsigned int CodonAlphabet::numberOfStopCodons | ( | ) | const |
Returns the number of stop codons.
Definition at line 54 of file CodonAlphabet.cpp.
| void AbstractAlphabet::registerState | ( | const AlphabetState & | st | ) | [protected, virtual, inherited] |
Add a state to the Alphabet.
| st | The state to add. |
Reimplemented in bpp::LetterAlphabet, bpp::DefaultAlphabet, and bpp::BinaryAlphabet.
Definition at line 65 of file AbstractAlphabet.cpp.
References bpp::AlphabetState::clone().
| void bpp::AbstractAlphabet::remap | ( | ) | [inline, protected, inherited] |
Re-update the maps using the alphabet_ vector content.
Definition at line 207 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::alphabet_, and bpp::AbstractAlphabet::updateMaps_().
Referenced by bpp::WordAlphabet::build_().
| void bpp::AbstractAlphabet::resize | ( | unsigned int | size | ) | [inline, protected, inherited] |
Resize the private alphabet_ vector.
| size | The new size of the Alphabet. |
Definition at line 182 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::alphabet_.
Referenced by bpp::BinaryAlphabet::BinaryAlphabet(), bpp::WordAlphabet::build_(), bpp::DefaultAlphabet::DefaultAlphabet(), and bpp::RNY::RNY().
| Sequence * WordAlphabet::reverse | ( | const Sequence & | sequence | ) | const throw (AlphabetMismatchException, Exception) [inherited] |
Translate a whole sequence from words alphabet to letters alphabet.
| sequence | A sequence in words alphabet. |
| AlphabetMismatchException | If the sequence alphabet do not match the target alphabet. |
| Exception | Other kind of error, depending on the implementation. |
Definition at line 327 of file WordAlphabet.cpp.
References bpp::Sequence::append(), and bpp::BasicSymbolList::size().
| void AbstractAlphabet::setState | ( | size_t | pos, |
| const AlphabetState & | st | ||
| ) | throw (IndexOutOfBoundsException) [protected, virtual, inherited] |
Set a state in the Alphabet.
| pos | The index of the state in the alphabet_ vector. |
| st | The new state to put in the Alphabet. |
Reimplemented in bpp::LetterAlphabet.
Definition at line 74 of file AbstractAlphabet.cpp.
Referenced by bpp::BinaryAlphabet::BinaryAlphabet(), bpp::WordAlphabet::build_(), and bpp::RNY::RNY().
| const std::vector<int>& bpp::CodonAlphabet::stopCodons | ( | ) | const [inline] |
Returns the vector of the numbers of the stop codon states.
Definition at line 110 of file CodonAlphabet.h.
References stopCodons_.
| Sequence * WordAlphabet::translate | ( | const Sequence & | sequence, |
| size_t | pos = 0 |
||
| ) | const throw (AlphabetMismatchException, Exception) [inherited] |
Translate a whole sequence from letters alphabet to words alphabet.
| sequence | A sequence in letters alphabet. |
| pos | the start postion (default 0) |
| AlphabetMismatchException | If the sequence alphabet do not match the source alphabet. |
| Exception | Other kind of error, depending on the implementation. |
Definition at line 303 of file WordAlphabet.cpp.
std::vector<std::string> bpp::AbstractAlphabet::charList_ [mutable, protected, inherited] |
Definition at line 99 of file AbstractAlphabet.h.
int bpp::CodonAlphabet::initCodon_ [protected] |
Definition at line 72 of file CodonAlphabet.h.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), isInit(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), and bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet().
std::vector<int> bpp::AbstractAlphabet::intList_ [mutable, protected, inherited] |
Definition at line 100 of file AbstractAlphabet.h.
const string CodonAlphabet::STOP = "Stop" [static] |
Definition at line 77 of file CodonAlphabet.h.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), isStop(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
std::vector<int> bpp::CodonAlphabet::stopCodons_ [protected] |
the vector of the numbers of the stop codon states.
Definition at line 69 of file CodonAlphabet.h.
Referenced by bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), stopCodons(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
std::vector<const Alphabet* > bpp::WordAlphabet::vAbsAlph_ [protected, inherited] |
Definition at line 70 of file WordAlphabet.h.
Referenced by bpp::WordAlphabet::build_(), bpp::WordAlphabet::charToInt(), bpp::StandardCodonAlphabet::getAlphabetType(), bpp::VertebrateMitochondrialCodonAlphabet::getAlphabetType(), bpp::EchinodermMitochondrialCodonAlphabet::getAlphabetType(), bpp::YeastMitochondrialCodonAlphabet::getAlphabetType(), bpp::InvertebrateMitochondrialCodonAlphabet::getAlphabetType(), bpp::WordAlphabet::getAlphabetType(), bpp::WordAlphabet::getLength(), bpp::WordAlphabet::getNAlphabet(), bpp::WordAlphabet::getNPosition(), getNucleicAlphabet(), bpp::WordAlphabet::getPositions(), bpp::WordAlphabet::getStateCodingSize(), bpp::WordAlphabet::hasUniqueAlphabet(), and bpp::WordAlphabet::WordAlphabet().