bpp-seq3
3.0.0
|
A basic ProbabilisticSymbolList object. More...
#include <Bpp/Seq/ProbabilisticSymbolList.h>
Public Types | |
typedef Table< double > | DataTable |
Public Member Functions | |
BasicProbabilisticSymbolList (const Alphabet *alpha) | |
Build a new void BasicProbabilisticSymbolList object with the specified alphabet. More... | |
BasicProbabilisticSymbolList (const DataTable &list, const Alphabet *alpha) | |
Build a new BasicProbabilisticSymbolList object with the specified alphabet. More... | |
BasicProbabilisticSymbolList (const ProbabilisticSymbolList &list) | |
The generic copy constructor. More... | |
BasicProbabilisticSymbolList (const CruxSymbolList &list) | |
BasicProbabilisticSymbolList (const BasicProbabilisticSymbolList &list) | |
The copy constructor. More... | |
BasicProbabilisticSymbolList & | operator= (const ProbabilisticSymbolList &list) |
The generic assignment operator. More... | |
BasicProbabilisticSymbolList & | operator= (const BasicProbabilisticSymbolList &list) |
The assignement operator. More... | |
virtual | ~BasicProbabilisticSymbolList () |
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... | |
void | setContent (const std::vector< std::vector< double > > &list) |
Set the whole content of the list. More... | |
void | setContent (const DataTable &list) |
std::string | toString () const |
Convert the list as a string. More... | |
void | addElement (const std::vector< double > &element) |
Add a character to the end of the list. More... | |
void | addElement (size_t pos, const std::vector< double > &element) |
Add a character at a certain position in the list. More... | |
void | setElement (size_t pos, const std::vector< double > &element) |
Set the element at position 'pos' to character 'c'. More... | |
const std::vector< double > & | getElement (size_t pos) const |
Get the element at position 'pos' as a character. More... | |
virtual void | deleteElement (size_t pos) |
Remove the element at position 'pos'. More... | |
virtual void | deleteElements (size_t pos, size_t len) |
Remove the elements at position 'pos'. More... | |
const std::vector< std::vector< double > > & | getContent () const |
const DataTable & | getTable () const |
const std::vector< double > & | getValue (size_t pos) const |
checked access to a character in list. More... | |
const std::vector< double > & | operator[] (size_t pos) const |
Operator [] overloaded for quick access to a character in list. More... | |
std::vector< double > & | operator[] (size_t pos) |
Operator [] overloaded for quick access to a character in list. More... | |
double | getStateValueAt (size_t siteIndex, int state) const |
double | operator() (size_t siteIndex, int state) const |
void | shuffle () |
Randomly shuffle the content of the list, with linear complexity. More... | |
The Clonable interface | |
BasicProbabilisticSymbolList * | clone () const |
Protected Attributes | |
DataTable | content_ |
The list content. More... | |
Private Attributes | |
const Alphabet * | alphabet_ |
The Alphabet attribute must be initialized in the constructor and then can never be changed. More... | |
A basic ProbabilisticSymbolList object.
This is a general purpose container, containing an ordered list of elements. The states represented by the elements are defined by an alphabet object, which is passed to the list constructor by a pointer.
Definition at line 106 of file ProbabilisticSymbolList.h.
typedef Table<double> bpp::BasicProbabilisticSymbolList::DataTable |
Definition at line 110 of file ProbabilisticSymbolList.h.
BasicProbabilisticSymbolList::BasicProbabilisticSymbolList | ( | const Alphabet * | alpha | ) |
Build a new void BasicProbabilisticSymbolList object with the specified alphabet.
alpha | the alphabet to use. |
Definition at line 51 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, bpp::Alphabet::getResolvedChars(), and bpp::Table< class >::setRowNames().
Referenced by clone().
BasicProbabilisticSymbolList::BasicProbabilisticSymbolList | ( | const DataTable & | list, |
const Alphabet * | alpha | ||
) |
Build a new BasicProbabilisticSymbolList object with the specified alphabet.
list | The content of the site. |
alpha | The alphabet to use. |
If | the content is internally inconsistent, or is inconsistent with the specified alphabet. |
Definition at line 57 of file ProbabilisticSymbolList.cpp.
References content_, bpp::Alphabet::getResolvedChars(), setContent(), and bpp::Table< class >::setRowNames().
BasicProbabilisticSymbolList::BasicProbabilisticSymbolList | ( | const ProbabilisticSymbolList & | list | ) |
The generic copy constructor.
Definition at line 66 of file ProbabilisticSymbolList.cpp.
BasicProbabilisticSymbolList::BasicProbabilisticSymbolList | ( | const CruxSymbolList & | list | ) |
Definition at line 74 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, getAlphabet(), bpp::Alphabet::getResolvedChars(), bpp::CruxSymbolList::getStateValueAt(), bpp::Table< class >::setRowNames(), and size().
BasicProbabilisticSymbolList::BasicProbabilisticSymbolList | ( | const BasicProbabilisticSymbolList & | list | ) |
The copy constructor.
Definition at line 70 of file ProbabilisticSymbolList.cpp.
|
inlinevirtual |
Definition at line 180 of file ProbabilisticSymbolList.h.
|
virtual |
Add a character to the end of the list.
c | The character to add. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 175 of file ProbabilisticSymbolList.cpp.
References bpp::Table< class >::addColumn(), content_, and bpp::Table< class >::getNumberOfRows().
Referenced by bpp::AllelicAlphabet::convertFromStateAlphabet().
|
virtual |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
c | The character to add. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 199 of file ProbabilisticSymbolList.cpp.
References bpp::Table< class >::addColumn(), content_, and bpp::Table< class >::getNumberOfRows().
|
inlinevirtual |
Implements bpp::ProbabilisticSymbolList.
Definition at line 173 of file ProbabilisticSymbolList.h.
References BasicProbabilisticSymbolList().
|
inlinevirtual |
Remove the element at position 'pos'.
pos | The position of the element to remove. |
Implements bpp::CruxSymbolList.
Definition at line 213 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::deleteColumn().
|
inlinevirtual |
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.
Definition at line 215 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::deleteRows().
|
inlinevirtual |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolList.
Definition at line 183 of file ProbabilisticSymbolList.h.
References alphabet_.
Referenced by BasicProbabilisticSymbolList(), getStateValueAt(), and operator()().
|
inlinevirtual |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 220 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getData().
Referenced by bpp::BasicProbabilisticSequence::getContent().
|
inlinevirtual |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 208 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
Referenced by getValue().
|
inlinevirtual |
Reimplemented from bpp::CruxSymbolList.
Definition at line 239 of file ProbabilisticSymbolList.h.
References content_, getAlphabet(), bpp::Table< class >::getColumn(), bpp::Table< class >::getNumberOfColumns(), and bpp::Alphabet::getStateIndex().
|
inlinevirtual |
Implements bpp::ProbabilisticSymbolList.
Definition at line 222 of file ProbabilisticSymbolList.h.
References content_.
Referenced by bpp::BasicProbabilisticSequence::getTable().
|
inlinevirtual |
checked access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 224 of file ProbabilisticSymbolList.h.
References getElement().
|
inlinevirtual |
Reimplemented from bpp::CruxSymbolList.
Definition at line 246 of file ProbabilisticSymbolList.h.
References content_, getAlphabet(), bpp::Table< class >::getColumn(), and bpp::Alphabet::getStateIndex().
BasicProbabilisticSymbolList & BasicProbabilisticSymbolList::operator= | ( | const BasicProbabilisticSymbolList & | list | ) |
The assignement operator.
Definition at line 96 of file ProbabilisticSymbolList.cpp.
BasicProbabilisticSymbolList & BasicProbabilisticSymbolList::operator= | ( | const ProbabilisticSymbolList & | list | ) |
The generic assignment operator.
Definition at line 89 of file ProbabilisticSymbolList.cpp.
References alphabet_, bpp::CruxSymbolList::getAlphabet(), bpp::CoreSymbolList< T >::getContent(), and setContent().
Referenced by bpp::BasicProbabilisticSequence::operator=(), and bpp::ProbabilisticSite::operator=().
|
inlinevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 234 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
|
inlinevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 229 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
void BasicProbabilisticSymbolList::setContent | ( | const DataTable & | list | ) |
Definition at line 105 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, bpp::Table< class >::getNumberOfRows(), bpp::Alphabet::getResolvedChars(), bpp::Table< class >::getRowNames(), bpp::Table< class >::hasRowNames(), bpp::Table< class >::setRowNames(), size(), and bpp::TextTools::toString().
|
virtual |
Set the whole content of the list.
list | The new content of the list. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 161 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, bpp::Alphabet::getResolvedChars(), bpp::Table< class >::setRowNames(), and size().
Referenced by BasicProbabilisticSymbolList(), operator=(), and bpp::BasicProbabilisticSequence::setContent().
|
virtual |
Set the element at position 'pos' to character 'c'.
pos | The position of the character to set. |
c | The value of the element. |
Implements bpp::CoreSymbolList< std::vector< double > >.
Definition at line 216 of file ProbabilisticSymbolList.cpp.
References content_, bpp::Table< class >::getNumberOfRows(), and bpp::Table< class >::setColumn().
|
inlinevirtual |
Randomly shuffle the content of the list, with linear complexity.
Implements bpp::CruxSymbolList.
Definition at line 251 of file ProbabilisticSymbolList.h.
|
inlinevirtual |
Get the number of elements in the list.
Implements bpp::CruxSymbolList.
Definition at line 185 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getNumberOfColumns().
Referenced by BasicProbabilisticSymbolList(), and setContent().
|
virtual |
Convert the list as a string.
This method is useful for dumping a list to a file or to the screen for display.
Implements bpp::CruxSymbolList.
Definition at line 136 of file ProbabilisticSymbolList.cpp.
References content_, bpp::Table< class >::getNumberOfColumns(), bpp::Table< class >::getNumberOfRows(), and bpp::Table< class >::getRowName().
|
private |
The Alphabet attribute must be initialized in the constructor and then can never be changed.
To apply another alphabet to the list requires creating another list.
Definition at line 119 of file ProbabilisticSymbolList.h.
Referenced by BasicProbabilisticSymbolList(), getAlphabet(), operator=(), and setContent().
|
protected |
The list content.
Definition at line 125 of file ProbabilisticSymbolList.h.
Referenced by addElement(), BasicProbabilisticSymbolList(), deleteElement(), deleteElements(), getContent(), getElement(), getStateValueAt(), getTable(), operator()(), operator=(), operator[](), setContent(), setElement(), size(), and toString().