bpp-seq3  3.0.0
bpp::VectorProbabilisticSequenceContainer Class Referenceabstract

The VectorProbabilisticSequenceContainer class. More...

#include <Bpp/Seq/Container/VectorProbabilisticSequenceContainer.h>

+ Inheritance diagram for bpp::VectorProbabilisticSequenceContainer:
+ Collaboration diagram for bpp::VectorProbabilisticSequenceContainer:

Public Member Functions

 VectorProbabilisticSequenceContainer (const std::vector< std::shared_ptr< ProbabilisticSequence >> &vs, const Alphabet *alpha)
 Build a container with shared Sequences. More...
 
 VectorProbabilisticSequenceContainer (const Alphabet *alpha)
 Build an empty container that will contain sequences of a particular alphabet. More...
 
VectorProbabilisticSequenceContaineroperator= (const VectorProbabilisticSequenceContainer &vsc)
 Assign from a VectorProbabilisticSequenceContainer. More...
 
void clear ()
 Delete all objects in the container. More...
 
std::string toString (const std::string &name) const
 Convert a particular sequence to a string. More...
 
std::string toString (size_t sequenceIndex) const
 
const CommentsgetComments (const std::string &name) const
 Get comments of a particular sequence. More...
 
virtual const CommentsgetComments (size_t sequenceIndex) const
 
void setComments (const std::string &name, const Comments &comments)
 Set the comments of a particular sequence. More...
 
const std::string & getName (size_t sequenceIndex) const
 Get the name of a particular row of the alignement (aka sequence). More...
 
size_t getSequencePosition (const std::string &name) const
 Get the position of a sequence in sequence container from its name. More...
 
const ProbabilisticSequencegetSequence (size_t sequenceIndex) const
 
void setSequence (size_t sequenceIndex, const ProbabilisticSequence &sequence, bool checkName=true)
 
std::shared_ptr< ProbabilisticSequenceremoveSequence (size_t sequenceIndex)
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
virtual void setComments (const std::string &name, const Comments &comments)=0
 Set the comments of a particular sequence. More...
 
void setComments (const Comments &comments)
 Set the comments. More...
 
virtual const CommentsgetComments (const std::string &name) const=0
 Get comments of a particular sequence. More...
 
const CommentsgetComments () const
 Get the comments. More...
 
virtual std::string toString (const std::string &name) const=0
 Convert a particular sequence to a string. More...
 
virtual double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const=0
 get value of a state in a position More...
 
void clearComments ()
 
size_t getSize () const
 Get the number of objects in the container. More...
 
void setSize (size_t size)
 
void changeName (const std::string &okey, const std::string &nkey)
 change the key of an object. More...
 
bool isAvailableName (std::string objectName) const
 Return if the name is in the map keys and the mapped object is nullptr or empty. More...
 
bool isAvailablePosition (size_t objectIndex) const
 
void nullify ()
 Nullify all elements. More...
 
Copy contructors:
 VectorProbabilisticSequenceContainer (const VectorProbabilisticSequenceContainer &vsc)
 Copy from a VectorProbabilisticSequenceContainer. More...
 
The Clonable interface.
VectorProbabilisticSequenceContainerclone () const
 
The SequenceContainer interface.
bool hasSequence (const std::string &name) const
 Check if a sequence with a given name is present in the container. More...
 
const ProbabilisticSequencegetSequence (const std::string &name) const
 
void setSequence (const std::string &name, const ProbabilisticSequence &sequence, bool checkName=true)
 
std::shared_ptr< ProbabilisticSequenceremoveSequence (const std::string &name)
 
size_t getNumberOfSequences () const
 Get the number of sequences in the container. More...
 
std::vector< std::string > getSequenceNames () const
 Get all the names of the sequences in the container. More...
 
void setSequenceNames (const std::vector< std::string > &names, bool checkNames=true)
 Set all sequence names. More...
 
VectorProbabilisticSequenceContainercreateEmptyContainer () const
 Return a copy of this container, but with no data inside. More...
 
Add sequence to this container.
virtual void addSequence (const ProbabilisticSequence &sequence, bool checkName=true)
 Add a sequence at the end of the container. More...
 
virtual void addSequence (const std::shared_ptr< ProbabilisticSequence > sequence, bool checkName=true)
 Add a sequence at the end of the container. More...
 
virtual void addSequence (const ProbabilisticSequence &sequence, size_t sequenceIndex, bool checkName=true)
 Add a sequence to the container at a particular position. More...
 
