bpp-seq  2.1.0
 All Classes Namespaces Files Functions Variables Friends Pages
bpp::AlphabetTools Class Reference

Utilitary functions dealing with alphabets. More...

#include <Bpp/Seq/Alphabet/AlphabetTools.h>

+ Collaboration diagram for bpp::AlphabetTools:

Public Member Functions

 AlphabetTools ()
 
virtual ~AlphabetTools ()
 

Static Public Member Functions

static int getType (char state)
 Character identification method for sequence's alphabet identification. More...
 
static bool checkAlphabetCodingSize (const Alphabet &alphabet) throw (AlphabetException)
 This checks that all characters in the alphabet are coded by a string of same length. More...
 
static bool checkAlphabetCodingSize (const Alphabet *alphabet) throw (AlphabetException)
 This checks that all characters in the alphabet are coded by a string of same length. More...
 
static unsigned int getAlphabetCodingSize (const Alphabet &alphabet) throw (AlphabetException)
 In case that all states in the given alphabet have a string description of same length, send this length; e.g. 3 for codon alphabets. More...
 
static unsigned int getAlphabetCodingSize (const Alphabet *alphabet) throw (AlphabetException)
 In case that all states in the given alphabet have a string description of same length, send this length; e.g. 3 for codon alphabets. More...
 
static bool isNucleicAlphabet (const Alphabet *alphabet)
 
static bool isDNAAlphabet (const Alphabet *alphabet)
 
static bool isRNAAlphabet (const Alphabet *alphabet)
 
static bool isProteicAlphabet (const Alphabet *alphabet)
 
static bool isCodonAlphabet (const Alphabet *alphabet)
 
static bool isWordAlphabet (const Alphabet *alphabet)
 
static bool isRNYAlphabet (const Alphabet *alphabet)
 
static bool isBinaryAlphabet (const Alphabet *alphabet)
 
static bool isDefaultAlphabet (const Alphabet *alphabet)
 
static bool match (const Alphabet *alphabet, int i, int j)
 Tell if two characters match according to a given alphabet. More...
 

Static Public Attributes

static const DNA DNA_ALPHABET
 
static const RNA RNA_ALPHABET
 
static const ProteicAlphabet PROTEIN_ALPHABET
 
static const DefaultAlphabet DEFAULT_ALPHABET
 

Static Private Member Functions

template<class Y >
static bool alphabetInheritsFrom (const Alphabet *alphabet)
 

Detailed Description

Utilitary functions dealing with alphabets.

Definition at line 59 of file AlphabetTools.h.

Constructor & Destructor Documentation

bpp::AlphabetTools::AlphabetTools ( )
inline

Definition at line 68 of file AlphabetTools.h.

virtual bpp::AlphabetTools::~AlphabetTools ( )
inlinevirtual

Definition at line 69 of file AlphabetTools.h.

Member Function Documentation

template<class Y >
static bool bpp::AlphabetTools::alphabetInheritsFrom ( const Alphabet alphabet)
inlinestaticprivate

Definition at line 215 of file AlphabetTools.h.

bool AlphabetTools::checkAlphabetCodingSize ( const Alphabet alphabet) throw (AlphabetException)
static

This checks that all characters in the alphabet are coded by a string of same length.

This method is used when states are coded by more than one character, typically: codon alphabets.

Parameters
alphabetThe alphabet to check.
Returns
True if all text description have the same length (e.g. 3 for codon alphabet).

Definition at line 89 of file AlphabetTools.cpp.

bool AlphabetTools::checkAlphabetCodingSize ( const Alphabet alphabet) throw (AlphabetException)
static

This checks that all characters in the alphabet are coded by a string of same length.

This function performs the same work as the previous one, but deals with pointers instead of reference. This may be more convenient since we often use pointers on alphabets.

Parameters
alphabeta pointer toward the alphabet to check.
Returns
True if all text description have the same length (e.g. 3 for codon alphabet).

Definition at line 104 of file AlphabetTools.cpp.

unsigned int AlphabetTools::getAlphabetCodingSize ( const Alphabet alphabet) throw (AlphabetException)
static

In case that all states in the given alphabet have a string description of same length, send this length; e.g. 3 for codon alphabets.

Parameters
alphabetThe alphabet to analyse.
Returns
The common size of all text descriptionif there is one. Else throws an AlphabetException.

Definition at line 111 of file AlphabetTools.cpp.

Referenced by bpp::StringSequenceTools::codeSequence().

unsigned int AlphabetTools::getAlphabetCodingSize ( const Alphabet alphabet) throw (AlphabetException)
static

In case that all states in the given alphabet have a string description of same length, send this length; e.g. 3 for codon alphabets.

This function performs the same work as the previous one, but deals with pointers instead of reference. This may be more convenient since we often use pointers on alphabets.

Parameters
alphabeta pointer toward the alphabet to analyse.
Returns
The common size of all text descriptionif there is one. Else throws an AlphabetException.

Definition at line 120 of file AlphabetTools.cpp.

int AlphabetTools::getType ( char  state)
static

Character identification method for sequence's alphabet identification.

Return :

  • -1 gap
  • 1 DNA specific (no character!)
  • 2 RNA specific (U)
  • 3 Protein specific (characters E, F, I, L, P, Q)
  • 4 Nucleotide specific (no character)
  • 5 DNA or Protein specific (T)
  • 6 RNA or Protein specific (no character)
  • 7 Any alphabet (A, B, C, D, G, H, J, K, M, N, O, R, S, V, W, X, Y, Z, 0)
  • 0 Unknown character
Parameters
stateThe character to test.
Returns
The type code.

Definition at line 60 of file AlphabetTools.cpp.

References bpp::TextTools::toString(), bpp::TextTools::toString(), and bpp::TextTools::toString().

Referenced by bpp::StringSequenceTools::getAlphabetFromSequence().

static bool bpp::AlphabetTools::isBinaryAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the BinaryAlphabet class.
Parameters
alphabetThe alphabet to check.

Definition at line 179 of file AlphabetTools.h.

static bool bpp::AlphabetTools::isDefaultAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the DefaultAlphabet class.
Parameters
alphabetThe alphabet to check.

Definition at line 185 of file AlphabetTools.h.

Referenced by bpp::SiteContainerTools::resolveDottedAlignment().

static bool bpp::AlphabetTools::isDNAAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the DNA class.
Parameters
alphabetThe alphabet to check.

Definition at line 143 of file AlphabetTools.h.

static bool bpp::AlphabetTools::isNucleicAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the NucleicAlphabet class.
Parameters
alphabetThe alphabet to check.

Definition at line 137 of file AlphabetTools.h.

Referenced by bpp::SequenceApplicationTools::getAlphabet(), and bpp::GeneticCode::getCodingSequence().

static bool bpp::AlphabetTools::isProteicAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the ProteicAlphabet class.
Parameters
alphabetThe alphabet to check.

Definition at line 155 of file AlphabetTools.h.

Referenced by bpp::BppOAlphabetIndex1Format::read(), and bpp::BppOAlphabetIndex2Format::read().

static bool bpp::AlphabetTools::isRNAAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the RNA class.
Parameters
alphabetThe alphabet to check.

Definition at line 149 of file AlphabetTools.h.

static bool bpp::AlphabetTools::isRNYAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the RNY class.
Parameters
alphabetThe alphabet to check.

Definition at line 173 of file AlphabetTools.h.

Referenced by bpp::SequenceApplicationTools::getSiteContainer(), and bpp::SequenceApplicationTools::getSiteContainer().

static bool bpp::AlphabetTools::isWordAlphabet ( const Alphabet alphabet)
inlinestatic
Returns
True if the alphabet is an instanciation of the WordAlphabet class.
Parameters
alphabetThe alphabet to check.

