Generated on Mon Jun 23 16:25:36 2008 for BIU-1.7.0 by doxygen 1.5.1

biu::Alphabet Class Reference

#include <Alphabet.hh>


Detailed Description

This class handels an alphabet for the sequence.

Each member of the alphabet maps to an unique int index.

Author:
Martin Mann, Sebastian Will, Andreas Richter

Definition at line 18 of file Alphabet.hh.

Public Types

typedef size_t AlphElem
typedef unsigned char CAlphElem
typedef std::vector< CAlphElemCSequence
typedef std::vector< AlphElemSequence

Public Member Functions

 Alphabet (const std::vector< std::string > &alphabetStrings)
 Alphabet (const std::string &alphabetString, const size_t elementLength_)
CSequence compress (const Alphabet::Sequence &sequence) const
Sequence decompress (const CSequence &sequence, const size_t seqLength) const
size_t getAlphabetSize () const
AlphElem getElement (const size_t index) const
AlphElem getElement (const std::string &alphElemStr) const
size_t getElementLength () const
size_t getIndex (const std::string &elemStr) const
size_t getIndex (const AlphElem &elem) const
Sequence getSequence (const std::string &seqString) const
std::string getString (const Alphabet::AlphElem &elem) const
std::string getString (const Alphabet::Sequence &sequence) const
bool isAlphabetSequence (const Sequence &seq) const
bool isAlphabetString (const std::string &str) const
bool operator!= (const Alphabet &alph2) const
bool operator== (const Alphabet &alph2) const
virtual ~Alphabet ()

Private Types

typedef std::map< std::string,
AlphElem
STR2ALPH_TYPE

Private Attributes

std::vector< std::string > alph2string
size_t elementLength
STR2ALPH_TYPE string2alph


Member Typedef Documentation

typedef size_t biu::Alphabet::AlphElem

The internal representation of an alphabet element.

Definition at line 22 of file Alphabet.hh.

typedef unsigned char biu::Alphabet::CAlphElem

The internal representation of a compressed alphabet element.

Definition at line 24 of file Alphabet.hh.

typedef std::vector<CAlphElem> biu::Alphabet::CSequence

The internal representation of a compressed sequence of alphabet elements.

Definition at line 30 of file Alphabet.hh.

typedef std::vector<AlphElem> biu::Alphabet::Sequence

The internal representation of a sequence of alphabet elements.

Definition at line 27 of file Alphabet.hh.

typedef std::map<std::string, AlphElem> biu::Alphabet::STR2ALPH_TYPE [private]

just a shortcut

Definition at line 35 of file Alphabet.hh.


Constructor & Destructor Documentation

biu::Alphabet::Alphabet ( const std::string &  alphabetString,
const size_t  elementLength_ 
)

Initialises an Alphabet object with the string representations given by the alphabetString. The string is members given in alphabetString.

The string it sliced into substrings of the length elementLength_ , therefor all alphabet elements have to have the same length.

Definition at line 9 of file Alphabet.cc.

biu::Alphabet::Alphabet ( const std::vector< std::string > &  alphabetStrings  ) 

Construct an alphabet from a vector of strings

The indexing of elements in the vector has to be preserved by the alphabet

Definition at line 30 of file Alphabet.cc.

biu::Alphabet::~Alphabet (  )  [virtual]

Definition at line 60 of file Alphabet.cc.


Member Function Documentation

Alphabet::CSequence biu::Alphabet::compress ( const Alphabet::Sequence sequence  )  const

Compresses a sequence.

Definition at line 152 of file Alphabet.cc.

Alphabet::Sequence biu::Alphabet::decompress ( const CSequence sequence,
const size_t  seqLength 
) const

Decompresses a sequence.

Parameters:
sequence the sequence to decompress
seqLength the length of the uncompressed sequence encoded

Definition at line 171 of file Alphabet.cc.

size_t biu::Alphabet::getAlphabetSize (  )  const [inline]

Returns the size of the alphabet.

Definition at line 72 of file Alphabet.hh.

Alphabet::AlphElem biu::Alphabet::getElement ( const size_t  index  )  const

Returns the corresponding AlphElem to the index.

Parameters:
index has to be < getAlphabetSize()

Definition at line 144 of file Alphabet.cc.

Alphabet::AlphElem biu::Alphabet::getElement ( const std::string &  alphElemStr  )  const

Returns the index the alphabet member maps to.

Definition at line 114 of file Alphabet.cc.

size_t biu::Alphabet::getElementLength (  )  const [inline]

Returns the length of a alphabet element.

Definition at line 77 of file Alphabet.hh.

size_t biu::Alphabet::getIndex ( const std::string &  elemStr  )  const

Returns the internal index of the AlphElem corresponding to the string. The index starts with 0 and is < getAlphabetSize()

Definition at line 139 of file Alphabet.cc.

size_t biu::Alphabet::getIndex ( const AlphElem elem  )  const

Returns the internal index of the AlphElem. The index starts with 0 and is < getAlphabetSize()

Definition at line 134 of file Alphabet.cc.

Alphabet::Sequence biu::Alphabet::getSequence ( const std::string &  seqString  )  const

Returns an internal sequence representation of the string.

Definition at line 80 of file Alphabet.cc.

std::string biu::Alphabet::getString ( const Alphabet::AlphElem elem  )  const

Returns the string representation of the alphabet member.

Definition at line 107 of file Alphabet.cc.

std::string biu::Alphabet::getString ( const Alphabet::Sequence sequence  )  const

Converts an internal sequence representation into a string.

Definition at line 94 of file Alphabet.cc.

bool biu::Alphabet::isAlphabetSequence ( const Sequence seq  )  const

Returns whether or not a sequencec contains only elements compatible with the alphabet or not

Definition at line 199 of file Alphabet.cc.

bool biu::Alphabet::isAlphabetString ( const std::string &  str  )  const

Returns whether or not a string contains only elements of the alphabet or not

Definition at line 122 of file Alphabet.cc.

bool biu::Alphabet::operator!= ( const Alphabet alph2  )  const

Definition at line 71 of file Alphabet.cc.

bool biu::Alphabet::operator== ( const Alphabet alph2  )  const

Definition at line 64 of file Alphabet.cc.


Field Documentation

std::vector<std::string> biu::Alphabet::alph2string [private]

a mapping from alphabet elements to their string representation

Definition at line 42 of file Alphabet.hh.

size_t biu::Alphabet::elementLength [private]

the length of a string representation of an alphabet element.

Definition at line 45 of file Alphabet.hh.

a mapping from a string representation to the corresponding alphabet element

Definition at line 39 of file Alphabet.hh.


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