bpp-seq3  3.0.0
bpp::BasicProbabilisticSymbolList Class Reference

A basic ProbabilisticSymbolList object. More...

#include <Bpp/Seq/ProbabilisticSymbolList.h>

+ Inheritance diagram for bpp::BasicProbabilisticSymbolList:
+ Collaboration diagram for bpp::BasicProbabilisticSymbolList:

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...
 
BasicProbabilisticSymbolListoperator= (const ProbabilisticSymbolList &list)
 The generic assignment operator. More...
 
BasicProbabilisticSymbolListoperator= (const BasicProbabilisticSymbolList &list)
 The assignement operator. More...
 
virtual ~BasicProbabilisticSymbolList ()
 
const AlphabetgetAlphabet () 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 DataTablegetTable () 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
BasicProbabilisticSymbolListclone () const
 

Protected Attributes

DataTable content_
 The list content. More...
 

Private Attributes

const Alphabetalphabet_
 The Alphabet attribute must be initialized in the constructor and then can never be changed. More...
 

Detailed Description

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.

See also
Alphabet

Definition at line 106 of file ProbabilisticSymbolList.h.

Member Typedef Documentation

◆ DataTable

Constructor & Destructor Documentation

◆ BasicProbabilisticSymbolList() [1/5]

BasicProbabilisticSymbolList::BasicProbabilisticSymbolList ( const Alphabet alpha)

Build a new void BasicProbabilisticSymbolList object with the specified alphabet.

Parameters
alphathe 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() [2/5]

BasicProbabilisticSymbolList::BasicProbabilisticSymbolList ( const DataTable list,
const Alphabet alpha 
)

Build a new BasicProbabilisticSymbolList object with the specified alphabet.

Parameters
listThe content of the site.
alphaThe alphabet to use.
Exceptions
Ifthe 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() [3/5]

BasicProbabilisticSymbolList::BasicProbabilisticSymbolList ( const ProbabilisticSymbolList list)

The generic copy constructor.

Definition at line 66 of file ProbabilisticSymbolList.cpp.

◆ BasicProbabilisticSymbolList() [4/5]

BasicProbabilisticSymbolList::BasicProbabilisticSymbolList ( const CruxSymbolList list)

◆ BasicProbabilisticSymbolList() [5/5]

BasicProbabilisticSymbolList::BasicProbabilisticSymbolList ( const BasicProbabilisticSymbolList list)

The copy constructor.

Definition at line 70 of file ProbabilisticSymbolList.cpp.

◆ ~BasicProbabilisticSymbolList()

virtual bpp::BasicProbabilisticSymbolList::~BasicProbabilisticSymbolList ( )
inlinevirtual

Definition at line 180 of file ProbabilisticSymbolList.h.

Member Function Documentation

◆ addElement() [1/2]

void BasicProbabilisticSymbolList::addElement ( const std::vector< double > &  c)
virtual

Add a character to the end of the list.

Parameters
cThe 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().

◆ addElement() [2/2]

void BasicProbabilisticSymbolList::addElement ( size_t  pos,
const std::vector< double > &  c 
)
virtual

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
cThe 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().

◆ clone()

BasicProbabilisticSymbolList* bpp::BasicProbabilisticSymbolList::clone ( ) const
inlinevirtual

◆ deleteElement()

virtual void bpp::BasicProbabilisticSymbolList::deleteElement ( size_t  pos)
inlinevirtual

Remove the element at position 'pos'.

Parameters
posThe position of the element to remove.

Implements bpp::CruxSymbolList.

Definition at line 213 of file ProbabilisticSymbolList.h.

References content_, and bpp::Table< class >::deleteColumn().

◆ deleteElements()

virtual void bpp::BasicProbabilisticSymbolList::deleteElements ( size_t  pos,
size_t  len 
)
inlinevirtual

Remove the elements at position 'pos'.

Parameters
posThe position of the first element to remove.
lenThe length of the region to remove.

Implements bpp::CruxSymbolList.

Definition at line 215 of file ProbabilisticSymbolList.h.

References content_, and bpp::Table< class >::deleteRows().