From the SequencedValuesContainer interface
const AlphabetgetAlphabet () const
 Get container's alphabet. More...
 
const CommentsgetGeneralComments () const
 Get the comments of this container. More...
 
void setGeneralComments (const Comments &comments)
 Set the comments of this container. More...
 
void deleteGeneralComments ()
 Delete the comments associated to this container. More...
 

Protected Member Functions

size_t getNumberOfObjects () const
 
size_t getObjectPosition (const std::string &name) const
 Link between position & name. More...
 
std::string getObjectName (size_t objectIndex) const
 
const std::shared_ptr< ProbabilisticSequencegetObject (size_t objectIndex) const
 Retrieve an object from the container. Set as protected since they will be public under T specific names. More...
 
std::shared_ptr< ProbabilisticSequencegetObject (size_t objectIndex)
 
const std::shared_ptr< ProbabilisticSequencegetObject (const std::string &name) const
 Get a object. More...
 
std::shared_ptr< ProbabilisticSequencegetObject (const std::string &name)
 
bool hasObject (const std::string &name) const
 Check if a object with a given name is present in the container. More...
 
std::vector< std::string > getObjectNames () const
 
void setObjectNames (const std::vector< std::string > &names)
 
void setObjectName (size_t pos, const std::string &name)
 
void addObject (std::shared_ptr< ProbabilisticSequence > object, size_t objectIndex, const std::string &name, bool check=false)
 
virtual void addObject (std::shared_ptr< T > object, size_t objectIndex, const std::string &name, bool check=false)=0
 
void addObject (std::shared_ptr< T > object, const std::string &name, bool checkName=false)
 Set a object. More...
 
void addObject (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false)
 Add an object. More...
 
void insertObject (std::shared_ptr< ProbabilisticSequence > object, size_t objectIndex, const std::string &name)
 
virtual void insertObject (std::shared_ptr< T > object, size_t objectIndex, const std::string &name)=0
 
void insertObject (std::shared_ptr< T > object, size_t objectIndex)
 Insert an object. More...
 
void appendObject (std::shared_ptr< ProbabilisticSequence > object, const std::string &name, bool check=true)
 
void appendObject (std::shared_ptr< T > object)
 
std::shared_ptr< ProbabilisticSequenceremoveObject (size_t objectIndex)
 Extract and remove a object from the container. More...
 
std::shared_ptr< ProbabilisticSequenceremoveObject (const std::string &name)
 Remove and returns a object. More...
 
void deleteObject (size_t objectIndex)
 Delete an object from the container. More...
 
void deleteObject (const std::string &name)
 Remove a object. More...
 
void addObject_ (std::shared_ptr< ProbabilisticSequence > object, size_t objectIndex, const std::string &name, bool check=false) const
 
void addObject_ (std::shared_ptr< T > object, const std::string &name, bool checkName=false) const
 
void addObject_ (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false) const
 
void deleteObjects (size_t objectIndex, size_t length)
 
std::shared_ptr< T > getObject_ (size_t objectIndex) const
 
AbstractSequenceContainer methods.
ProbabilisticSequencegetSequence_ (size_t i)
 
ProbabilisticSequencegetSequence_ (const std::string &name)
 
double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const
 get value of a state in a position More...
 
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
double getStateValueAt (size_t siteIndex, size_t sequenceIndex, int state) const
 
double operator() (size_t siteIndex, size_t sequenceIndex, int state) const
 

Protected Attributes

const Alphabetalphabet_
 The container's alphabet. More...
 
Comments comments_
 
std::vector< std::shared_ptr< T > > positions_
 

Private Member Functions

virtual void setSize (size_t size)
 

Private Attributes

std::vector< std::string > vNames_
 
std::map< std::string, size_t > mNames_
 
std::map< std::string, std::shared_ptr< T > > mObjects_
 

Detailed Description

The VectorProbabilisticSequenceContainer class.

This is the simplest implementation of the OrderedValuesContainer interface for ProbabilisticSequences ProbabilisticSequences are stored in a std::vector of shared pointers.

Definition at line 63 of file VectorProbabilisticSequenceContainer.h.

Constructor & Destructor Documentation

◆ VectorProbabilisticSequenceContainer() [1/3]

VectorProbabilisticSequenceContainer::VectorProbabilisticSequenceContainer ( const std::vector< std::shared_ptr< ProbabilisticSequence >> &  vs,
const Alphabet alpha 
)

Build a container with shared Sequences.

Class constructors:

Definition at line 51 of file VectorProbabilisticSequenceContainer.cpp.

References addSequence().

Referenced by clone(), and createEmptyContainer().

◆ VectorProbabilisticSequenceContainer() [2/3]

bpp::VectorProbabilisticSequenceContainer::VectorProbabilisticSequenceContainer ( const Alphabet alpha)
inline

Build an empty container that will contain sequences of a particular alphabet.

Parameters
alphaThe alphabet of the container.

Definition at line 82 of file VectorProbabilisticSequenceContainer.h.

◆ VectorProbabilisticSequenceContainer() [3/3]

VectorProbabilisticSequenceContainer::VectorProbabilisticSequenceContainer ( const VectorProbabilisticSequenceContainer vsc)

Copy from a VectorProbabilisticSequenceContainer.

Parameters
vscThe VectorProbabilisticSequenceContainer to copy into this container.

Copy constructors:

Definition at line 63 of file VectorProbabilisticSequenceContainer.cpp.

References addSequence(), getNumberOfSequences(), and getSequence().

Member Function Documentation

◆ addObject() [1/4]

void bpp::VectorMappedContainer< ProbabilisticSequence >::addObject ( std::shared_ptr< ProbabilisticSequence object,
size_t  objectIndex,
const std::string &  name,
bool  check = false 
)
inlineprotectedinherited

Definition at line 226 of file VectorMappedContainer.h.

◆ addObject() [2/4]

template<class T >
void bpp::MappedNamedContainer< T >::addObject ( std::shared_ptr< T >  object,
const std::string &  name,
bool  checkName = false 
)
inlineprotectedinherited

Set a object.

Parameters
nameThe key of the object.
objectThe new object that will be associated to the key.
checkNameTell is the object name must be checked.

Definition at line 140 of file MappedNamedContainer.h.

References bpp::MappedNamedContainer< T >::hasObject(), and bpp::MappedNamedContainer< T >::mObjects_.

Referenced by bpp::VectorMappedContainer< T >::addObject(), bpp::VectorMappedContainer< T >::appendObject(), and bpp::VectorMappedContainer< T >::insertObject().

◆ addObject() [3/4]

template<class T >
void bpp::VectorPositionedContainer< T >::addObject ( std::shared_ptr< T >  object,
size_t  objectIndex,
bool  checkPosition = false 
)
inlineprotectedinherited

Add an object.

Parameters
objectThe object to add.
objectIndexThe new position of the object
checkPositionLook if the position is empty.

Definition at line 192 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

Referenced by bpp::VectorMappedContainer< T >::addObject(), bpp::AlignedSequenceContainer::getSite(), bpp::CompressedVectorSiteContainer::setSite(), and bpp::VectorSiteContainer::setSite().

◆ addObject() [4/4]

template<class T >
virtual void bpp::PositionedNamedContainer< T >::addObject ( std::shared_ptr< T >  object,
size_t  objectIndex,
const std::string &  name,
bool  check = false 
)
protectedpure virtualinherited

◆ addObject_() [1/3]

void bpp::VectorMappedContainer< ProbabilisticSequence >::addObject_ ( std::shared_ptr< ProbabilisticSequence object,
size_t  objectIndex,
const std::string &  name,
bool  check = false 
) const
inlineprotectedinherited

Definition at line 298 of file VectorMappedContainer.h.

◆ addObject_() [2/3]

template<class T >
void bpp::MappedNamedContainer< T >::addObject_ ( std::shared_ptr< T >  object,
const std::string &  name,
bool  checkName = false 
) const
inlineprotectedinherited

◆ addObject_() [3/3]

template<class T >
void bpp::VectorPositionedContainer< T >::addObject_ ( std::shared_ptr< T >  object,
size_t  objectIndex,
bool  checkPosition = false 
) const
inlineprotectedinherited

◆ addSequence() [1/3]

virtual void bpp::VectorProbabilisticSequenceContainer::addSequence ( const ProbabilisticSequence sequence,
bool  checkName = true 
)
inlinevirtual

Add a sequence at the end of the container.

The sequence is copied into the container. If checkNames is set to true, the method check if the name of the sequence is already used in the container, and sends an exception if it is the case. Otherwise, do not check the name: the method is hence faster, but use it at your own risks!

Parameters
sequenceThe sequence to add.
checkNameTell if the method must check the name of the sequence before adding it.

Definition at line 244 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::appendObject(), bpp::ProbabilisticSequence::clone(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), and bpp::CoreSequence::getName().

