bpp-seq  2.1.0
bpp::GeneticCode Class Reference

Partial implementation of the Transliterator interface for genetic code object. More...

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

+ Inheritance diagram for bpp::GeneticCode:
+ Collaboration diagram for bpp::GeneticCode:

List of all members.

Public Member Functions

 GeneticCode ()
 GeneticCode (const GeneticCode &gc)
GeneticCodeoperator= (const GeneticCode &gc)
virtual ~GeneticCode ()
Methods form the Transliterator interface.
const AlphabetgetSourceAlphabet () const
 Get the source alphabet.
const AlphabetgetTargetAlphabet () const
 Get the target alphabet.
virtual int translate (int state) const =0 throw (BadIntException, Exception)
 Translate a given state coded as a int from source alphabet to target alphabet.
virtual std::string translate (const std::string &state) const =0 throw (BadCharException, Exception)
 Translate a given state coded as a string from source alphabet to target alphabet.
virtual Sequencetranslate (const Sequence &sequence) const throw (Exception)
 Translate a whole sequence from source alphabet to target alphabet.
Specific methods.
bool areSynonymous (int i, int j) const throw (BadIntException)
bool areSynonymous (const std::string &i, const std::string &j) const throw (BadCharException)
std::vector< int > getSynonymous (int aminoacid) const throw (BadIntException)
std::vector< std::string > getSynonymous (const std::string &aminoacid) const throw (BadCharException)
bool isFourFoldDegenerated (int codon) const
SequencegetCodingSequence (const Sequence &sequence, bool lookForInitCodon=false, bool includeInitCodon=false) const throw (Exception)
 Get the subsequence corresponding to the coding part of a given sequence.

Protected Attributes

const CodonAlphabetcodonAlphabet_
const ProteicAlphabetproteicAlphabet_

Detailed Description

Partial implementation of the Transliterator interface for genetic code object.

A genetic code object if a translator from a codon alphabet to a proteic alphabet. Depending on the codon alphabet used, several genetic code can be implemented.

See also:
CodonAlphabet, ProteicAlphabet

Definition at line 79 of file GeneticCode.h.


Constructor & Destructor Documentation

Definition at line 87 of file GeneticCode.h.

bpp::GeneticCode::GeneticCode ( const GeneticCode gc) [inline]

Definition at line 93 of file GeneticCode.h.

virtual bpp::GeneticCode::~GeneticCode ( ) [inline, virtual]

Definition at line 107 of file GeneticCode.h.


Member Function Documentation

bool bpp::GeneticCode::areSynonymous ( int  i,
int  j 
) const throw (BadIntException) [inline]

Definition at line 131 of file GeneticCode.h.

References translate().

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

bool bpp::GeneticCode::areSynonymous ( const std::string &  i,
const std::string &  j 
) const throw (BadCharException) [inline]

Definition at line 135 of file GeneticCode.h.

References translate().

Sequence * GeneticCode::getCodingSequence ( const Sequence sequence,
bool  lookForInitCodon = false,
bool  includeInitCodon = false 
) const throw (Exception)

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 begining 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 128 of file GeneticCode.cpp.

References bpp::AbstractAlphabet::intToChar(), bpp::AlphabetTools::isCodonAlphabet(), bpp::AlphabetTools::isNucleicAlphabet(), bpp::SymbolList::size(), and bpp::SequenceTools::subseq().

const Alphabet* bpp::GeneticCode::getSourceAlphabet ( ) const [inline, virtual]

Get the source alphabet.

Returns:
The source alphabet.

Implements bpp::Transliterator.

Definition at line 115 of file GeneticCode.h.

References codonAlphabet_.

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

vector< int > GeneticCode::getSynonymous ( int  aminoacid) const throw (BadIntException)

Definition at line 55 of file GeneticCode.cpp.

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

Definition at line 76 of file GeneticCode.cpp.

const Alphabet* bpp::GeneticCode::getTargetAlphabet ( ) const [inline, virtual]

Get the target alphabet.

Returns:
The target alphabet.

Implements bpp::Transliterator.

Definition at line 116 of file GeneticCode.h.

References proteicAlphabet_.

bool GeneticCode::isFourFoldDegenerated ( int  codon) const
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 97 of file GeneticCode.cpp.

References codonAlphabet_, bpp::CodonAlphabet::getCodon(), bpp::WordAlphabet::getPositions(), bpp::CodonAlphabet::isStop(), and translate().

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

GeneticCode& bpp::GeneticCode::operator= ( const GeneticCode gc) [inline]

Definition at line 99 of file GeneticCode.h.

References codonAlphabet_, and proteicAlphabet_.

virtual int bpp::GeneticCode::translate ( int  state) const throw (BadIntException, Exception) [pure virtual]

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.
Exceptions:
BadIntExceptionIf the state is not a proper state for source alphabet.
ExceptionOther kind of error, depending on the implementation.

Implements bpp::AbstractTransliterator.

Implemented in bpp::InvertebrateMitochondrialGeneticCode, bpp::YeastMitochondrialGeneticCode, bpp::EchinodermMitochondrialGeneticCode, bpp::StandardGeneticCode, and bpp::VertebrateMitochondrialGeneticCode.

Referenced by areSynonymous(), isFourFoldDegenerated(), and translate().

virtual std::string bpp::GeneticCode::translate ( const std::string &  state) const throw (BadCharException, Exception) [pure virtual]

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.
Exceptions:
BadCharExceptionIf the state is not a proper state for source alphabet.
ExceptionOther kind of error, depending on the implementation.

Implements bpp::AbstractTransliterator.

Implemented in bpp::InvertebrateMitochondrialGeneticCode, bpp::YeastMitochondrialGeneticCode, bpp::EchinodermMitochondrialGeneticCode, bpp::StandardGeneticCode, and bpp::VertebrateMitochondrialGeneticCode.

virtual Sequence* bpp::GeneticCode::translate ( const Sequence sequence) const throw (Exception) [inline, virtual]

Translate a whole sequence from source alphabet to target alphabet.

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

Reimplemented from bpp::AbstractTransliterator.

Reimplemented in bpp::InvertebrateMitochondrialGeneticCode, bpp::YeastMitochondrialGeneticCode, bpp::EchinodermMitochondrialGeneticCode, bpp::StandardGeneticCode, and bpp::VertebrateMitochondrialGeneticCode.

Definition at line 119 of file GeneticCode.h.

References translate().


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends