bpp-seq3
3.0.0
|
A basic IntSymbolList object. More...
#include <Bpp/Seq/IntSymbolList.h>
Public Member Functions | |
BasicIntSymbolList (const Alphabet *alpha) | |
BasicIntSymbolList (const std::vector< std::string > &list, const Alphabet *alpha) | |
Build a new BasicIntSymbolList object with the specified alphabet. The content of the site is initialized from a vector of characters. More... | |
BasicIntSymbolList (const std::vector< int > &list, const Alphabet *alpha) | |
Build a new BasicIntSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers. More... | |
BasicIntSymbolList (const BasicIntSymbolList &list) | |
The copy constructor. More... | |
BasicIntSymbolList & | operator= (const IntSymbolList &list) |
The generic assignment operator. More... | |
BasicIntSymbolList & | operator= (const BasicIntSymbolList &list) |
The assignment operator. More... | |
virtual | ~BasicIntSymbolList () |
void | setContent (const std::vector< int > &list) |
void | setContent (const std::vector< std::string > &list) |
std::string | toString () const |
Convert the list as a string. More... | |
virtual void | addElement (const std::string &c) |
virtual void | addElement (size_t pos, const std::string &c) |
Add a character at a certain position in the list. More... | |
virtual void | setElement (size_t pos, const std::string &c) |
virtual std::string | getChar (size_t pos) const |
Get the element at position 'pos' as a character. More... | |
virtual double | getStateValueAt (size_t siteIndex, int state) const |
virtual double | operator() (size_t siteIndex, int state) const |
void | addElement (const int &v) |
Add a character to the end of the list. More... | |
void | addElement (size_t pos, const int &v) |
Add a character at a certain position in the list. More... | |
void | setElement (size_t pos, const int &v) |
Set the element at position 'pos' to character 'c'. More... | |
const Alphabet * | getAlphabet () const |
Get the alphabet associated to the list. More... | |
size_t | size () const |
Get the number of elements in the list. More... | |
virtual const std::vector< int > & | getContent () const |
void | deleteElement (size_t pos) |
Remove the element at position 'pos'. More... | |
void | deleteElements (size_t pos, size_t len) |
Remove the elements at position 'pos'. More... | |
virtual const int & | getElement (size_t pos) const |
Get the element at position 'pos' as a character. More... | |
virtual const int & | getValue (size_t pos) const |
checked access to a character in list. More... | |
virtual const int & | operator[] (size_t pos) const |
Operator [] overloaded for quick access to a character in list. More... | |
virtual int & | operator[] (size_t pos) |
Operator [] overloaded for quick access to a character in list. More... | |
virtual void | shuffle () |
Randomly shuffle the content of the list, with linear complexity. More... | |
The Clonable interface | |
BasicIntSymbolList * | clone () const |
Acting on the content of the list. | |
virtual void | setContent (const std::vector< T > &list)=0 |
Set the whole content of the list. More... | |
Edition methods. | |
virtual void | addElement (const T &c)=0 |
Add a character to the end of the list. More... | |
virtual void | addElement (size_t pos, const T &c)=0 |
Add a character at a certain position in the list. More... | |
virtual void | setElement (size_t pos, const T &c)=0 |
Set the element at position 'pos' to character 'c'. More... | |
Protected Attributes | |
std::vector< int > | content_ |
The list content. More... | |
Private Attributes | |
const Alphabet * | alphabet_ |
The Alphabet attribute must be initialized in constructor and then can never be changed. More... | |
A basic IntSymbolList object.
This is a general purpose container, containing an ordered list of states(= letters). The states that allowed to be present in the list are defined by an alphabet object, which is passed to the list constructor by a pointer.
For programming convenience, the states are stored as integers, but the translation toward and from a char description is easily performed with the Alphabet classes.
Definition at line 150 of file IntSymbolList.h.
|
inline |
Definition at line 154 of file IntSymbolList.h.
Referenced by clone().
BasicIntSymbolList::BasicIntSymbolList | ( | const std::vector< std::string > & | list, |
const Alphabet * | alpha | ||
) |
Build a new BasicIntSymbolList object with the specified alphabet. The content of the site is initialized from a vector of characters.
list | The content of the site. |
alpha | The alphabet to use. |
Definition at line 51 of file IntSymbolList.cpp.
References setContent().
BasicIntSymbolList::BasicIntSymbolList | ( | const std::vector< int > & | list, |
const Alphabet * | alpha | ||
) |
Build a new BasicIntSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers.
list | The content of the site. |
alpha | The alphabet to use. |
Definition at line 57 of file IntSymbolList.cpp.
References setContent().
BasicIntSymbolList::BasicIntSymbolList | ( | const BasicIntSymbolList & | list | ) |
The copy constructor.
Definition at line 72 of file IntSymbolList.cpp.
|
inlinevirtual |
Definition at line 200 of file IntSymbolList.h.
|
inlineinherited |
Add a character to the end of the list.
c | The character to add. |
Definition at line 199 of file SymbolList.h.
|
virtual |
Implements bpp::IntSymbolList.
Definition at line 135 of file IntSymbolList.cpp.
References bpp::SymbolList< int >::content_, and bpp::SymbolList< int >::getAlphabet().
Referenced by bpp::NucleicAcidsReplication::reverse(), and bpp::NucleicAcidsReplication::translate().
|
pure virtualinherited |
Add a character to the end of the list.
c | The character to add. |
Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.
Referenced by bpp::AlignedSequenceContainer::addSite(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::AbstractReverseTransliterator::reverse(), and bpp::AbstractTransliterator::translate().
|
inlineinherited |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
c | The character to add. |
Definition at line 204 of file SymbolList.h.
|
virtual |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
c | The character to add, given as a string. |
Implements bpp::IntSymbolList.
Definition at line 142 of file IntSymbolList.cpp.
References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::SymbolList< int >::size().
|
pure virtualinherited |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
c | The character to add. |
Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.
|
inlinevirtual |
Implements bpp::SymbolList< int >.
Reimplemented in bpp::Site, and bpp::BasicSequence.
Definition at line 196 of file IntSymbolList.h.
References BasicIntSymbolList().
|
inlinevirtualinherited |
Remove the element at position 'pos'.
pos | The position of the element to remove. |
Implements bpp::CruxSymbolList.
Reimplemented in bpp::EdSymbolList< int >.
Definition at line 185 of file SymbolList.h.
|
inlinevirtualinherited |
Remove the elements at position 'pos'.
pos | The position of the first element to remove. |
len | The length of the region to remove. |
Implements bpp::CruxSymbolList.
Reimplemented in bpp::EdSymbolList< int >.
Definition at line 192 of file SymbolList.h.
|
inlinevirtualinherited |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolList.
Definition at line 169 of file SymbolList.h.
|
virtual |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::IntSymbolList.
Reimplemented in bpp::BasicSequence.
Definition at line 160 of file IntSymbolList.cpp.
References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), bpp::Alphabet::intToChar(), and bpp::SymbolList< int >::size().
Referenced by bpp::BasicSequence::getChar(), and bpp::SiteContainerTools::resolveDottedAlignment().
|
inlinevirtualinherited |
Implements bpp::CoreSymbolList< T >.
Definition at line 178 of file SymbolList.h.
|
inlinevirtualinherited |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::CoreSymbolList< T >.
Definition at line 220 of file SymbolList.h.
|
inlinevirtual |
Reimplemented from bpp::CruxSymbolList.
Definition at line 217 of file IntSymbolList.h.
References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::Alphabet::isResolvedIn().
|
inlinevirtualinherited |
checked access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< T >.
Definition at line 227 of file SymbolList.h.
|
inlinevirtual |
Reimplemented from bpp::CruxSymbolList.
Definition at line 225 of file IntSymbolList.h.
References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::Alphabet::isResolvedIn().
BasicIntSymbolList & BasicIntSymbolList::operator= | ( | const BasicIntSymbolList & | list | ) |
The assignment operator.
Definition at line 84 of file IntSymbolList.cpp.
References bpp::SymbolList< T >::operator=().
BasicIntSymbolList& bpp::BasicIntSymbolList::operator= | ( | const IntSymbolList & | list | ) |
The generic assignment operator.
Referenced by bpp::BasicSequence::operator=(), and bpp::Site::operator=().
|
inlinevirtualinherited |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< T >.
Definition at line 236 of file SymbolList.h.
|
inlinevirtualinherited |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< T >.
Definition at line 234 of file SymbolList.h.
|
virtual |
Reimplemented from bpp::SymbolList< int >.
Reimplemented in bpp::BasicSequence.
Definition at line 113 of file IntSymbolList.cpp.
References bpp::SymbolList< int >::getAlphabet(), and bpp::SymbolList< T >::setContent().
Referenced by BasicIntSymbolList(), and bpp::BasicSequence::setContent().
|
virtual |
Implements bpp::IntSymbolList.
Reimplemented in bpp::BasicSequence.
Definition at line 92 of file IntSymbolList.cpp.
References bpp::Alphabet::charToInt(), bpp::SymbolList< int >::getAlphabet(), and bpp::SymbolList< T >::setContent().
|
pure virtualinherited |
Set the whole content of the list.
list | The new content of the list. |
Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.
Referenced by bpp::Pasta::nextSequence().
|
inlineinherited |
Set the element at position 'pos' to character 'c'.
pos | The position of the character to set. |
c | The value of the element. |
Definition at line 212 of file SymbolList.h.
|
virtual |
Implements bpp::IntSymbolList.
Definition at line 151 of file IntSymbolList.cpp.
References bpp::Alphabet::charToInt(), bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::SymbolList< int >::size().
Referenced by bpp::VectorSiteContainer::setSequence().
|
pure virtualinherited |
Set the element at position 'pos' to character 'c'.
pos | The position of the character to set. |
c | The value of the element. |
Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.
Referenced by bpp::SequenceTools::complement(), bpp::SequenceTools::invert(), bpp::SequenceTools::invertComplement(), bpp::SequenceTools::replaceStopsWithGaps(), and bpp::AlignedSequenceContainer::setSite().
|
inlinevirtualinherited |
Randomly shuffle the content of the list, with linear complexity.
Implements bpp::CruxSymbolList.
Definition at line 238 of file SymbolList.h.
|
inlinevirtualinherited |
Get the number of elements in the list.
Implements bpp::CruxSymbolList.
Definition at line 171 of file SymbolList.h.
|
virtual |
Convert the list as a string.
This method is useful for dumping a list to a file or to the screen for display.
Reimplemented from bpp::SymbolList< int >.
Reimplemented in bpp::BasicSequence.
Definition at line 128 of file IntSymbolList.cpp.
References bpp::SymbolList< int >::content_, bpp::StringSequenceTools::decodeSequence(), and bpp::SymbolList< int >::getAlphabet().
Referenced by bpp::BasicSequence::toString().
|
privateinherited |
The Alphabet attribute must be initialized in constructor and then can never be changed.
To apply another alphabet to a list you'll have to create a new list.
Definition at line 79 of file SymbolList.h.
|
protectedinherited |
The list content.
Definition at line 85 of file SymbolList.h.