Referenced by VectorProbabilisticSequenceContainer().

◆ addSequence() [2/3]

virtual void bpp::VectorProbabilisticSequenceContainer::addSequence ( const ProbabilisticSequence sequence,
size_t  sequenceIndex,
bool  checkName = true 
)
inlinevirtual

Add a sequence to the container at a particular position.

The sequence is copied into the container. If checkName is set to true, the method check if the name of the sequence is already used in the container, and sends an exception if it is the case. Otherwise, do not check the name: the method is hence faster, but use it at your own risks!

Parameters
sequenceThe sequence to add.
sequenceIndexThe position where to insert the new sequence. All the following sequences will be pushed.
checkNameTell if the method must check the name of the sequence before adding it.
Exceptions
ExceptionIf the sequence couldn't be added to the container.

Definition at line 291 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::addObject(), bpp::ProbabilisticSequence::clone(), and bpp::CoreSequence::getName().

◆ addSequence() [3/3]

virtual void bpp::VectorProbabilisticSequenceContainer::addSequence ( const std::shared_ptr< ProbabilisticSequence sequence,
bool  checkName = true 
)
inlinevirtual

Add a sequence at the end of the container.

The sequence is shared with the container. If checkNames is set to true, the method check if the name of the sequence is already used in the container, and sends an exception if it is the case. Otherwise, do not check the name: the method is hence faster, but use it at your own risks!

Parameters
sequenceThe sequence to add.
checkNameTell if the method must check the name of the sequence before adding it.
Exceptions
ExceptionIf the sequence couldn't be added to the container.

Definition at line 267 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::appendObject(), and bpp::AbstractValuesContainer::getAlphabet().

◆ appendObject() [1/2]

void bpp::VectorMappedContainer< ProbabilisticSequence >::appendObject ( std::shared_ptr< ProbabilisticSequence object,
const std::string &  name,
bool  check = true 
)
inlineprotectedinherited

Definition at line 250 of file VectorMappedContainer.h.

◆ appendObject() [2/2]

◆ changeName()

template<class T >
void bpp::MappedNamedContainer< T >::changeName ( const std::string &  okey,
const std::string &  nkey 
)
inlineinherited

◆ clear()

void bpp::VectorProbabilisticSequenceContainer::clear ( )
inlinevirtual

Delete all objects in the container.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 107 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< T >::clear().

Referenced by operator=().

◆ clearComments()

◆ clone()

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

◆ createEmptyContainer()

VectorProbabilisticSequenceContainer * VectorProbabilisticSequenceContainer::createEmptyContainer ( ) const
virtual

Return a copy of this container, but with no data inside.

This method creates a new SequencedValuesContainer objet. The class of this container depends on the derivative class.

Returns
A new empty container, with the same alphabet as this one.

Implements bpp::SequencedValuesContainer.

Definition at line 116 of file VectorProbabilisticSequenceContainer.cpp.

References bpp::AbstractValuesContainer::getAlphabet(), bpp::AbstractValuesContainer::getGeneralComments(), bpp::AbstractValuesContainer::setGeneralComments(), and VectorProbabilisticSequenceContainer().

◆ deleteGeneralComments()

void bpp::AbstractValuesContainer::deleteGeneralComments ( )
inlinevirtualinherited

Delete the comments associated to this container.

Implements bpp::SequencedValuesContainer.

Definition at line 115 of file AbstractValuesContainer.h.

References bpp::Commentable::clearComments().

◆ deleteObject() [1/2]

void bpp::VectorMappedContainer< ProbabilisticSequence >::deleteObject ( const std::string &  name)
inlineprotectedvirtualinherited

Remove a object.

Parameters
nameThe key of the object.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 293 of file VectorMappedContainer.h.

◆ deleteObject() [2/2]

void bpp::VectorMappedContainer< ProbabilisticSequence >::deleteObject ( size_t  objectIndex)
inlineprotectedvirtualinherited

Delete an object from the container.

Parameters
objectIndexThe index of the object in the container.

Reimplemented from bpp::VectorPositionedContainer< T >.

Definition at line 273 of file VectorMappedContainer.h.

◆ deleteObjects()

◆ getAlphabet()

const Alphabet* bpp::AbstractValuesContainer::getAlphabet ( ) const
inlinevirtualinherited

Get container's alphabet.

Returns
The alphabet associated to this container.

Implements bpp::SequencedValuesContainer.

Definition at line 99 of file AbstractValuesContainer.h.

References bpp::AbstractValuesContainer::alphabet_.

