bpp-seq3  3.0.0
bpp::MoldMitochondrialGeneticCode Class Reference

This class implements the mold, protozoan, and coelenterate mitochondrial code and the Mycoplasma/Spiroplasma code as describe on the NCBI website: http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=t#SG4. More...

#include <Bpp/Seq/GeneticCode/MoldMitochondrialGeneticCode.h>

+ Inheritance diagram for bpp::MoldMitochondrialGeneticCode:
+ Collaboration diagram for bpp::MoldMitochondrialGeneticCode:

Public Member Functions

 MoldMitochondrialGeneticCode (std::shared_ptr< const NucleicAlphabet > alphabet)
 
virtual ~MoldMitochondrialGeneticCode ()
 
virtual MoldMitochondrialGeneticCodeclone () const
 
size_t getNumberOfStopCodons () const
 
std::vector< int > getStopCodonsAsInt () const
 
std::vector< std::string > getStopCodonsAsChar () const
 
bool isStop (int state) const
 Tells is a particular codon is a stop codon. More...
 
bool isStop (const std::string &state) const
 Tells is a particular codon is a stop codon. More...
 
bool isAltStart (int state) const
 Tells is a particular codon is an alternative start codon. More...
 
bool isAltStart (const std::string &state) const
 Tells is a particular codon is an alternative start codon. More...
 
Methods form the Transliterator interface.
std::shared_ptr< const AlphabetgetSourceAlphabet () const override
 Get the source alphabet. More...
 
const AlphabetsourceAlphabet () const override
 Get the source alphabet. More...
 
std::shared_ptr< const AlphabetgetTargetAlphabet () const override
 Get the target alphabet. More...
 
const AlphabettargetAlphabet () const override
 Get the target alphabet. More...
 
int translate (int state) const override
 Translate a given state coded as a int from source alphabet to target alphabet. More...
 
std::string translate (const std::string &state) const override
 Translate a given state coded as a string from source alphabet to target alphabet. More...
 
std::unique_ptr< Sequencetranslate (const SequenceInterface &sequence) const override
 Translate a whole sequence from source alphabet to target alphabet. More...
 
Specific methods.
virtual std::shared_ptr< const CodonAlphabetgetCodonAlphabet () const
 Alias for getSourceAlphabet return a pointer toward a CodonAlphabet. More...
 
virtual const CodonAlphabetcodonAlphabet () const
 Alias for getSourceAlphabet return a pointer toward a CodonAlphabet. More...
 
virtual std::shared_ptr< const ProteicAlphabetgetProteicAlphabet () const
 Alias for getTargetAlphabet return a pointer toward a ProteicAlphabet. More...
 
virtual const ProteicAlphabetproteicAlphabet () const
 Alias for getTargetAlphabet return a pointer toward a ProteicAlphabet. More...
 
virtual bool isStart (int state) const
 Tells is a particular codon is a start codon. More...
 
virtual bool isStart (const std::string &state) const
 Tells is a particular codon is a start codon. More...
 
bool areSynonymous (int i, int j) const
 Tell if two codons are synonymous, that is, if they encode the same amino-acid. More...
 
bool areSynonymous (const std::string &i, const std::string &j) const
 Tell if two codons are synonymous, that is, if they encode the same amino-acid. More...
 
std::vector< int > getSynonymous (int aminoacid) const
 
std::vector< std::string > getSynonymous (const std::string &aminoacid) const
 
bool isFourFoldDegenerated (int codon) const
 
std::unique_ptr< SequencegetCodingSequence (const SequenceInterface &sequence, bool lookForInitCodon=false, bool includeInitCodon=false) const
 Get the subsequence corresponding to the coding part of a given sequence. More...
 

Protected Attributes

std::shared_ptr< const CodonAlphabetcodonAlphabet_
 
std::shared_ptr< const ProteicAlphabetproteicAlphabet_
 
std::map< int, int > tlnTable_
 

Private Member Functions

void init_ ()
 

Detailed Description

This class implements the mold, protozoan, and coelenterate mitochondrial code and the Mycoplasma/Spiroplasma code as describe on the NCBI website: http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=t#SG4.

