bpp-seq3
3.0.0
|
ProbabilisticSymbolList object. More...
#include <Bpp/Seq/ProbabilisticSymbolList.h>
Public Types | |
typedef std::vector< double > | SymbolType |
typedef Table< double > | DTable |
Public Member Functions | |
ProbabilisticSymbolList (std::shared_ptr< const Alphabet > &alpha) | |
Build a new void ProbabilisticSymbolList object with the specified alphabet. More... | |
ProbabilisticSymbolList (const DTable &list, std::shared_ptr< const Alphabet > &alpha) | |
Build a new ProbabilisticSymbolList object with the specified alphabet and constant as a DataTable. More... | |
ProbabilisticSymbolList (const std::vector< std::vector< double >> &list, std::shared_ptr< const Alphabet > &alpha) | |
Build a new ProbabilisticSymbolList object with the specified alphabet and constant as a VVdouble. More... | |
ProbabilisticSymbolList (const ProbabilisticSymbolListInterface &list) | |
The generic copy constructor. More... | |
ProbabilisticSymbolList (const CruxSymbolListInterface &list) | |
ProbabilisticSymbolList (const ProbabilisticSymbolList &list) | |
The copy constructor. More... | |
ProbabilisticSymbolList & | operator= (const ProbabilisticSymbolListInterface &list) |
The generic assignment operator. More... | |
ProbabilisticSymbolList & | operator= (const ProbabilisticSymbolList &list) |
The assignment operator. More... | |
virtual | ~ProbabilisticSymbolList () |
std::shared_ptr< const Alphabet > | getAlphabet () const override |
Get the alphabet associated to the list. More... | |
const Alphabet & | alphabet () const override |
Get the alphabet associated to the list. More... | |
size_t | size () const override |
Get the number of elements in the list. More... | |
void | setContent (const std::vector< std::vector< double >> &list) override |
void | setContent (const DTable &list) override |
std::string | toString () const override |
Convert the list as a string. More... | |
void | addElement (const std::vector< double > &element) override |
void | addElement (size_t pos, const std::vector< double > &element) override |
void | setElement (size_t pos, const std::vector< double > &element) override |
const std::vector< double > & | getElement (size_t pos) const override |
Get the element at position 'pos' as a character. More... | |
virtual void | deleteElement (size_t pos) override |
Remove the element at position 'pos'. More... | |
virtual void | deleteElements (size_t pos, size_t len) override |
Remove the elements at position 'pos'. More... | |
const std::vector< std::vector< double > > & | getContent () const override |
const DTable & | getTable () const override |
const std::vector< double > & | getValue (size_t pos) const override |
checked access to a character in list. More... | |
const std::vector< double > & | operator[] (size_t pos) const override |
Operator [] overloaded for quick access to a character in list. More... | |
std::vector< double > & | operator[] (size_t pos) override |
Operator [] overloaded for quick access to a character in list. More... | |
double | getStateValueAt (size_t siteIndex, int state) const override |
get value of a state at a position More... | |
double | operator() (size_t siteIndex, int state) const override |
get value of a state at a position More... | |
void | shuffle () override |
Randomly shuffle the content of the list, with linear complexity. More... | |
virtual void | setContent (const std::vector< T > &list)=0 |
Set the whole content of the list. More... | |
The Clonable interface | |
ProbabilisticSymbolList * | clone () const override |
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 | |
DTable | content_ |
The list content. More... | |
Private Attributes | |
std::shared_ptr< const Alphabet > | alphabet_ |
The Alphabet attribute must be initialized in the constructor and then can never be changed. More... | |
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 61 of file ProbabilisticSymbolList.h.
|
inherited |
Definition at line 35 of file ProbabilisticSymbolList.h.
|
inherited |
Definition at line 34 of file ProbabilisticSymbolList.h.
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | std::shared_ptr< const Alphabet > & | alpha | ) |
Build a new void ProbabilisticSymbolList object with the specified alphabet.
alpha | the alphabet to use. |
Definition at line 15 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, and bpp::Table< class >::setRowNames().
Referenced by clone().
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | const DTable & | list, |
std::shared_ptr< const Alphabet > & | alpha | ||
) |
Build a new ProbabilisticSymbolList object with the specified alphabet and constant as a DataTable.
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 21 of file ProbabilisticSymbolList.cpp.
References content_, bpp::ProbabilisticSymbolListInterface::setContent(), and bpp::Table< class >::setRowNames().
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | const std::vector< std::vector< double >> & | list, |
std::shared_ptr< const Alphabet > & | alpha | ||
) |
Build a new ProbabilisticSymbolList object with the specified alphabet and constant as a VVdouble.
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 28 of file ProbabilisticSymbolList.cpp.
References content_, bpp::ProbabilisticSymbolListInterface::setContent(), and bpp::Table< class >::setRowNames().
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | const ProbabilisticSymbolListInterface & | list | ) |
The generic copy constructor.
Definition at line 37 of file ProbabilisticSymbolList.cpp.
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | const CruxSymbolListInterface & | list | ) |
Definition at line 45 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, getAlphabet(), bpp::CruxSymbolListInterface::getStateValueAt(), bpp::Table< class >::setRowNames(), and size().
ProbabilisticSymbolList::ProbabilisticSymbolList | ( | const ProbabilisticSymbolList & | list | ) |
The copy constructor.
Definition at line 41 of file ProbabilisticSymbolList.cpp.
|
inlinevirtual |
Definition at line 139 of file ProbabilisticSymbolList.h.
|
override |
Definition at line 146 of file ProbabilisticSymbolList.cpp.
References bpp::Table< class >::addColumn(), content_, and bpp::Table< class >::getNumberOfRows().
|
pure virtualinherited |
Add a character to the end of the list.
c | The character to add. |
Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.
|
override |
Definition at line 171 of file ProbabilisticSymbolList.cpp.
References bpp::Table< class >::addColumn(), content_, and bpp::Table< class >::getNumberOfRows().
|
pure virtualinherited |
Add a character at a certain position in the list.
pos | The position where to insert the element. |
c | The character to add. |
Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.
|
inlineoverridevirtual |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 144 of file ProbabilisticSymbolList.h.
References alphabet_.
|
inlineoverridevirtual |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 132 of file ProbabilisticSymbolList.h.
References ProbabilisticSymbolList().
|
inlineoverridevirtual |
Remove the element at position 'pos'.
pos | The position of the element to remove. |
Implements bpp::CruxSymbolListInterface.
Definition at line 172 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::deleteColumn().
|
inlineoverridevirtual |
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::CruxSymbolListInterface.
Definition at line 177 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::deleteColumns().
|
inlineoverridevirtual |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 142 of file ProbabilisticSymbolList.h.
References alphabet_.
Referenced by getStateValueAt(), bpp::Pasta::nextSequence(), operator()(), ProbabilisticSymbolList(), and bpp::Pasta::writeSequence().
|
inlineoverridevirtual |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 182 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getData().
Referenced by bpp::Pasta::writeSequence().
|
inlineoverridevirtual |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 167 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
Referenced by getValue().
|
inlineoverridevirtual |
get value of a state at a position
position | position in the list |
state | state in the alphabet |
Implements bpp::CruxSymbolListInterface.
Definition at line 207 of file ProbabilisticSymbolList.h.
References content_, getAlphabet(), bpp::Table< class >::getColumn(), and bpp::Table< class >::getNumberOfColumns().
|
inlineoverridevirtual |
Implements bpp::ProbabilisticSymbolListInterface.
Definition at line 187 of file ProbabilisticSymbolList.h.
References content_.
|
inlineoverridevirtual |
checked access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 192 of file ProbabilisticSymbolList.h.
References getElement().
|
inlineoverridevirtual |
get value of a state at a position
Short-cut for getStateValueAt.
position | position in the list |
state | state in the alphabet |
Implements bpp::CruxSymbolListInterface.
Definition at line 214 of file ProbabilisticSymbolList.h.
References content_, getAlphabet(), and bpp::Table< class >::getColumn().
ProbabilisticSymbolList & ProbabilisticSymbolList::operator= | ( | const ProbabilisticSymbolList & | list | ) |
The assignment operator.
Definition at line 67 of file ProbabilisticSymbolList.cpp.
ProbabilisticSymbolList & ProbabilisticSymbolList::operator= | ( | const ProbabilisticSymbolListInterface & | list | ) |
The generic assignment operator.
Definition at line 60 of file ProbabilisticSymbolList.cpp.
References alphabet_, bpp::CruxSymbolListInterface::getAlphabet(), bpp::TemplateCoreSymbolListInterface< T >::getContent(), and bpp::ProbabilisticSymbolListInterface::setContent().
Referenced by bpp::ProbabilisticSequence::operator=(), and bpp::ProbabilisticSite::operator=().
|
inlineoverridevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 197 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
|
inlineoverridevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 202 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getColumn().
|
overridevirtual |
Implements bpp::ProbabilisticSymbolListInterface.
Definition at line 76 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, bpp::Table< class >::getNumberOfRows(), bpp::Table< class >::getRowNames(), bpp::Table< class >::hasRowNames(), bpp::Table< class >::setRowNames(), size(), and bpp::TextTools::toString().
|
override |
Definition at line 132 of file ProbabilisticSymbolList.cpp.
References alphabet_, content_, bpp::Table< class >::setRowNames(), and size().
Referenced by bpp::Pasta::nextSequence().
|
pure virtualinherited |
Set the whole content of the list.
list | The new content of the list. |
Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.
|
inherited |
Set the whole content of the list.
list | The new content of the list. |
Referenced by operator=(), and ProbabilisticSymbolList().
|
override |
Definition at line 188 of file ProbabilisticSymbolList.cpp.
References content_, bpp::Table< class >::getNumberOfRows(), and bpp::Table< class >::setColumn().
|
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::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.
|
inlineoverridevirtual |
Randomly shuffle the content of the list, with linear complexity.
Implements bpp::CruxSymbolListInterface.
Definition at line 219 of file ProbabilisticSymbolList.h.
|
inlineoverridevirtual |
Get the number of elements in the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 146 of file ProbabilisticSymbolList.h.
References content_, and bpp::Table< class >::getNumberOfColumns().
Referenced by bpp::SequenceContainerTools::getFrequencies(), bpp::ProbabilisticSite::getStateValueAt(), bpp::ProbabilisticSequence::getStateValueAt(), ProbabilisticSymbolList(), and setContent().
|
overridevirtual |
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::CruxSymbolListInterface.
Definition at line 108 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 71 of file ProbabilisticSymbolList.h.
Referenced by alphabet(), getAlphabet(), operator=(), ProbabilisticSymbolList(), and setContent().
|
protected |
The list content.
Definition at line 77 of file ProbabilisticSymbolList.h.
Referenced by addElement(), deleteElement(), deleteElements(), getContent(), getElement(), getStateValueAt(), getTable(), operator()(), operator=(), operator[](), ProbabilisticSymbolList(), setContent(), setElement(), size(), and toString().