Referenced by addSequence(), bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::VectorSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), bpp::CompressedVectorSiteContainer::addSite(), bpp::AlignedSequenceContainer::addSite(), bpp::VectorSiteContainer::addSite(), bpp::VectorProbabilisticSiteContainer::addSite(), bpp::Pasta::appendSequencesFromStream(), bpp::AlignedSequenceContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::createEmptyContainer(), createEmptyContainer(), bpp::VectorProbabilisticSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::getSequence(), bpp::VectorSiteContainer::getSequence(), bpp::VectorProbabilisticSiteContainer::getSequence(), bpp::AlignedSequenceContainer::getSite(), bpp::CompressedVectorSiteContainer::getStateValueAt(), bpp::VectorProbabilisticSiteContainer::getStateValueAt(), bpp::VectorSiteContainer::getStateValueAt(), getStateValueAt(), bpp::VectorSequenceContainer::getStateValueAt(), bpp::CompressedVectorSiteContainer::operator()(), bpp::VectorProbabilisticSiteContainer::operator()(), bpp::VectorSiteContainer::operator()(), operator()(), bpp::VectorSequenceContainer::operator()(), bpp::VectorProbabilisticSiteContainer::realloc(), bpp::VectorSiteContainer::realloc(), bpp::CompressedVectorSiteContainer::removeSite(), bpp::CompressedVectorSiteContainer::setComments(), bpp::VectorProbabilisticSiteContainer::setSequence(), setSequence(), bpp::VectorSiteContainer::setSequence(), bpp::VectorSequenceContainer::setSequence(), bpp::AlignedSequenceContainer::setSite(), bpp::CompressedVectorSiteContainer::setSite(), and bpp::VectorSiteContainer::setSite().

◆ getComments() [1/4]

◆ getComments() [2/4]

const Comments& bpp::VectorProbabilisticSequenceContainer::getComments ( const std::string &  name) const
inlinevirtual

Get comments of a particular sequence.

Parameters
nameThe name of the sequence.
Returns
The comments associated to sequence with name 'name'.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::SequencedValuesContainer.

Definition at line 124 of file VectorProbabilisticSequenceContainer.h.

References bpp::CoreSequence::getComments(), and getSequence().

◆ getComments() [3/4]

virtual const Comments& bpp::SequencedValuesContainer::getComments
inherited

Get comments of a particular sequence.

Parameters
sequenceIndexThe position of the sequence.
Returns
The comments associated to sequence at position 'sequenceIndex'.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

◆ getComments() [4/4]

virtual const Comments& bpp::VectorProbabilisticSequenceContainer::getComments ( size_t  sequenceIndex) const
inlinevirtual

◆ getGeneralComments()

const Comments& bpp::AbstractValuesContainer::getGeneralComments ( ) const
inlinevirtualinherited

◆ getName()

const std::string& bpp::VectorProbabilisticSequenceContainer::getName ( size_t  sequenceIndex) const
inlinevirtual

Get the name of a particular row of the alignement (aka sequence).

Parameters
sequenceIndexThe position of the sequence.
Returns
The name of the sequence at position 'sequenceIndex'.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

Implements bpp::OrderedValuesContainer.

Definition at line 140 of file VectorProbabilisticSequenceContainer.h.

References bpp::CoreSequence::getName(), and getSequence().

◆ getNumberOfObjects()

size_t bpp::VectorMappedContainer< ProbabilisticSequence >::getNumberOfObjects ( ) const
inlineprotectedinherited

Definition at line 144 of file VectorMappedContainer.h.

◆ getNumberOfSequences()

size_t bpp::VectorProbabilisticSequenceContainer::getNumberOfSequences ( ) const
inlinevirtual

Get the number of sequences in the container.

Returns
The number of sequences in the container.

Implements bpp::SequencedValuesContainer.

Definition at line 187 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::getSize().

Referenced by getStateValueAt(), setSequenceNames(), and VectorProbabilisticSequenceContainer().

◆ getObject() [1/4]

std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::getObject ( const std::string &  name)
inlineprotectedvirtualinherited

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 188 of file VectorMappedContainer.h.

◆ getObject() [2/4]

const std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::getObject ( const std::string &  name) const
inlineprotectedvirtualinherited

Get a object.

Parameters
nameThe key of the object to retrieve.
Returns
The object associated to the given key.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 183 of file VectorMappedContainer.h.

◆ getObject() [3/4]

std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::getObject ( size_t  objectIndex)
inlineprotectedvirtualinherited