Definition at line 19 of file MoldMitochondrialGeneticCode.h.

Constructor & Destructor Documentation

◆ MoldMitochondrialGeneticCode()

bpp::MoldMitochondrialGeneticCode::MoldMitochondrialGeneticCode ( std::shared_ptr< const NucleicAlphabet alphabet)
inline

Definition at line 23 of file MoldMitochondrialGeneticCode.h.

References init_().

Referenced by clone().

◆ ~MoldMitochondrialGeneticCode()

virtual bpp::MoldMitochondrialGeneticCode::~MoldMitochondrialGeneticCode ( )
inlinevirtual

Definition at line 29 of file MoldMitochondrialGeneticCode.h.

Member Function Documentation

◆ areSynonymous() [1/2]

bool bpp::GeneticCode::areSynonymous ( const std::string &  i,
const std::string &  j 
) const
inlineinherited

Tell if two codons are synonymous, that is, if they encode the same amino-acid.

Parameters
iThe character code for the first codon.
jThe character code for the second codon.
Returns
True if the two codons are synonymous.

Definition at line 217 of file GeneticCode.h.

References bpp::GeneticCode::translate().

◆ areSynonymous() [2/2]

bool bpp::GeneticCode::areSynonymous ( int  i,
int  j 
) const
inlineinherited

Tell if two codons are synonymous, that is, if they encode the same amino-acid.

Parameters
iThe numeric code for the first codon.
jThe numeric code for the second codon.
Returns
True if the two codons are synonymous.

Definition at line 205 of file GeneticCode.h.

References bpp::GeneticCode::translate().

Referenced by bpp::CodonSiteTools::numberOfSynonymousDifferences().

◆ clone()

virtual MoldMitochondrialGeneticCode* bpp::MoldMitochondrialGeneticCode::clone ( ) const
inlinevirtual

Implements bpp::GeneticCode.

Definition at line 31 of file MoldMitochondrialGeneticCode.h.

References MoldMitochondrialGeneticCode().

◆ codonAlphabet()

virtual const CodonAlphabet& bpp::GeneticCode::codonAlphabet ( ) const
inlinevirtualinherited

Alias for getSourceAlphabet return a pointer toward a CodonAlphabet.

Returns
A reference toward the codon alphabet.

Definition at line 111 of file GeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

◆ getCodingSequence()

unique_ptr< Sequence > GeneticCode::getCodingSequence ( const SequenceInterface sequence,
bool  lookForInitCodon = false,
bool  includeInitCodon = false 
) const
inherited

Get the subsequence corresponding to the coding part of a given sequence.

If lookForInitCodon if set to 'true', the subsequence will start at the first AUG motif, otherwise the subsequence will start at the beginning of the sequence. The subsequence ends at the first stop codon (excluded) found, or the end of the sequence.

The sequence may have a nucleotide or codon alphabet. The subsequence has the same alphabet, name and comments of the input sequence. In case of nucleotide sequence and if the lookForInitCodon option is checked, the phase will be determined from the sequence.

Parameters
sequenceThe sequence to parse.
lookForInitCodonTell if the AUG codon must be found.
includeInitCodon(if lookForInitCodon is true) tell if the init codon must be included in the subsequence.
Returns
A nucleotide/codon subsequence.

Definition at line 114 of file GeneticCode.cpp.

References bpp::CruxSymbolListInterface::alphabet(), bpp::GeneticCode::codonAlphabet_, bpp::AlphabetTools::isCodonAlphabet(), bpp::AlphabetTools::isNucleicAlphabet(), bpp::GeneticCode::isStop(), and bpp::CruxSymbolListInterface::size().

◆ getCodonAlphabet()

virtual std::shared_ptr<const CodonAlphabet> bpp::GeneticCode::getCodonAlphabet ( ) const
inlinevirtualinherited

◆ getNumberOfStopCodons()

size_t bpp::MoldMitochondrialGeneticCode::getNumberOfStopCodons ( ) const
inlinevirtual
Returns
The number of stop codons.

Implements bpp::GeneticCode.

Definition at line 37 of file MoldMitochondrialGeneticCode.h.

◆ getProteicAlphabet()

