|
bpp-seq
2.1.0
|
Case-sensitive letter alphabet. More...
#include <Bpp/Seq/Alphabet/CaseMaskedAlphabet.h>
Inheritance diagram for bpp::CaseMaskedAlphabet:
Collaboration diagram for bpp::CaseMaskedAlphabet:Public Member Functions | |
| CaseMaskedAlphabet (const LetterAlphabet *nocaseAlphabet) | |
| CaseMaskedAlphabet (const CaseMaskedAlphabet &cma) | |
| CaseMaskedAlphabet & | operator= (const CaseMaskedAlphabet &cma) |
| 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. More... | |
| unsigned int | getNumberOfTypes () const |
| Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number of integers used for state description. More... | |
| std::string | getAlphabetType () const |
| Identification method. More... | |
| int | getUnknownCharacterCode () const |
| bool | isUnresolved (int state) const |
| bool | isUnresolved (const std::string &state) const |
| const Alphabet * | getUnmaskedAlphabet () const |
| bool | isMasked (int state) const |
| bool | isMasked (const std::string &state) const |
| bool | isMasked (char state) const |
| int | getMaskedEquivalentState (int state) const throw (BadIntException) |
| Get the masked state equivalent to the input one. More... | |
| const std::string | getMaskedEquivalentState (const std::string &state) const throw (BadCharException, BadIntException) |
| Get the masked state equivalent to the input one. More... | |
| bool | isCharInAlphabet (char state) const |
| bool | isCharInAlphabet (const std::string &state) const |
| Tell if a state (specified by its string description) is allowed by the the alphabet. More... | |
| int | charToInt (const std::string &state) const throw (BadCharException) |
| Give the int description of a state given its string description. More... | |
Implement these methods from the Alphabet interface. | |
| unsigned int | getNumberOfChars () const |
| Get the number of supported characters in this alphabet, including generic characters (e.g. return 20 for DNA alphabet). More... | |
| std::string | getName (const std::string &state) const throw (BadCharException) |
| Get the complete name of a state given its string description. More... | |
| std::string | getName (int state) const throw (BadIntException) |
| Get the complete name of a state given its int description. More... | |
| std::string | intToChar (int state) const throw (BadIntException) |
| Give the string description of a state given its int description. More... | |
| bool | isIntInAlphabet (int state) const |
| Tell if a state (specified by its int description) is allowed by the the alphabet. More... | |
| std::vector< int > | getAlias (int state) const throw (BadIntException) |
| Get all resolved states that match a generic state. More... | |
| std::vector< std::string > | getAlias (const std::string &state) const throw (BadCharException) |
| Get all resolved states that match a generic state. More... | |
| int | getGeneric (const std::vector< int > &states) const throw (BadIntException) |
| Get the generic state that match a set of states. More... | |
| std::string | getGeneric (const std::vector< std::string > &states) const throw (AlphabetException) |
| Get the generic state that match a set of states. More... | |
| 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 |
Specific methods to access AlphabetState | |
| const AlphabetState & | getState (const std::string &letter) const throw (BadCharException) |
| Get a state by its letter. More... | |
| const AlphabetState & | getState (int num) const throw (BadIntException) |
| Get a state by its num. More... | |
Public Attributes | |
| const LetterAlphabet * | nocaseAlphabet_ |
Protected Member Functions | |
| void | registerState (const AlphabetState &st) |
| Add a state to the Alphabet. More... | |
| void | setState (size_t pos, const AlphabetState &st) throw (IndexOutOfBoundsException) |
| Set a state in the Alphabet. More... | |
| void | resize (unsigned int size) |
| Resize the private alphabet_ vector. More... | |
| virtual AlphabetState & | getStateAt (size_t pos) throw (IndexOutOfBoundsException) |
| Get a state at a position in the alphabet_ vector. More... | |
| virtual const AlphabetState & | getStateAt (size_t pos) const throw (IndexOutOfBoundsException) |
| Get a state at a position in the alphabet_ vector. More... | |
| void | remap () |
| Re-update the maps using the alphabet_ vector content. More... | |
| unsigned int | getStateCodingSize () const |
| Get the size of the string coding a state. More... | |
Protected Attributes | |
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_ |
Case-sensitive letter alphabet.
This alphabet is used for parsing comodity. It takes as input another LetterAlphabet and will create duplicate any aphanumerical and upper case state, by creating a lower case version of the state, also named "masked" state. Helper functions are provided to determine whether a given state is masked or unmasked.
Definition at line 59 of file CaseMaskedAlphabet.h.
| CaseMaskedAlphabet::CaseMaskedAlphabet | ( | const LetterAlphabet * | nocaseAlphabet | ) |
Definition at line 51 of file CaseMaskedAlphabet.cpp.
References bpp::AlphabetState::getLetter(), bpp::AlphabetState::getName(), bpp::AlphabetState::getNum(), nocaseAlphabet_, nocaseAlphabet_, bpp::LetterAlphabet::registerState(), bpp::LetterAlphabet::registerState(), and bpp::TextTools::toLower().
|
inline |
Definition at line 67 of file CaseMaskedAlphabet.h.
|
inlinevirtualinherited |
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 76 of file LetterAlphabet.h.
References bpp::LetterAlphabet::isCharInAlphabet(), and bpp::LetterAlphabet::letters_.
Referenced by bpp::AAIndex1Entry::getIndex(), bpp::AAChouFasmanBSheetIndex::getIndex(), bpp::AASEA1030Index::getIndex(), bpp::AASEAInf10Index::getIndex(), bpp::AASEASup30Index::getIndex(), bpp::AASurfaceIndex::getIndex(), bpp::AAChouFasmanTurnIndex::getIndex(), bpp::AAVolumeIndex::getIndex(), bpp::AAChouFasmanAHelixIndex::getIndex(), bpp::AAMassIndex::getIndex(), bpp::AAIndex2Entry::getIndex(), bpp::AAIndex2Entry::getIndex(), bpp::AAChenGuHuangHydrophobicityIndex::getIndex(), bpp::GranthamAAPolarityIndex::getIndex(), bpp::KleinAANetChargeIndex::getIndex(), bpp::GranthamAAVolumeIndex::getIndex(), bpp::AAChargeIndex::getIndex(), bpp::NucleicAlphabet::getOverlap(), bpp::NucleicAlphabet::getOverlap(), bpp::ProteicAlphabet::isUnresolved(), bpp::NucleicAlphabet::isUnresolved(), bpp::NucleicAlphabet::subtract(), and bpp::NucleicAlphabet::subtract().
|
virtualinherited |
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. |
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet, bpp::ProteicAlphabet, bpp::RNY, bpp::DNA, and bpp::RNA.
Definition at line 171 of file AbstractAlphabet.cpp.
|
virtualinherited |
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. |
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet, bpp::ProteicAlphabet, bpp::RNY, bpp::DNA, and bpp::RNA.
Definition at line 181 of file AbstractAlphabet.cpp.
|
inlinevirtual |
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.
Implements bpp::Alphabet.
Definition at line 78 of file CaseMaskedAlphabet.h.
|
inlinevirtualinherited |
Implements bpp::Alphabet.
Definition at line 132 of file AbstractAlphabet.h.
Referenced by bpp::SequenceTools::replaceStopsWithGaps().
|
virtualinherited |
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. |
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet, bpp::ProteicAlphabet, bpp::DNA, and bpp::RNA.
Definition at line 191 of file AbstractAlphabet.cpp.
References bpp::MapTools::getKeys(), and bpp::TextTools::toString().
|
virtualinherited |
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. |
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet, bpp::ProteicAlphabet, bpp::DNA, and bpp::RNA.
Definition at line 217 of file AbstractAlphabet.cpp.
References bpp::MapTools::getKeys(), and bpp::TextTools::toString().
| int CaseMaskedAlphabet::getMaskedEquivalentState | ( | int | state | ) | const throw (BadIntException) |
Get the masked state equivalent to the input one.
If the input state is masked, returns it "as is".
| state | The input state. |
| BadIntException | if the input state is not supported, or if there is no quivallent masked state. |
Definition at line 68 of file CaseMaskedAlphabet.cpp.
| const string CaseMaskedAlphabet::getMaskedEquivalentState | ( | const std::string & | state | ) | const throw (BadCharException, BadIntException) |
Get the masked state equivalent to the input one.
If the input state is masked, returns it "as is".
| state | The input state. |
| BadCharException | if the input state is not supported. |
| BadIntException | if there is no equivalent masked state. |
Definition at line 82 of file CaseMaskedAlphabet.cpp.
|
virtualinherited |
Get the complete name of a state given its string description.
In case of several states with identical number (i.e. N and X for nucleic alphabets), this method will return the name of the first found in the vector.
| state | The string description of the given state. |
| BadCharException | When state is not a valid char description. |
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet.
Definition at line 123 of file AbstractAlphabet.cpp.
Referenced by bpp::WordAlphabet::getName().
|
virtualinherited |
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.
|
inlinevirtualinherited |
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().
|
inlinevirtual |
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number of integers used for state description.
Implements bpp::Alphabet.
Definition at line 77 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
inlinevirtual |
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 76 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
virtualinherited |
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 CaseMaskedAlphabet(), bpp::ProteicAlphabet::getState(), bpp::ProteicAlphabet::getState(), bpp::NucleicAlphabet::getState(), and bpp::NucleicAlphabet::getState().
|
virtualinherited |
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.
|
protectedvirtualinherited |
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::WordAlphabet::build_(), bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::ProteicAlphabet::getStateAt(), bpp::ProteicAlphabet::getStateAt(), bpp::NucleicAlphabet::getStateAt(), bpp::NucleicAlphabet::getStateAt(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
|
protectedvirtualinherited |
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.
|
inlineprotectedvirtualinherited |
Get the size of the string coding a state.
Implements bpp::Alphabet.
Reimplemented in bpp::WordAlphabet.
Definition at line 213 of file AbstractAlphabet.h.
|
virtualinherited |
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 CaseMaskedAlphabet().
|
virtualinherited |
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.
|
inlinevirtual |
Implements bpp::Alphabet.
Definition at line 79 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
inline |
Definition at line 83 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
virtualinherited |
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::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::EchinodermMitochondrialCodonAlphabet::EchinodermMitochondrialCodonAlphabet(), bpp::RNY::getAlias(), bpp::GeneticCode::getCodingSequence(), bpp::GeneticCode::getCodingSequence(), bpp::GeneticCode::getCodingSequence(), bpp::WordAlphabet::getNPosition(), bpp::NucleicAlphabet::getOverlap(), bpp::WordAlphabet::getPositions(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::InvertebrateMitochondrialCodonAlphabet::InvertebrateMitochondrialCodonAlphabet(), bpp::CodonAlphabet::isStop(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::StandardCodonAlphabet::StandardCodonAlphabet(), bpp::NucleicAlphabet::subtract(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), bpp::VertebrateMitochondrialCodonAlphabet::VertebrateMitochondrialCodonAlphabet(), bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet(), bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet(), and bpp::YeastMitochondrialCodonAlphabet::YeastMitochondrialCodonAlphabet().
|
inlineinherited |
Definition at line 70 of file LetterAlphabet.h.
References bpp::LetterAlphabet::LETTER_UNDEF_VALUE, and bpp::LetterAlphabet::letters_.
Referenced by bpp::LetterAlphabet::charToInt(), and bpp::LetterAlphabet::isCharInAlphabet().
|
inlinevirtualinherited |
Tell if a state (specified by its string description) is allowed by the the alphabet.
| state | The string description. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 73 of file LetterAlphabet.h.
References bpp::LetterAlphabet::isCharInAlphabet().
|
inlinevirtualinherited |
| state | The state to test. |
Implements bpp::Alphabet.
Reimplemented in bpp::RNY.
Definition at line 133 of file AbstractAlphabet.h.
|
inlinevirtualinherited |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 134 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::charToInt().
|
virtualinherited |
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.
|
inline |
Definition at line 85 of file CaseMaskedAlphabet.h.
Referenced by bpp::SequenceWithAnnotationTools::createMaskAnnotation(), and isMasked().
|
inline |
Definition at line 86 of file CaseMaskedAlphabet.h.
References isMasked().
|
inline |
Definition at line 90 of file CaseMaskedAlphabet.h.
|
inlinevirtual |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 80 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
inlinevirtual |
| state | The state to test. |
Implements bpp::Alphabet.
Definition at line 81 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_.
|
inline |
Definition at line 69 of file CaseMaskedAlphabet.h.
References nocaseAlphabet_, and nocaseAlphabet_.
|
inlineprotectedvirtualinherited |
Add a state to the Alphabet.
| st | The state to add. |
Reimplemented from bpp::AbstractAlphabet.
Definition at line 83 of file LetterAlphabet.h.
References bpp::LetterAlphabet::caseSensitive_, bpp::AlphabetState::getLetter(), bpp::AlphabetState::getLetter(), bpp::AlphabetState::getLetter(), bpp::AlphabetState::getNum(), bpp::AlphabetState::getNum(), bpp::AlphabetState::getNum(), bpp::LetterAlphabet::letters_, bpp::LetterAlphabet::letters_, bpp::LetterAlphabet::letters_, and bpp::AbstractAlphabet::registerState().
Referenced by CaseMaskedAlphabet(), CaseMaskedAlphabet(), and bpp::NucleicAlphabet::registerState().
|
inlineprotectedinherited |
Re-update the maps using the alphabet_ vector content.
Definition at line 207 of file AbstractAlphabet.h.
References bpp::AbstractAlphabet::alphabet_, bpp::AbstractAlphabet::alphabet_, and bpp::AbstractAlphabet::updateMaps_().
Referenced by bpp::WordAlphabet::build_().
|
inlineprotectedinherited |
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().
|
inlineprotectedvirtualinherited |
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 from bpp::AbstractAlphabet.
Definition at line 93 of file LetterAlphabet.h.
References bpp::LetterAlphabet::caseSensitive_, bpp::LetterAlphabet::letters_, bpp::LetterAlphabet::letters_, bpp::LetterAlphabet::letters_, and bpp::AbstractAlphabet::setState().
Referenced by bpp::DefaultAlphabet::DefaultAlphabet(), bpp::DefaultAlphabet::DefaultAlphabet(), and bpp::NucleicAlphabet::setState().
|
mutableprotectedinherited |
Definition at line 99 of file AbstractAlphabet.h.
|
mutableprotectedinherited |
Definition at line 100 of file AbstractAlphabet.h.
| const LetterAlphabet* bpp::CaseMaskedAlphabet::nocaseAlphabet_ |
Definition at line 63 of file CaseMaskedAlphabet.h.
Referenced by CaseMaskedAlphabet(), CaseMaskedAlphabet(), getNumberOfTypes(), getSize(), getUnknownCharacterCode(), getUnmaskedAlphabet(), isUnresolved(), isUnresolved(), operator=(), and operator=().