Reimplemented from bpp::VectorPositionedContainer< T >.

Definition at line 172 of file VectorMappedContainer.h.

◆ getObject() [4/4]

const std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::getObject ( size_t  objectIndex) const
inlineprotectedvirtualinherited

Retrieve an object from the container. Set as protected since they will be public under T specific names.

Parameters
objectIndexThe position of the object.
Returns
A reference toward the Object object with corresponding name.

Reimplemented from bpp::VectorPositionedContainer< T >.

Definition at line 167 of file VectorMappedContainer.h.

◆ getObject_()

template<class T >
std::shared_ptr<T> bpp::VectorPositionedContainer< T >::getObject_ ( size_t  objectIndex) const
inlineprotectedinherited

◆ getObjectName()

std::string bpp::VectorMappedContainer< ProbabilisticSequence >::getObjectName ( size_t  objectIndex) const
inlineprotectedvirtualinherited

Implements bpp::PositionedNamedContainer< T >.

Definition at line 158 of file VectorMappedContainer.h.

◆ getObjectNames()

std::vector<std::string> bpp::VectorMappedContainer< ProbabilisticSequence >::getObjectNames ( ) const
inlineprotectedvirtualinherited
Returns
All objects keys.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 198 of file VectorMappedContainer.h.

◆ getObjectPosition()

size_t bpp::VectorMappedContainer< ProbabilisticSequence >::getObjectPosition ( const std::string &  name) const
inlineprotectedvirtualinherited

Link between position & name.

Implements bpp::PositionedNamedContainer< T >.

Definition at line 149 of file VectorMappedContainer.h.

◆ getSequence() [1/2]

const ProbabilisticSequence& bpp::VectorProbabilisticSequenceContainer::getSequence ( const std::string &  name) const
inline

◆ getSequence() [2/2]

const ProbabilisticSequence& bpp::VectorProbabilisticSequenceContainer::getSequence ( size_t  sequenceIndex) const
inline

◆ getSequence_() [1/2]

ProbabilisticSequence& bpp::VectorProbabilisticSequenceContainer::getSequence_ ( const std::string &  name)
inlineprotected

◆ getSequence_() [2/2]

ProbabilisticSequence& bpp::VectorProbabilisticSequenceContainer::getSequence_ ( size_t  i)
inlineprotected

◆ getSequenceNames()

std::vector<std::string> bpp::VectorProbabilisticSequenceContainer::getSequenceNames ( ) const
inlinevirtual

Get all the names of the sequences in the container.

Returns
A vector of strings with all sequence names.

Implements bpp::SequencedValuesContainer.

Definition at line 189 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::getObjectNames().

◆ getSequencePosition()

size_t bpp::VectorProbabilisticSequenceContainer::getSequencePosition ( const std::string &  name) const
inlinevirtual

Get the position of a sequence in sequence container from its name.

Parameters
nameThe name of the sequence.
Returns
The position of the sequence with name 'name', if it exists.
Exceptions
SequenceNotFoundExceptionIf no sequence with name 'name' could be found.

Implements bpp::OrderedValuesContainer.

Definition at line 145 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::getObjectPosition().

Referenced by removeSequence(), setComments(), and setSequence().

◆ getSize()

size_t bpp::VectorMappedContainer< ProbabilisticSequence >::getSize ( ) const
inlinevirtualinherited

Get the number of objects in the container.

Returns
The number of objects in the container.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 133 of file VectorMappedContainer.h.

◆ getStateValueAt() [1/3]

double bpp::VectorProbabilisticSequenceContainer::getStateValueAt ( size_t  siteIndex,
const std::string &  sequenceName,
int  state 
) const
inlineprotectedvirtual

get value of a state in a position

Parameters
siteIndexindex of the site
sequenceNamename of the sequence in the container
statestate in the alphabet

Implements bpp::SequencedValuesContainer.

Definition at line 313 of file VectorProbabilisticSequenceContainer.h.

References getSequence(), and bpp::CruxSymbolList::getStateValueAt().

◆ getStateValueAt() [2/3]

virtual double bpp::SequencedValuesContainer::getStateValueAt
inherited

get value of a state in a position

Parameters
siteIndexindex of the site
sequenceNamename of the sequence in the container
statestate in the alphabet

◆ getStateValueAt() [3/3]

double bpp::VectorProbabilisticSequenceContainer::getStateValueAt ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlineprotectedvirtual

◆ hasObject()