virtual std::shared_ptr<const ProteicAlphabet> bpp::GeneticCode::getProteicAlphabet ( ) const
inlinevirtualinherited

Alias for getTargetAlphabet return a pointer toward a ProteicAlphabet.

Returns
A pointer toward the protein alphabet.

Definition at line 118 of file GeneticCode.h.

References bpp::GeneticCode::proteicAlphabet_.

◆ getSourceAlphabet()

std::shared_ptr<const Alphabet> bpp::GeneticCode::getSourceAlphabet ( ) const
inlineoverridevirtualinherited

Get the source alphabet.

Returns
A pointer toward the source alphabet.

Implements bpp::TransliteratorInterface.

Definition at line 74 of file GeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

Referenced by bpp::CodonSiteTools::isSynonymousPolymorphic().

◆ getStopCodonsAsChar()

std::vector<std::string> bpp::MoldMitochondrialGeneticCode::getStopCodonsAsChar ( ) const
inlinevirtual
Returns
A vector will all char codes for stop codons.

Implements bpp::GeneticCode.

Definition at line 44 of file MoldMitochondrialGeneticCode.h.

◆ getStopCodonsAsInt()

std::vector<int> bpp::MoldMitochondrialGeneticCode::getStopCodonsAsInt ( ) const
inlinevirtual
Returns
A vector will all int codes for stop codons.

Implements bpp::GeneticCode.

Definition at line 39 of file MoldMitochondrialGeneticCode.h.

◆ getSynonymous() [1/2]

std::vector< std::string > GeneticCode::getSynonymous ( const std::string &  aminoacid) const
inherited

◆ getSynonymous() [2/2]

vector< int > GeneticCode::getSynonymous ( int  aminoacid) const
inherited

◆ getTargetAlphabet()

std::shared_ptr<const Alphabet> bpp::GeneticCode::getTargetAlphabet ( ) const
inlineoverridevirtualinherited

Get the target alphabet.

Returns
A pointer toward the target alphabet.

Implements bpp::TransliteratorInterface.

Definition at line 78 of file GeneticCode.h.

References bpp::GeneticCode::proteicAlphabet_.

◆ init_()

void MoldMitochondrialGeneticCode::init_ ( )
private

Definition at line 13 of file MoldMitochondrialGeneticCode.cpp.

Referenced by MoldMitochondrialGeneticCode().

◆ isAltStart() [1/2]

bool bpp::MoldMitochondrialGeneticCode::isAltStart ( const std::string &  state) const
inlinevirtual

Tells is a particular codon is an alternative start codon.

Parameters
stateThe character code for the state to test.
Returns
True if the state corresponds to an alternative start codon.

Implements bpp::GeneticCode.

Definition at line 69 of file MoldMitochondrialGeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

◆ isAltStart() [2/2]

bool bpp::MoldMitochondrialGeneticCode::isAltStart ( int  state) const
inlinevirtual

Tells is a particular codon is an alternative start codon.

Parameters
stateThe numeric code for the state to test.
Returns
True if the state corresponds to an alternative start codon.

Implements bpp::GeneticCode.

Definition at line 62 of file MoldMitochondrialGeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

◆ isFourFoldDegenerated()

bool GeneticCode::isFourFoldDegenerated ( int  codon) const
inherited
Returns
True if the specified codon is fourfold degenerated (that is, if a mutation in the fourth position does not change the aminoacid).
Author
Benoit Nabholz, Annabelle Haudry
Parameters
codonThe codon to test.

Definition at line 84 of file GeneticCode.cpp.

References bpp::GeneticCode::codonAlphabet_, bpp::GeneticCode::isStop(), and bpp::GeneticCode::translate().

Referenced by bpp::CodonSiteTools::isFourFoldDegenerated().

◆ isStart() [1/2]

virtual bool bpp::GeneticCode::isStart ( const std::string &  state) const
inlinevirtualinherited

Tells is a particular codon is a start codon.

Parameters
stateThe character code for the state to test.
Returns
True if the state corresponds to a start codon.

Definition at line 177 of file GeneticCode.h.

References bpp::GeneticCode::codonAlphabet_, and bpp::GeneticCode::isStart().

◆ isStart() [2/2]

virtual bool bpp::GeneticCode::isStart ( int  state) const
inlinevirtualinherited

Tells is a particular codon is a start codon.

Parameters
stateThe numeric code for the state to test.
Returns
True if the state corresponds to a start codon.

Definition at line 164 of file GeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

Referenced by bpp::SequenceTools::getCDS(), and bpp::GeneticCode::isStart().

◆ isStop() [1/2]

bool bpp::MoldMitochondrialGeneticCode::isStop ( const std::string &  state) const
inlinevirtual

Tells is a particular codon is a stop codon.

Parameters
stateThe character code for the state to test.
Returns
True if the state corresponds to a stop codon.

Implements bpp::GeneticCode.

Definition at line 56 of file MoldMitochondrialGeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

◆ isStop() [2/2]

bool bpp::MoldMitochondrialGeneticCode::isStop ( int  state) const
inlinevirtual

Tells is a particular codon is a stop codon.

Parameters
stateThe numeric code for the state to test.
Returns
True if the state corresponds to a stop codon.

Implements bpp::GeneticCode.

Definition at line 49 of file MoldMitochondrialGeneticCode.h.

References bpp::GeneticCode::codonAlphabet_.

◆ proteicAlphabet()

virtual const ProteicAlphabet& bpp::GeneticCode::proteicAlphabet ( ) const
inlinevirtualinherited

Alias for getTargetAlphabet return a pointer toward a ProteicAlphabet.

Returns
A reference toward the protein alphabet.

Definition at line 125 of file GeneticCode.h.

References bpp::GeneticCode::proteicAlphabet_.

◆ sourceAlphabet()

const Alphabet& bpp::GeneticCode::sourceAlphabet ( ) const
inlineoverridevirtualinherited

◆ targetAlphabet()

const Alphabet& bpp::GeneticCode::targetAlphabet ( ) const
inlineoverridevirtualinherited

Get the target alphabet.

Returns
A reference toward the target alphabet.

Implements bpp::TransliteratorInterface.

Definition at line 80 of file GeneticCode.h.

References bpp::GeneticCode::proteicAlphabet_.

◆ translate() [1/3]

std::unique_ptr<Sequence> bpp::GeneticCode::translate ( const SequenceInterface sequence) const
inlineoverridevirtualinherited

Translate a whole sequence from source alphabet to target alphabet.

Parameters
sequenceA sequence in source alphabet.
Returns
The corresponding sequence in target alphabet.

Implements bpp::TransliteratorInterface.

Definition at line 86 of file GeneticCode.h.

References bpp::AbstractTransliterator::translate().

◆ translate() [2/3]

std::string GeneticCode::translate ( const std::string &  state) const
overridevirtualinherited

Translate a given state coded as a string from source alphabet to target alphabet.

Parameters
stateA state in source alphabet.
Returns
The corresponding state in target alphabet.

Implements bpp::AbstractTransliterator.

Definition at line 34 of file GeneticCode.cpp.

References bpp::GeneticCode::codonAlphabet_, bpp::GeneticCode::proteicAlphabet_, and bpp::GeneticCode::translate().

◆ translate() [3/3]

int GeneticCode::translate ( int  state) const
overridevirtualinherited

Translate a given state coded as a int from source alphabet to target alphabet.

Parameters
stateA state in source alphabet.
Returns
The corresponding state in target alphabet.

Implements bpp::AbstractTransliterator.

Definition at line 20 of file GeneticCode.cpp.

References bpp::GeneticCode::codonAlphabet_, bpp::GeneticCode::isStop(), and bpp::GeneticCode::tlnTable_.

Referenced by bpp::GeneticCode::areSynonymous(), bpp::GeneticCode::getSynonymous(), bpp::GeneticCode::isFourFoldDegenerated(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::CodonSiteTools::numberOfSynonymousPositions(), and bpp::GeneticCode::translate().

Member Data Documentation

◆ codonAlphabet_

◆ proteicAlphabet_

◆ tlnTable_

std::map<int, int> bpp::GeneticCode::tlnTable_
protectedinherited

Definition at line 54 of file GeneticCode.h.

Referenced by bpp::GeneticCode::translate().


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