◆ getAlphabet()

const Alphabet* bpp::BasicProbabilisticSymbolList::getAlphabet ( ) const
inlinevirtual

Get the alphabet associated to the list.

Returns
A const pointer to the alphabet.
See also
Alphabet class.

Implements bpp::CruxSymbolList.

Definition at line 183 of file ProbabilisticSymbolList.h.

References alphabet_.

Referenced by BasicProbabilisticSymbolList(), getStateValueAt(), and operator()().

◆ getContent()

const std::vector<std::vector<double> >& bpp::BasicProbabilisticSymbolList::getContent ( ) const
inlinevirtual

◆ getElement()

const std::vector<double>& bpp::BasicProbabilisticSymbolList::getElement ( size_t  pos) const
inlinevirtual

Get the element at position 'pos' as a character.

Parameters
posThe 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().

◆ getStateValueAt()

double bpp::BasicProbabilisticSymbolList::getStateValueAt ( size_t  siteIndex,
int  state 
) const
inlinevirtual

◆ getTable()

const DataTable& bpp::BasicProbabilisticSymbolList::getTable ( ) const
inlinevirtual

Implements bpp::ProbabilisticSymbolList.

Definition at line 222 of file ProbabilisticSymbolList.h.

References content_.

Referenced by bpp::BasicProbabilisticSequence::getTable().

◆ getValue()

const std::vector<double>& bpp::BasicProbabilisticSymbolList::getValue ( size_t  pos) const
inlinevirtual

checked access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< std::vector< double > >.

Definition at line 224 of file ProbabilisticSymbolList.h.

References getElement().

◆ operator()()

double bpp::BasicProbabilisticSymbolList::operator() ( size_t  siteIndex,
int  state 
) const
inlinevirtual

◆ operator=() [1/2]

BasicProbabilisticSymbolList & BasicProbabilisticSymbolList::operator= ( const BasicProbabilisticSymbolList list)

The assignement operator.

Definition at line 96 of file ProbabilisticSymbolList.cpp.

References alphabet_, and content_.

◆ operator=() [2/2]

BasicProbabilisticSymbolList & BasicProbabilisticSymbolList::operator= ( const ProbabilisticSymbolList list)

◆ operator[]() [1/2]

std::vector<double>& bpp::BasicProbabilisticSymbolList::operator[] ( size_t  pos)
inlinevirtual

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< std::vector< double > >.

Definition at line 234 of file ProbabilisticSymbolList.h.

References content_, and bpp::Table< class >::getColumn().

◆ operator[]() [2/2]

const std::vector<double>& bpp::BasicProbabilisticSymbolList::operator[] ( size_t  pos) const
inlinevirtual

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< std::vector< double > >.

Definition at line 229 of file ProbabilisticSymbolList.h.

References content_, and bpp::Table< class >::getColumn().

◆ setContent() [1/2]

◆ setContent() [2/2]

void BasicProbabilisticSymbolList::setContent ( const std::vector< std::vector< double > > &  list)
virtual

Set the whole content of the list.

Parameters
listThe new content of the list.
See also
The list constructor for information about the way lists are internaly stored.

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().

◆ setElement()

void BasicProbabilisticSymbolList::setElement ( size_t  pos,
const std::vector< double > &  c 
)
virtual

Set the element at position 'pos' to character 'c'.

Parameters
posThe position of the character to set.
cThe 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().

◆ shuffle()

void bpp::BasicProbabilisticSymbolList::shuffle ( )
inlinevirtual

Randomly shuffle the content of the list, with linear complexity.

Implements bpp::CruxSymbolList.

Definition at line 251 of file ProbabilisticSymbolList.h.

◆ size()

size_t bpp::BasicProbabilisticSymbolList::size ( ) const
inlinevirtual

Get the number of elements in the list.

Returns
The number of sites 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().

◆ toString()

string BasicProbabilisticSymbolList::toString ( ) const
virtual

Convert the list as a string.

This method is useful for dumping a list to a file or to the screen for display.

Returns
The whole list as a string.

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().

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::BasicProbabilisticSymbolList::alphabet_
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().

◆ content_


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