bool bpp::VectorMappedContainer< ProbabilisticSequence >::hasObject ( const std::string &  name) const
inlineprotectedvirtualinherited

Check if a object with a given name is present in the container.

Parameters
nameThe name of the object.
Returns
True if a object with the given name is present in the container.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 193 of file VectorMappedContainer.h.

◆ hasSequence()

bool bpp::VectorProbabilisticSequenceContainer::hasSequence ( const std::string &  name) const
inlinevirtual

Check if a sequence with a given name is present in the container.

Parameters
nameThe name of the sequence.
Returns
True if a sequence with the given name is present in the container.

Implements bpp::SequencedValuesContainer.

Definition at line 167 of file VectorProbabilisticSequenceContainer.h.

References bpp::VectorMappedContainer< ProbabilisticSequence >::hasObject().

◆ insertObject() [1/3]

void bpp::VectorMappedContainer< ProbabilisticSequence >::insertObject ( std::shared_ptr< ProbabilisticSequence object,
size_t  objectIndex,
const std::string &  name 
)
inlineprotectedinherited

Definition at line 235 of file VectorMappedContainer.h.

◆ insertObject() [2/3]

template<class T >
void bpp::VectorPositionedContainer< T >::insertObject ( std::shared_ptr< T >  object,
size_t  objectIndex 
)
inlineprotectedinherited

Insert an object.

Parameters
objectThe object to add.
objectIndexThe new position of the object

Definition at line 209 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

Referenced by bpp::AlignedSequenceContainer::addSite(), bpp::VectorSiteContainer::addSite(), and bpp::VectorMappedContainer< T >::insertObject().

◆ insertObject() [3/3]

template<class T >
virtual void bpp::PositionedNamedContainer< T >::insertObject ( std::shared_ptr< T >  object,
size_t  objectIndex,
const std::string &  name 
)
protectedpure virtualinherited

◆ isAvailableName()

template<class T >
bool bpp::MappedNamedContainer< T >::isAvailableName ( std::string  objectName) const
inlineinherited

◆ isAvailablePosition()

template<class T >
bool bpp::VectorPositionedContainer< T >::isAvailablePosition ( size_t  objectIndex) const
inlineinherited

◆ nullify()

◆ operator()() [1/2]

double bpp::VectorProbabilisticSequenceContainer::operator() ( size_t  siteIndex,
const std::string &  sequenceName,
int  state 
) const
inlineprotectedvirtual

Implements bpp::SequencedValuesContainer.

Definition at line 318 of file VectorProbabilisticSequenceContainer.h.

References getSequence().

◆ operator()() [2/2]

double bpp::VectorProbabilisticSequenceContainer::operator() ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlineprotectedvirtual

◆ operator=()

VectorProbabilisticSequenceContainer & VectorProbabilisticSequenceContainer::operator= ( const VectorProbabilisticSequenceContainer vsc)

Assign from a VectorProbabilisticSequenceContainer.

Parameters
vscThe VectorProbabilisticSequenceContainer to copy into this container.

Assignation operator:

Definition at line 76 of file VectorProbabilisticSequenceContainer.cpp.

References clear(), bpp::AbstractValuesContainer::operator=(), and bpp::VectorMappedContainer< T >::operator=().

◆ removeObject() [1/2]

std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::removeObject ( const std::string &  name)
inlineprotectedvirtualinherited

Remove and returns a object.

Parameters
nameThe key of the object.
Returns
The object previously associated to the given key.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 288 of file VectorMappedContainer.h.

◆ removeObject() [2/2]

std::shared_ptr<ProbabilisticSequence > bpp::VectorMappedContainer< ProbabilisticSequence >::removeObject ( size_t  objectIndex)
inlineprotectedvirtualinherited

Extract and remove a object from the container.

Parameters
objectIndexThe position of the object.
Returns
A smart pointer toward the removed object.

Reimplemented from bpp::VectorPositionedContainer< T >.

Definition at line 259 of file VectorMappedContainer.h.

◆ removeSequence() [1/2]

std::shared_ptr<ProbabilisticSequence> bpp::VectorProbabilisticSequenceContainer::removeSequence ( const std::string &  name)
inline

Definition at line 182 of file VectorProbabilisticSequenceContainer.h.

References getSequencePosition().

◆ removeSequence() [2/2]

std::shared_ptr<ProbabilisticSequence> bpp::VectorProbabilisticSequenceContainer::removeSequence ( size_t  sequenceIndex)
inline

◆ setComments() [1/4]