Definition at line 167 of file AlphabetTools.h.

static bool bpp::AlphabetTools::match ( const Alphabet alphabet,
int  i,
int  j 
)
inlinestatic

Tell if two characters match according to a given alphabet.

Example (DNA):

* A,T: false
* A,A: true
* A,N: true
* A,Y: false
* N,Y: true
* N,N: true
* 
Returns
True if the two characters are identical, or are compatible if at least one of them is a generic character.
Parameters
alphabetThe alphabet to use.
iFirst character to check.
jSecondt character to check.

Definition at line 205 of file AlphabetTools.h.

References bpp::Alphabet::getAlias(), bpp::Alphabet::getAlias(), and bpp::VectorTools::vectorIntersection().

Referenced by bpp::SequenceTools::findFirstOf().

Member Data Documentation

const DefaultAlphabet AlphabetTools::DEFAULT_ALPHABET
static

Definition at line 65 of file AlphabetTools.h.

Referenced by bpp::NexusIOSequence::appendAlignmentFromStream().

const DNA AlphabetTools::DNA_ALPHABET
static

Definition at line 62 of file AlphabetTools.h.

const ProteicAlphabet AlphabetTools::PROTEIN_ALPHABET
static

Definition at line 64 of file AlphabetTools.h.

Referenced by bpp::AAChouFasmanAHelixIndex::getAlphabet(), bpp::AAMassIndex::getAlphabet(), bpp::AAVolumeIndex::getAlphabet(), bpp::AASEA1030Index::getAlphabet(), bpp::AAChouFasmanBSheetIndex::getAlphabet(), bpp::AASEAInf10Index::getAlphabet(), bpp::AASEASup30Index::getAlphabet(), bpp::AAChouFasmanTurnIndex::getAlphabet(), bpp::AASurfaceIndex::getAlphabet(), bpp::AAChenGuHuangHydrophobicityIndex::getAlphabet(), bpp::GranthamAAPolarityIndex::getAlphabet(), bpp::KleinAANetChargeIndex::getAlphabet(), bpp::GranthamAAVolumeIndex::getAlphabet(), bpp::AAChargeIndex::getAlphabet(), bpp::AAVolumeIndex::getIndex(), bpp::AAMassIndex::getIndex(), bpp::AASEA1030Index::getIndex(), bpp::AAChouFasmanBSheetIndex::getIndex(), bpp::AASEAInf10Index::getIndex(), bpp::AASEASup30Index::getIndex(), bpp::AAChouFasmanTurnIndex::getIndex(), bpp::AASurfaceIndex::getIndex(), bpp::AAChouFasmanAHelixIndex::getIndex(), bpp::AASEA1030Index::getIndex(), bpp::AAChouFasmanAHelixIndex::getIndex(), bpp::AAMassIndex::getIndex(), bpp::AASurfaceIndex::getIndex(), bpp::AAVolumeIndex::getIndex(), bpp::AASEAInf10Index::getIndex(), bpp::AAChouFasmanBSheetIndex::getIndex(), bpp::AASEASup30Index::getIndex(), bpp::AAChouFasmanTurnIndex::getIndex(), bpp::AAChenGuHuangHydrophobicityIndex::getIndex(), bpp::GranthamAAPolarityIndex::getIndex(), bpp::KleinAANetChargeIndex::getIndex(), bpp::GranthamAAVolumeIndex::getIndex(), bpp::AAChenGuHuangHydrophobicityIndex::getIndex(), bpp::GranthamAAPolarityIndex::getIndex(), bpp::KleinAANetChargeIndex::getIndex(), bpp::GranthamAAVolumeIndex::getIndex(), bpp::AAChargeIndex::getIndex(), and bpp::AAChargeIndex::getIndex().

const RNA AlphabetTools::RNA_ALPHABET
static

Definition at line 63 of file AlphabetTools.h.


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