◆ setComments() [2/4]

void bpp::VectorProbabilisticSequenceContainer::setComments ( const std::string &  name,
const Comments comments 
)
inlinevirtual

Set the comments of a particular sequence.

Parameters
nameThe name of the sequence.
commentsThe comments to set to sequence with name 'name'.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Reimplemented from bpp::AbstractValuesContainer.

Definition at line 134 of file VectorProbabilisticSequenceContainer.h.

References getSequencePosition(), and bpp::OrderedValuesContainer::setComments().

◆ setComments() [3/4]

virtual void bpp::SequencedValuesContainer::setComments
inherited

Set the comments of a particular sequence.

Parameters
sequenceIndexThe position of the sequence.
commentsThe comments to set to sequence with position 'i'.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

Referenced by bpp::AbstractProbabilisticSequenceContainer::setComments(), bpp::AbstractValuesContainer::setComments(), and setComments().

◆ setComments() [4/4]

void bpp::VectorProbabilisticSequenceContainer::setComments ( size_t  sequenceIndex,
const Comments comments 
)
inlinevirtual

◆ setGeneralComments()

◆ setObjectName()

void bpp::VectorMappedContainer< ProbabilisticSequence >::setObjectName ( size_t  pos,
const std::string &  name 
)
inlineprotectedinherited

Definition at line 219 of file VectorMappedContainer.h.

◆ setObjectNames()

void bpp::VectorMappedContainer< ProbabilisticSequence >::setObjectNames ( const std::vector< std::string > &  names)
inlineprotectedinherited

Definition at line 203 of file VectorMappedContainer.h.

◆ setSequence() [1/2]

void bpp::VectorProbabilisticSequenceContainer::setSequence ( const std::string &  name,
const ProbabilisticSequence sequence,
bool  checkName = true 
)
inline

Definition at line 177 of file VectorProbabilisticSequenceContainer.h.

References getSequencePosition().

◆ setSequence() [2/2]

void bpp::VectorProbabilisticSequenceContainer::setSequence ( size_t  sequenceIndex,
const ProbabilisticSequence sequence,
bool  checkName = true 
)
inline

◆ setSequenceNames()

void VectorProbabilisticSequenceContainer::setSequenceNames ( const std::vector< std::string > &  names,
bool  checkNames = true 
)
virtual

Set all sequence names.

Parameters
namesA vector of strings with all sequence names. Its size must be strictly equal to the the size of the container (the number of sequences).
checkNamesTell if the container must check if the name of the sequence is already used in the container before adding it.
Exceptions
ExceptionIf there are redundant names in the input vector.

Implements bpp::SequencedValuesContainer.

Definition at line 88 of file VectorProbabilisticSequenceContainer.cpp.

References getNumberOfSequences(), getSequence_(), bpp::CoreSequence::setName(), and bpp::VectorMappedContainer< ProbabilisticSequence >::setObjectNames().

◆ setSize() [1/2]

template<class T >
virtual void bpp::PositionedContainer< T >::setSize ( size_t  size)
inlinevirtualinherited

◆ setSize() [2/2]

◆ toString() [1/3]

std::string bpp::VectorProbabilisticSequenceContainer::toString ( const std::string &  name) const
inlinevirtual

Convert a particular sequence to a string.

Parameters
nameThe name of the sequence.
Returns
A string describing the content of the sequence.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::SequencedValuesContainer.

Definition at line 114 of file VectorProbabilisticSequenceContainer.h.

References getSequence(), and bpp::CruxSymbolList::toString().

◆ toString() [2/3]

virtual std::string bpp::SequencedValuesContainer::toString
inherited

Convert a particular sequence to a string.

Parameters
sequenceIndexThe position of the sequence.
Returns
A string describing the content of the sequence.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

◆ toString() [3/3]

std::string bpp::VectorProbabilisticSequenceContainer::toString ( size_t  sequenceIndex) const
inlinevirtual

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::AbstractValuesContainer::alphabet_
protectedinherited

◆ comments_

Comments bpp::Commentable::comments_
protectedinherited

◆ mNames_

std::map<std::string, size_t> bpp::VectorMappedContainer< ProbabilisticSequence >::mNames_
privateinherited

Definition at line 86 of file VectorMappedContainer.h.

◆ mObjects_

◆ positions_

◆ vNames_

std::vector<std::string> bpp::VectorMappedContainer< ProbabilisticSequence >::vNames_
privateinherited

Definition at line 79 of file VectorMappedContainer.h.


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