bpp-seq3  3.0.0
bpp::AlignedSequenceContainer Class Referenceabstract

Aligned sequences container. More...

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

+ Inheritance diagram for bpp::AlignedSequenceContainer:
+ Collaboration diagram for bpp::AlignedSequenceContainer:

Public Member Functions

 AlignedSequenceContainer (std::vector< std::shared_ptr< Sequence >> vseq, const Alphabet *alpha)
 Build a container with the specified alphabet, with shared Sequences. More...
 
 AlignedSequenceContainer (const Alphabet *alpha)
 Build a new empty container with the specified alphabet. More...
 
 AlignedSequenceContainer (const AlignedSequenceContainer &asc)
 Copy constructor. More...
 
 AlignedSequenceContainer (const SiteContainer &sc)
 Convert any SiteContainer object into a AlignedSequenceContainer object. More...
 
 AlignedSequenceContainer (const OrderedSequenceContainer &osc)
 Try to coerce an OrderedSequenceContainer object into an AlignedSequenceContainer object. More...
 
AlignedSequenceContaineroperator= (const AlignedSequenceContainer &asc)
 
AlignedSequenceContaineroperator= (const SiteContainer &sc)
 
AlignedSequenceContaineroperator= (const OrderedSequenceContainer &osc)
 
virtual ~AlignedSequenceContainer ()
 
void setComments (const std::string &name, const Comments &comments)
 Set the comments of a particular sequence. More...
 
void setComments (const Comments &comments)
 Set the comments. More...
 
virtual double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const=0
 get value of a state in a position More...
 
std::string toString (const std::string &name) const
 Convert a particular sequence to a string. More...
 
const CommentsgetComments (const std::string &name) const
 Get comments of a particular sequence. More...
 
const CommentsgetComments () const
 Get the comments. More...
 
virtual const AlphabetgetAlphabet () const =0
 Get container's alphabet. More...
 
virtual const CommentsgetGeneralComments () const =0
 Get the comments of this container. More...
 
virtual void setGeneralComments (const Comments &comments)=0
 Set the comments of this container. More...
 
virtual void deleteGeneralComments ()=0
 Delete the comments associated to this container. 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...
 
size_t getSize () const
 the size More...
 
bool isAvailablePosition (size_t objectIndex) const
 
void setSize (size_t size)
 
void nullify ()
 Nullify all elements. More...
 
The Clonable interface.
AlignedSequenceContainerclone () const
 
The SiteContainer interface implementation:
virtual const SitegetSite (size_t siteIndex) const
 Get a site from the container. More...
 
virtual SitegetSite (size_t siteIndex)
 
const CruxSymbolListSitegetSymbolListSite (size_t siteIndex) const
 Get a CruxSymbolListSite from a given position. More...
 
CruxSymbolListSitegetSymbolListSite (size_t siteIndex)
 
virtual void setSite (size_t siteIndex, const Site &site, bool checkPosition=true)
 Set a site in the container. More...
 
std::shared_ptr< SiteremoveSite (size_t siteIndex)
 Remove a site from the container. More...
 
void deleteSite (size_t siteIndex)
 Delete a site from the container. More...
 
void addSite (const Site &site, bool checkPosition=true)
 Add a site in the container. More...
 
void addSite (const Site &site, int position, bool checkPosition=true)
 Add a site in the container. More...
 
void addSite (const Site &site, size_t siteIndex, bool checkPosition=true)
 Add a site in the container. More...
 
void addSite (const Site &site, size_t siteIndex, int position, bool checkPosition=true)
 Add a site in the container. More...
 
void clear ()
 
AlignedSequenceContainercreateEmptyContainer () const
 Return a copy of this container, but with no data inside. More...
 
From AlignedValuesContainer interface
void deleteSites (size_t siteIndex, size_t length)
 Remove a continuous range of sites in the container. More...
 
size_t getNumberOfSites () const
 Get the number of aligned positions in the container. More...
 
Vint getSitePositions () const
 Get all position attributes of sites. More...
 
void setSitePositions (Vint vPositions)
 Set all position attributes of sites. More...
 
void reindexSites ()
 Set all positions attributes. More...
 
Redefinition of VectorSequenceContainer methods, to check for sequence lengths.
void setSequence (const std::string &name, const Sequence &sequence, bool checkName=true)
 Replace a sequence in the container. More...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true)
 Replace a sequence in the container. More...
 
void addSequence (const Sequence &sequence, bool checkName=true)
 Add a sequence at the end of the container. More...
 
void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true)
 Add a sequence to the container at a particular position. More...
 
The SequenceContainer interface.
bool hasSequence (const std::string &name) const
 check if there is a Sequence with this name in the map (same as hasSequenceByKey). More...
 
bool hasSequenceByName (const std::string &name) const
 
bool hasSequenceByKey (const std::string &name) const
 check if there is a Sequence with this key in the map. More...
 
const SequencegetSequence (const std::string &name) const
 get the Sequence with this name in the map (same as getSequenceByKey). More...
 
const SequencegetSequenceByName (const std::string &name) const
 
const SequencegetSequenceByKey (const std::string &name) const
 check if there is a Sequence with this key in the map. More...
 
std::shared_ptr< SequenceremoveSequence (const std::string &name)
 get the Sequence with this name in the map (same as removeSequenceByKey). More...
 
std::shared_ptr< SequenceremoveSequenceByKey (const std::string &name)
 remove & return a Sequence with this key from the map. More...
 
std::shared_ptr< SequenceremoveSequenceByName (const std::string &name)
 remove & return a Sequence with this name. More...
 
void deleteSequence (const std::string &name)
 delete the Sequence with this name in the map (same as deleteSequenceByKey). More...
 
void deleteSequence (size_t pos)
 
void deleteSequenceByKey (const std::string &name)
 remove & return a Sequence with this key from the map. More...
 
void deleteSequenceByName (const std::string &name)
 remove & return a Sequence with this name. More...
 
std::vector< std::string > getKeys () const
 
size_t getNumberOfSequences () const
 Get the number of sequences in the container. More...
 
std::vector< std::string > getSequenceNames () const
 get Sequences proper names (may be different from the keys used to store them in the map), in the order of the vector. More...
 
std::vector< std::string > getSequenceKeys () const
 get Sequences keys (ie the strings used to store them in the map, may be different from their proper names), in the order of the vector. More...
 
void setSequenceNames (const std::vector< std::string > &names, bool checkNames=true)
 set the proper names of the Sequences, in the order of the vector. More...
 
int & valueAt (const std::string &sequenceName, size_t elementIndex)
 Get the value of an element, given sequenceName in the map and the elementIndex position. More...
 
const int & valueAt (const std::string &key, size_t elementIndex) const
 Get the value at a Position in a Sequence with given sequenceName in the map (may be not the actual name of the Sequence.. More...
 
int & valueAt (size_t sequenceIndex, size_t elementIndex)
 Element access operator. More...
 
const int & valueAt (size_t sequenceIndex, size_t elementIndex) const
 Element access operator. More...
 
int & operator() (const std::string &sequenceName, size_t elementIndex)
 Element access operator. More...
 
const int & operator() (const std::string &sequenceName, size_t elementIndex) const
 Element access operator. More...
 
int & operator() (size_t sequenceIndex, size_t elementIndex)
 Element access operator. More...
 
const int & operator() (size_t sequenceIndex, size_t elementIndex) const
 Element access operator. More...
 
The OrderedSequenceContainer interface.
const SequencegetSequence (size_t sequenceIndex) const
 Retrieve a sequence object from the container. More...
 
std::shared_ptr< SequenceremoveSequence (size_t sequenceIndex)
 Extract (and remove) a sequence from the container. More...
 
size_t getSequencePosition (const std::string &name) const
 Get the position of a sequence in sequence container from its name. More...
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
SequenceContainer methods.
virtual const SequencegetSequence (const std::string &name) const=0
 Retrieve a sequence object from the container. More...
 
virtual void setSequence (const std::string &name, const Sequence &sequence, bool checkName)=0
 Replace a sequence in the container. More...
 
virtual std::shared_ptr< SequenceremoveSequence (const std::string &name)=0
 Extract (and remove) a sequence from the container. More...
 
virtual void setComments (size_t sequenceIndex, const Comments &comments)=0
 
virtual std::string toString (size_t sequenceIndex) const=0
 
virtual const CommentsgetComments (size_t sequenceIndex) const=0
 
Add sequence to this container.
virtual void addSequence (const Sequence &sequence, const std::string &key)
 Add a sequence with a given key at the end of the container. More...
 
virtual void addSequence (const std::shared_ptr< Sequence > sequence, bool checkName=true)
 Add a sequence at the end of the container. More...
 
virtual void addSequence (const Sequence &sequence, size_t sequenceIndex, const std::string &key)
 Add a sequence to the container at a particular position with a given key. More...
 
From the OrderedSequenceContainer interface
virtual std::string toString (size_t sequenceIndex) const
 
virtual const CommentsgetComments (size_t sequenceIndex) const
 
virtual const std::string & getName (size_t sequenceIndex) const
 Get the name of a particular row of the alignement (aka sequence). 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

bool checkSize_ (const Sequence &sequence)
 Check sequence's size before insertion in sequence container. More...
 
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< SequencegetObject (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< SequencegetObject (size_t objectIndex)
 
const std::shared_ptr< SequencegetObject (const std::string &name) const
 Get a object. More...
 
std::shared_ptr< SequencegetObject (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< Sequence > 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< Sequence > 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< Sequence > object, const std::string &name, bool check=true)
 
void appendObject (std::shared_ptr< T > object)
 
std::shared_ptr< SequenceremoveObject (size_t objectIndex)
 Extract and remove a object from the container. More...
 
std::shared_ptr< SequenceremoveObject (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< Sequence > 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
 
const std::shared_ptr< SitegetObject (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< SitegetObject (size_t objectIndex)
 
void addObject (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false)
 Add an object. More...
 
void insertObject (std::shared_ptr< Site > object, size_t objectIndex)
 Insert an object. More...
 
std::shared_ptr< SiteremoveObject (size_t objectIndex)
 Extract and remove a object from the container. More...
 
void deleteObject (size_t objectIndex)
 Delete an object from the container. More...
 
void deleteObjects (size_t objectIndex, size_t length)
 
void appendObject (std::shared_ptr< Site > object)
 
std::shared_ptr< SitegetObject_ (size_t objectIndex) const
 
void addObject_ (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false) const
 
SequencedValuesContainer methods.
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const
 get Value at given state with given key in the Sequence Map More...
 
OrderedValuesContainer methods.
double operator() (size_t siteIndex, size_t sequenceIndex, int state) const
 
double getStateValueAt (size_t siteIndex, size_t sequenceIndex, int state) const
 
AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i)
 
SequencegetSequence_ (const std::string &key)
 getSequence with given key More...
 

Protected Attributes

const Alphabetalphabet_
 The container's alphabet. More...
 
Comments comments_
 

Private Member Functions

virtual void setSize (size_t size)
 

Private Attributes

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

Detailed Description

Aligned sequences container.

This class inherits from the VectorSequenceContainer and add site access. Sequence addition methods are re-defined to check for sequence lengths. Sequence access is in $O(1)$, and site access in $O(n)$, where $n$ is the number of sequences in the container.

Sites are built on the fly when needed, otherwise they are only nullptr

See VectorSiteContainer for an alternative implementation.

See also
VectorSequenceContainer, Sequence, Site, VectorSiteContainer

Definition at line 72 of file AlignedSequenceContainer.h.

Constructor & Destructor Documentation

◆ AlignedSequenceContainer() [1/5]

AlignedSequenceContainer::AlignedSequenceContainer ( std::vector< std::shared_ptr< Sequence >>  vseq,
const Alphabet alpha 
)

Build a container with the specified alphabet, with shared Sequences.

Parameters
vseqthe vector of shared_ptr<Sequence> that will be copied.
alphaThe alphabet to use.

Definition at line 55 of file AlignedSequenceContainer.cpp.

References checkSize_(), length_, reindexSites(), and bpp::VectorPositionedContainer< T >::setSize().

Referenced by clone(), and createEmptyContainer().

◆ AlignedSequenceContainer() [2/5]

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

Build a new empty container with the specified alphabet.

Parameters
alphaThe alphabet to use.

Definition at line 98 of file AlignedSequenceContainer.h.

References reindexSites().

◆ AlignedSequenceContainer() [3/5]

bpp::AlignedSequenceContainer::AlignedSequenceContainer ( const AlignedSequenceContainer asc)
inline

Copy constructor.

Parameters
ascThe container to copy.

Definition at line 113 of file AlignedSequenceContainer.h.

◆ AlignedSequenceContainer() [4/5]

bpp::AlignedSequenceContainer::AlignedSequenceContainer ( const SiteContainer sc)
inline

Convert any SiteContainer object into a AlignedSequenceContainer object.

Parameters
scThe container to copy.

Definition at line 127 of file AlignedSequenceContainer.h.

◆ AlignedSequenceContainer() [5/5]

AlignedSequenceContainer::AlignedSequenceContainer ( const OrderedSequenceContainer osc)

Try to coerce an OrderedSequenceContainer object into an AlignedSequenceContainer object.

Sequences in osc will be considered alligned, and have the same number of sites.

Parameters
oscThe ordered container to coerce.
Exceptions
SequenceNotAlignedExceptionIf sequences in osc do not have the same length.

Definition at line 74 of file AlignedSequenceContainer.cpp.

References addSequence(), bpp::SequencedValuesContainer::getGeneralComments(), bpp::SequencedValuesContainer::getNumberOfSequences(), bpp::OrderedSequenceContainer::getSequence(), length_, reindexSites(), bpp::AbstractValuesContainer::setGeneralComments(), bpp::VectorPositionedContainer< T >::setSize(), and bpp::CruxSymbolList::size().

◆ ~AlignedSequenceContainer()

virtual bpp::AlignedSequenceContainer::~AlignedSequenceContainer ( )
inlinevirtual

Definition at line 149 of file AlignedSequenceContainer.h.

Member Function Documentation

◆ addObject() [1/5]

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

Definition at line 226 of file VectorMappedContainer.h.

◆ addObject() [2/5]

void bpp::VectorPositionedContainer< Site >::addObject ( std::shared_ptr< Site 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.

◆ addObject() [3/5]

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() [4/5]

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(), getSite(), bpp::CompressedVectorSiteContainer::setSite(), and bpp::VectorSiteContainer::setSite().

◆ addObject() [5/5]

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/4]

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

Definition at line 298 of file VectorMappedContainer.h.

◆ addObject_() [2/4]

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

Definition at line 258 of file VectorPositionedContainer.h.

◆ addObject_() [3/4]

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

◆ addObject_() [4/4]

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

◆ addSequence() [1/5]

void AlignedSequenceContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
)
virtual

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.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 481 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::addSequence(), checkSize_(), length_, reindexSites(), bpp::VectorPositionedContainer< T >::setSize(), and bpp::CruxSymbolList::size().

Referenced by AlignedSequenceContainer(), and bpp::SiteContainerTools::alignNW().

◆ addSequence() [2/5]

virtual void bpp::VectorSequenceContainer::addSequence ( const Sequence sequence,
const std::string &  key 
)
inlinevirtualinherited

Add a sequence with a given key 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.
keythe key in the map

Definition at line 463 of file VectorSequenceContainer.h.

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

◆ addSequence() [3/5]

void AlignedSequenceContainer::addSequence ( const Sequence sequence,
size_t  sequenceIndex,
bool  checkName = true 
)
virtual

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.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 498 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::addSequence(), checkSize_(), bpp::VectorSequenceContainer::getNumberOfSequences(), length_, bpp::VectorPositionedContainer< T >::nullify(), bpp::VectorPositionedContainer< T >::setSize(), and bpp::CruxSymbolList::size().

◆ addSequence() [4/5]

virtual void bpp::VectorSequenceContainer::addSequence ( const Sequence sequence,
size_t  sequenceIndex,
const std::string &  key 
)
inlinevirtualinherited

Add a sequence to the container at a particular position with a given key.

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.
keythe key in the map
sequenceIndexThe position where to insert the new sequence. All the following sequences will be pushed.
Exceptions
ExceptionIf the sequence couldn't be added to the container.

Definition at line 531 of file VectorSequenceContainer.h.

References bpp::VectorMappedContainer< Sequence >::addObject(), and bpp::Sequence::clone().

◆ addSequence() [5/5]

virtual void bpp::VectorSequenceContainer::addSequence ( const std::shared_ptr< Sequence sequence,
bool  checkName = true 
)
inlinevirtualinherited

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 486 of file VectorSequenceContainer.h.

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

◆ addSite() [1/4]

void AlignedSequenceContainer::addSite ( const Site site,
bool  checkPosition = true 
)
virtual

Add a site in the container.

Parameters
siteThe site to add.
checkPositionLook if the position of the new site match a position attribute in the container.
Exceptions
ExceptionIf the specified site does not exists or is not correct.

Implements bpp::SiteContainer.

Definition at line 281 of file AlignedSequenceContainer.cpp.

References bpp::CoreSymbolList< T >::addElement(), bpp::VectorPositionedContainer< T >::appendObject(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::VectorSequenceContainer::getNumberOfSequences(), bpp::AbstractCoreSite::getPosition(), bpp::VectorSequenceContainer::getSequence_(), length_, positions_, and bpp::CruxSymbolList::size().

◆ addSite() [2/4]

void AlignedSequenceContainer::addSite ( const Site site,
int  position,
bool  checkPosition = true 
)
virtual

Add a site in the container.

Parameters
siteThe site to add.
positionThe new position of the site, to superseed the one in 'site'.
checkPositionLook if the position of the new site match a position attribute in the container.
Exceptions
ExceptionIf the specified site does not exists or is not correct.

Implements bpp::SiteContainer.

Definition at line 316 of file AlignedSequenceContainer.cpp.

References bpp::CoreSymbolList< T >::addElement(), bpp::VectorPositionedContainer< T >::appendObject(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::VectorSequenceContainer::getNumberOfSequences(), bpp::VectorSequenceContainer::getSequence_(), length_, positions_, and bpp::CruxSymbolList::size().

◆ addSite() [3/4]

void AlignedSequenceContainer::addSite ( const Site site,
size_t  siteIndex,
bool  checkPosition = true 
)
virtual

Add a site in the container.

Parameters
siteThe site to add.
siteIndexThe position where to insert the site.
checkPositionLook if the position of the new site match a position attribute in the container.
Exceptions
ExceptionIf the specified site does not exists or is not correct.

Implements bpp::SiteContainer.

Definition at line 352 of file AlignedSequenceContainer.cpp.

References bpp::CoreSymbolList< T >::addElement(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::AbstractCoreSite::getPosition(), bpp::VectorSequenceContainer::getSequence_(), bpp::VectorPositionedContainer< T >::insertObject(), length_, positions_, and bpp::CruxSymbolList::size().

◆ addSite() [4/4]

void AlignedSequenceContainer::addSite ( const Site site,
size_t  siteIndex,
int  position,
bool  checkPosition = true 
)
virtual

Add a site in the container.

Parameters
siteThe site to add.
siteIndexThe position where to insert the site.
positionThe new position of the site, to superseed the one in 'site'.
checkPositionLook if the position of the new site match a position attribute in the container.
Exceptions
ExceptionIf the specified site does not exists or is not correct.

Implements bpp::SiteContainer.

Definition at line 390 of file AlignedSequenceContainer.cpp.

References bpp::CoreSymbolList< T >::addElement(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::VectorSequenceContainer::getSequence_(), bpp::VectorPositionedContainer< T >::insertObject(), length_, positions_, and bpp::CruxSymbolList::size().

◆ appendObject() [1/3]

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

Definition at line 250 of file VectorMappedContainer.h.

◆ appendObject() [2/3]

void bpp::VectorPositionedContainer< Site >::appendObject ( std::shared_ptr< Site object)
inlineprotectedinherited

Definition at line 246 of file VectorPositionedContainer.h.

◆ appendObject() [3/3]

◆ changeName()

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

◆ checkSize_()

bool bpp::AlignedSequenceContainer::checkSize_ ( const Sequence sequence)
inlineprotected

Check sequence's size before insertion in sequence container.

Parameters
sequenceThe sequence to check.
Returns
True if sequence length = number of sites in container.

Definition at line 237 of file AlignedSequenceContainer.h.

References length_, and bpp::CruxSymbolList::size().

Referenced by addSequence(), AlignedSequenceContainer(), and setSequence().

◆ clear()

void AlignedSequenceContainer::clear ( )
virtual

◆ clearComments()

◆ clone()

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

Implements bpp::SiteContainer.

Definition at line 157 of file AlignedSequenceContainer.h.

References AlignedSequenceContainer().

◆ createEmptyContainer()

AlignedSequenceContainer * AlignedSequenceContainer::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 528 of file AlignedSequenceContainer.cpp.

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

◆ deleteGeneralComments() [1/2]

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

◆ deleteGeneralComments() [2/2]

virtual void bpp::SequencedValuesContainer::deleteGeneralComments ( )
pure virtualinherited

Delete the comments associated to this container.

Implemented in bpp::AbstractValuesContainer, and bpp::AbstractProbabilisticSequenceContainer.

◆ deleteObject() [1/3]

void bpp::VectorMappedContainer< Sequence >::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/3]

void bpp::VectorMappedContainer< Sequence >::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.

◆ deleteObject() [3/3]

void bpp::VectorPositionedContainer< Site >::deleteObject ( size_t  objectIndex)
inlineprotectedvirtualinherited

Delete an object from the container.

Parameters
objectIndexThe index of the object in the container.

Implements bpp::PositionedContainer< T >.

Definition at line 230 of file VectorPositionedContainer.h.

◆ deleteObjects() [1/2]

void bpp::VectorPositionedContainer< Site >::deleteObjects ( size_t  objectIndex,
size_t  length 
)
inlineprotectedinherited

Definition at line 238 of file VectorPositionedContainer.h.

◆ deleteObjects() [2/2]

template<class T >
void bpp::VectorPositionedContainer< T >::deleteObjects ( size_t  objectIndex,
size_t  length 
)
inlineprotectedinherited

◆ deleteSequence() [1/2]

void bpp::VectorSequenceContainer::deleteSequence ( const std::string &  name)
inlineinherited

delete the Sequence with this name in the map (same as deleteSequenceByKey).

Definition at line 268 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::deleteSequenceByKey().

Referenced by bpp::VectorSequenceContainer::deleteSequenceByKey(), and bpp::VectorSequenceContainer::deleteSequenceByName().

◆ deleteSequence() [2/2]

void bpp::VectorSequenceContainer::deleteSequence ( size_t  pos)
inlineinherited

◆ deleteSequenceByKey()

void bpp::VectorSequenceContainer::deleteSequenceByKey ( const std::string &  name)
inlineinherited

◆ deleteSequenceByName()

void VectorSequenceContainer::deleteSequenceByName ( const std::string &  name)
inherited

◆ deleteSite()

void AlignedSequenceContainer::deleteSite ( size_t  siteIndex)
virtual

Delete a site from the container.

The site is deleted (ie the container is shortened).

Parameters
siteIndexThe position of the site in the container.
Exceptions
IndexOutOfBoundsExceptionIf the specified site does not exists.

Implements bpp::SiteContainer.

Definition at line 238 of file AlignedSequenceContainer.cpp.

References bpp::CruxSymbolList::deleteElement(), bpp::VectorPositionedContainer< T >::deleteObject(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::VectorSequenceContainer::getSequence_(), length_, and positions_.

◆ deleteSites()

void AlignedSequenceContainer::deleteSites ( size_t  siteIndex,
size_t  length 
)
virtual

Remove a continuous range of sites in the container.

Parameters
siteIndexThe position of the first site in the container.
lengthThe length of the region to delete, starting at pposition siteIndex.
Exceptions
IndexOutOfBoundsExceptionIf the specified range is not valid.

Implements bpp::AlignedValuesContainer.

Definition at line 259 of file AlignedSequenceContainer.cpp.

References bpp::CruxSymbolList::deleteElements(), bpp::VectorPositionedContainer< T >::deleteObjects(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::VectorSequenceContainer::getSequence_(), length_, and positions_.

◆ getAlphabet() [1/2]

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 bpp::VectorProbabilisticSequenceContainer::addSequence(), bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::VectorSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), bpp::CompressedVectorSiteContainer::addSite(), addSite(), bpp::VectorSiteContainer::addSite(), bpp::VectorProbabilisticSiteContainer::addSite(), bpp::Pasta::appendSequencesFromStream(), createEmptyContainer(), bpp::CompressedVectorSiteContainer::createEmptyContainer(), bpp::VectorProbabilisticSequenceContainer::createEmptyContainer(), bpp::VectorProbabilisticSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::getSequence(), bpp::VectorSiteContainer::getSequence(), bpp::VectorProbabilisticSiteContainer::getSequence(), getSite(), bpp::CompressedVectorSiteContainer::getStateValueAt(), bpp::VectorProbabilisticSiteContainer::getStateValueAt(), bpp::VectorSiteContainer::getStateValueAt(), bpp::VectorProbabilisticSequenceContainer::getStateValueAt(), bpp::VectorSequenceContainer::getStateValueAt(), bpp::CompressedVectorSiteContainer::operator()(), bpp::VectorProbabilisticSiteContainer::operator()(), bpp::VectorSiteContainer::operator()(), bpp::VectorProbabilisticSequenceContainer::operator()(), bpp::VectorSequenceContainer::operator()(), bpp::VectorProbabilisticSiteContainer::realloc(), bpp::VectorSiteContainer::realloc(), bpp::CompressedVectorSiteContainer::removeSite(), bpp::CompressedVectorSiteContainer::setComments(), bpp::VectorProbabilisticSiteContainer::setSequence(), bpp::VectorProbabilisticSequenceContainer::setSequence(), bpp::VectorSiteContainer::setSequence(), bpp::VectorSequenceContainer::setSequence(), setSite(), bpp::CompressedVectorSiteContainer::setSite(), and bpp::VectorSiteContainer::setSite().

◆ getAlphabet() [2/2]

virtual const Alphabet* bpp::SequencedValuesContainer::getAlphabet ( ) const
pure virtualinherited

Get container's alphabet.

Returns
The alphabet associated to this container.

Implemented in bpp::AbstractValuesContainer.

Referenced by bpp::Clustal::appendAlignmentFromStream(), bpp::DCSE::appendAlignmentFromStream(), bpp::NexusIOSequence::appendAlignmentFromStream(), bpp::Fasta::appendSequencesFromStream(), bpp::GenBank::appendSequencesFromStream(), bpp::Mase::appendSequencesFromStream(), bpp::SiteContainerTools::changeGapsToUnknownCharacters(), bpp::SiteContainerTools::changeUnresolvedCharactersToGaps(), bpp::SequenceContainerTools::convertAlphabet(), bpp::SequenceContainerTools::getCodonPosition(), bpp::SiteContainerTools::getCompleteSites(), bpp::SiteContainerTools::getConsensus(), bpp::SequenceContainerTools::getFrequencies(), bpp::SiteContainerTools::getSelectedPositions(), bpp::MaseTools::getSelectedSequences(), bpp::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceApplicationTools::getSitesToAnalyse(), bpp::SiteContainerTools::getSitesWithoutGaps(), bpp::SequenceContainerTools::merge(), bpp::SiteContainerTools::merge(), bpp::AbstractSequenceContainer::operator=(), bpp::Phylip::readInterleaved(), bpp::Phylip::readSequential(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::removeStopCodonSites(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::SiteContainerTools::sampleSites(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().

◆ getComments() [1/4]

◆ getComments() [2/4]

const Comments& bpp::AbstractSequenceContainer::getComments ( const std::string &  name) const
inlinevirtualinherited

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 111 of file AbstractSequenceContainer.h.

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

◆ getComments() [3/4]

virtual const Comments& bpp::AbstractSequenceContainer::getComments ( size_t  sequenceIndex) const
inlinevirtualinherited

◆ getComments() [4/4]

◆ getGeneralComments() [1/2]

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

◆ getGeneralComments() [2/2]

◆ getKeys()

std::vector<std::string> bpp::VectorSequenceContainer::getKeys ( ) const
inlineinherited
Returns
The list of key used to index the sequences.

Definition at line 297 of file VectorSequenceContainer.h.

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

◆ getName()

virtual const std::string& bpp::AbstractSequenceContainer::getName ( size_t  sequenceIndex) const
inlinevirtualinherited

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 127 of file AbstractSequenceContainer.h.

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

Referenced by bpp::VectorSequenceContainer::getSequenceNames(), and bpp::VectorSequenceContainer::hasSequenceByName().

◆ getNumberOfObjects()

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

Definition at line 144 of file VectorMappedContainer.h.

◆ getNumberOfSequences()

size_t bpp::VectorSequenceContainer::getNumberOfSequences ( ) const
inlinevirtualinherited

◆ getNumberOfSites()

size_t bpp::AlignedSequenceContainer::getNumberOfSites ( ) const
inlinevirtual

Get the number of aligned positions in the container.

Returns
The number of sites in the container.

Implements bpp::AlignedValuesContainer.

Definition at line 209 of file AlignedSequenceContainer.h.

References length_.

Referenced by addSite(), deleteSite(), deleteSites(), getSite(), operator=(), removeSite(), setSite(), and setSitePositions().

◆ getObject() [1/6]

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

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 188 of file VectorMappedContainer.h.

◆ getObject() [2/6]

const std::shared_ptr<Sequence > bpp::VectorMappedContainer< Sequence >::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/6]

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

Reimplemented from bpp::VectorPositionedContainer< T >.

Definition at line 172 of file VectorMappedContainer.h.

◆ getObject() [4/6]

std::shared_ptr<Site > bpp::VectorPositionedContainer< Site >::getObject ( size_t  objectIndex)
inlineprotectedvirtualinherited

Implements bpp::PositionedContainer< T >.

Definition at line 177 of file VectorPositionedContainer.h.

◆ getObject() [5/6]

const std::shared_ptr<Sequence > bpp::VectorMappedContainer< Sequence >::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() [6/6]

const std::shared_ptr<Site > bpp::VectorPositionedContainer< Site >::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.

Implements bpp::PositionedContainer< T >.

Definition at line 170 of file VectorPositionedContainer.h.

◆ getObject_() [1/2]

std::shared_ptr<Site > bpp::VectorPositionedContainer< Site >::getObject_ ( size_t  objectIndex) const
inlineprotectedinherited

Definition at line 251 of file VectorPositionedContainer.h.

◆ getObject_() [2/2]

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

◆ getObjectName()

std::string bpp::VectorMappedContainer< Sequence >::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< Sequence >::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< Sequence >::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/3]

const Sequence& bpp::VectorSequenceContainer::getSequence ( const std::string &  name) const
inlinevirtualinherited

get the Sequence with this name in the map (same as getSequenceByKey).

Implements bpp::SequenceContainer.

Definition at line 207 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequenceByKey().

Referenced by bpp::VectorSequenceContainer::VectorSequenceContainer().

◆ getSequence() [2/3]

◆ getSequence() [3/3]

const Sequence& bpp::VectorSequenceContainer::getSequence ( size_t  sequenceIndex) const
inlinevirtualinherited

Retrieve a sequence object from the container.

Parameters
sequenceIndexThe position of the sequence.
Returns
A reference toward the Sequence object with corresponding name.

Implements bpp::OrderedSequenceContainer.

Definition at line 397 of file VectorSequenceContainer.h.

References bpp::VectorMappedContainer< Sequence >::getObject().

◆ getSequence_() [1/2]

Sequence& bpp::VectorSequenceContainer::getSequence_ ( const std::string &  key)
inlineprotectedinherited

getSequence with given key

Definition at line 553 of file VectorSequenceContainer.h.

References bpp::VectorMappedContainer< Sequence >::getObject().

◆ getSequence_() [2/2]

◆ getSequenceByKey()

const Sequence& bpp::VectorSequenceContainer::getSequenceByKey ( const std::string &  name) const
inlineinherited

check if there is a Sequence with this key in the map.

Definition at line 219 of file VectorSequenceContainer.h.

References bpp::VectorMappedContainer< Sequence >::getObject().

Referenced by bpp::VectorSequenceContainer::getSequence(), and bpp::VectorSequenceContainer::valueAt().

◆ getSequenceByName()

const Sequence & VectorSequenceContainer::getSequenceByName ( const std::string &  name) const
inherited

◆ getSequenceKeys()

std::vector<std::string> bpp::VectorSequenceContainer::getSequenceKeys ( ) const
inlineinherited

get Sequences keys (ie the strings used to store them in the map, may be different from their proper names), in the order of the vector.

Definition at line 316 of file VectorSequenceContainer.h.

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

◆ getSequenceNames()

std::vector< std::string > VectorSequenceContainer::getSequenceNames ( ) const
virtualinherited

get Sequences proper names (may be different from the keys used to store them in the map), in the order of the vector.

Implements bpp::SequencedValuesContainer.

Definition at line 168 of file VectorSequenceContainer.cpp.

References bpp::AbstractSequenceContainer::getName(), bpp::OrderedSequenceContainer::getSequence(), and bpp::VectorMappedContainer< Sequence >::getSize().

◆ getSequencePosition()

size_t bpp::VectorSequenceContainer::getSequencePosition ( const std::string &  name) const
inlinevirtualinherited

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 392 of file VectorSequenceContainer.h.

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

Referenced by bpp::VectorSequenceContainer::deleteSequenceByKey(), bpp::VectorSequenceContainer::removeSequenceByKey(), and bpp::VectorSequenceContainer::setSequence().

◆ getSite() [1/2]

◆ getSite() [2/2]

const Site & AlignedSequenceContainer::getSite ( size_t  siteIndex) const
virtual

Get a site from the container.

Parameters
siteIndexThe position of the site in the container.
Returns
A site objet corresponding to site i in the alignment.
Exceptions
IndexOutOfBoundsExceptionIf the specified site does not exists.

Implements bpp::SiteContainer.

Definition at line 142 of file AlignedSequenceContainer.cpp.

References bpp::VectorPositionedContainer< T >::addObject_(), bpp::AbstractValuesContainer::getAlphabet(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::VectorPositionedContainer< T >::getObject(), bpp::OrderedSequenceContainer::getSequence(), and length_.

Referenced by getSymbolListSite(), and removeSite().

◆ getSitePositions()

Vint bpp::AlignedSequenceContainer::getSitePositions ( ) const
inlinevirtual

Get all position attributes of sites.

Returns
A vector with all site positions.

Implements bpp::AlignedValuesContainer.

Definition at line 210 of file AlignedSequenceContainer.h.

References positions_.

Referenced by operator=().

◆ getSize() [1/2]

size_t bpp::VectorMappedContainer< Sequence >::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.

◆ getSize() [2/2]

size_t bpp::VectorPositionedContainer< Site >::getSize ( ) const
inlinevirtualinherited

the size

Implements bpp::PositionedContainer< T >.

Definition at line 129 of file VectorPositionedContainer.h.

◆ getStateValueAt() [1/3]

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

get Value at given state with given key in the Sequence Map

Implements bpp::SequencedValuesContainer.

Definition at line 571 of file VectorSequenceContainer.h.

References bpp::OrderedSequenceContainer::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::VectorSequenceContainer::getStateValueAt ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlineprotectedvirtualinherited

◆ getSymbolListSite() [1/2]

CruxSymbolListSite& bpp::AlignedSequenceContainer::getSymbolListSite ( size_t  siteIndex)
inlinevirtual

Implements bpp::SiteContainer.

Definition at line 182 of file AlignedSequenceContainer.h.

References getSite().

◆ getSymbolListSite() [2/2]

const CruxSymbolListSite& bpp::AlignedSequenceContainer::getSymbolListSite ( size_t  siteIndex) const
inlinevirtual

Get a CruxSymbolListSite from a given position.

Parameters
siteIndexThe position

Implements bpp::SiteContainer.

Definition at line 177 of file AlignedSequenceContainer.h.

References getSite().

◆ hasObject()

bool bpp::VectorMappedContainer< Sequence >::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::VectorSequenceContainer::hasSequence ( const std::string &  name) const
inlinevirtualinherited

check if there is a Sequence with this name in the map (same as hasSequenceByKey).

Implements bpp::SequencedValuesContainer.

Definition at line 184 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::hasSequenceByKey().

◆ hasSequenceByKey()

bool bpp::VectorSequenceContainer::hasSequenceByKey ( const std::string &  name) const
inlineinherited

check if there is a Sequence with this key in the map.

Definition at line 196 of file VectorSequenceContainer.h.

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

Referenced by bpp::VectorSequenceContainer::hasSequence().

◆ hasSequenceByName()

bool VectorSequenceContainer::hasSequenceByName ( const std::string &  name) const
inherited

◆ insertObject() [1/4]

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

Definition at line 235 of file VectorMappedContainer.h.

◆ insertObject() [2/4]

void bpp::VectorPositionedContainer< Site >::insertObject ( std::shared_ptr< Site 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.

◆ insertObject() [3/4]

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 addSite(), bpp::VectorSiteContainer::addSite(), and bpp::VectorMappedContainer< T >::insertObject().

◆ insertObject() [4/4]

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() [1/2]

bool bpp::VectorPositionedContainer< Site >::isAvailablePosition ( size_t  objectIndex) const
inlineinherited

Definition at line 134 of file VectorPositionedContainer.h.

◆ isAvailablePosition() [2/2]

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

◆ nullify() [1/2]

void bpp::VectorPositionedContainer< Site >::nullify ( )
inlineinherited

Nullify all elements.

Definition at line 163 of file VectorPositionedContainer.h.

◆ nullify() [2/2]

template<class T >
void bpp::VectorPositionedContainer< T >::nullify ( )
inlineinherited

◆ operator()() [1/6]

int& bpp::VectorSequenceContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
)
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.

Implements bpp::SequenceContainer.

Definition at line 354 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequence_().

◆ operator()() [2/6]

const int& bpp::VectorSequenceContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
) const
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.

Implements bpp::SequenceContainer.

Definition at line 359 of file VectorSequenceContainer.h.

References bpp::OrderedSequenceContainer::getSequence().

◆ operator()() [3/6]

int& bpp::VectorSequenceContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
)
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 374 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequence_().

◆ operator()() [4/6]

const int& bpp::VectorSequenceContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
) const
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 378 of file VectorSequenceContainer.h.

References bpp::OrderedSequenceContainer::getSequence().

◆ operator()() [5/6]

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

◆ operator()() [6/6]

double bpp::VectorSequenceContainer::operator() ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlineprotectedvirtualinherited

◆ operator=() [1/3]

◆ operator=() [2/3]

◆ operator=() [3/3]

◆ reindexSites()

void AlignedSequenceContainer::reindexSites ( )
virtual

Set all positions attributes.

Implements bpp::AlignedValuesContainer.

Definition at line 427 of file AlignedSequenceContainer.cpp.

References length_, and positions_.

Referenced by addSequence(), AlignedSequenceContainer(), and operator=().

◆ removeObject() [1/3]

std::shared_ptr<Sequence > bpp::VectorMappedContainer< Sequence >::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/3]

std::shared_ptr<Sequence > bpp::VectorMappedContainer< Sequence >::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.

◆ removeObject() [3/3]

std::shared_ptr<Site > bpp::VectorPositionedContainer< Site >::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.

Implements bpp::PositionedContainer< T >.

Definition at line 218 of file VectorPositionedContainer.h.

◆ removeSequence() [1/3]

std::shared_ptr<Sequence> bpp::VectorSequenceContainer::removeSequence ( const std::string &  name)
inlinevirtualinherited

get the Sequence with this name in the map (same as removeSequenceByKey).

Implements bpp::SequenceContainer.

Definition at line 240 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::removeSequenceByKey().

◆ removeSequence() [2/3]

virtual std::shared_ptr<Sequence> bpp::SequenceContainer::removeSequence
inherited

Extract (and remove) a sequence from the container.

Parameters
nameThe name of the sequence.

Referenced by bpp::VectorSiteContainer::removeSequence(), bpp::VectorSequenceContainer::removeSequenceByKey(), and bpp::VectorSequenceContainer::removeSequenceByName().

◆ removeSequence() [3/3]

std::shared_ptr<Sequence> bpp::VectorSequenceContainer::removeSequence ( size_t  sequenceIndex)
inlinevirtualinherited

Extract (and remove) a sequence from the container.

Parameters
sequenceIndexThe position of the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 410 of file VectorSequenceContainer.h.

References bpp::VectorMappedContainer< Sequence >::removeObject().

◆ removeSequenceByKey()

std::shared_ptr<Sequence> bpp::VectorSequenceContainer::removeSequenceByKey ( const std::string &  name)
inlineinherited

◆ removeSequenceByName()

std::shared_ptr< Sequence > VectorSequenceContainer::removeSequenceByName ( const std::string &  name)
inherited

◆ removeSite()

std::shared_ptr< Site > AlignedSequenceContainer::removeSite ( size_t  siteIndex)
virtual

Remove a site from the container.

The site is deleted (ie the container is shortened) and a pointer toward it is returned.

Parameters
siteIndexThe position of the site in the container.
Returns
A pointer toward the given site in the alignment.
Exceptions
IndexOutOfBoundsExceptionIf the specified site does not exists.

Implements bpp::SiteContainer.

Definition at line 214 of file AlignedSequenceContainer.cpp.

References bpp::CruxSymbolList::deleteElement(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::VectorSequenceContainer::getSequence_(), getSite(), length_, positions_, and bpp::VectorPositionedContainer< T >::removeObject().

◆ setComments() [1/4]

◆ setComments() [2/4]

void bpp::AbstractSequenceContainer::setComments ( const std::string &  name,
const Comments comments 
)
inlinevirtualinherited

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.

Implements bpp::SequencedValuesContainer.

Definition at line 116 of file AbstractSequenceContainer.h.

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

◆ setComments() [3/4]

void bpp::VectorSequenceContainer::setComments ( size_t  sequenceIndex,
const Comments comments 
)
inlinevirtualinherited

◆ setComments() [4/4]

virtual void bpp::OrderedValuesContainer::setComments
inherited

◆ setGeneralComments() [1/2]

◆ setGeneralComments() [2/2]

virtual void bpp::SequencedValuesContainer::setGeneralComments ( const Comments comments)
pure virtualinherited

Set the comments of this container.

Parameters
commentsThe comments to be associated to this container.

Implemented in bpp::AbstractValuesContainer, and bpp::AbstractProbabilisticSequenceContainer.

Referenced by bpp::Clustal::appendAlignmentFromStream(), bpp::Fasta::appendSequencesFromStream(), and bpp::Mase::appendSequencesFromStream().

◆ setObjectName()

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

Definition at line 219 of file VectorMappedContainer.h.

◆ setObjectNames()

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

Definition at line 203 of file VectorMappedContainer.h.

◆ setSequence() [1/3]

virtual void bpp::SequenceContainer::setSequence
inherited

Replace a sequence in the container.

Parameters
nameThe name of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.

Referenced by bpp::VectorSiteContainer::setSequence(), bpp::VectorSequenceContainer::setSequence(), and setSequence().

◆ setSequence() [2/3]

void AlignedSequenceContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName = true 
)
virtual

Replace a sequence in the container.

Parameters
nameThe name of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.

Implements bpp::SequenceContainer.

Definition at line 468 of file AlignedSequenceContainer.cpp.

References checkSize_(), bpp::VectorSequenceContainer::getNumberOfSequences(), length_, bpp::OrderedSequenceContainer::setSequence(), and bpp::CruxSymbolList::size().

◆ setSequence() [3/3]

void AlignedSequenceContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName = true 
)
virtual

Replace a sequence in the container.

Parameters
sequenceIndexThe position of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.

Implements bpp::OrderedSequenceContainer.

Definition at line 450 of file AlignedSequenceContainer.cpp.

References checkSize_(), bpp::VectorSequenceContainer::getNumberOfSequences(), length_, bpp::VectorPositionedContainer< T >::nullify(), bpp::OrderedSequenceContainer::setSequence(), and bpp::CruxSymbolList::size().

◆ setSequenceNames()

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

◆ setSite()

void AlignedSequenceContainer::setSite ( size_t  siteIndex,
const Site site,
bool  checkPosition = true 
)
virtual

Set a site in the container.

Parameters
siteIndexThe position of the site in the container.
siteThe site to set.
checkPositionLook if the position of the new site match a position attribute in the container.
Exceptions
ExceptionIf the specified site does not exists or is not correct.

Implements bpp::SiteContainer.

Definition at line 182 of file AlignedSequenceContainer.cpp.

References bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::VectorSequenceContainer::getNumberOfSequences(), getNumberOfSites(), bpp::AbstractCoreSite::getPosition(), bpp::VectorSequenceContainer::getSequence_(), positions_, bpp::CoreSymbolList< T >::setElement(), and bpp::CruxSymbolList::size().

◆ setSitePositions()

void AlignedSequenceContainer::setSitePositions ( Vint  vPositions)
virtual

Set all position attributes of sites.

Parameters
vPositionsA vector with all site positions.

Implements bpp::AlignedValuesContainer.

Definition at line 436 of file AlignedSequenceContainer.cpp.

References getNumberOfSites(), and positions_.

◆ setSize() [1/3]

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

◆ setSize() [2/3]

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

◆ setSize() [3/3]

void bpp::VectorPositionedContainer< Site >::setSize ( size_t  size)
inlinevirtualinherited

Reimplemented from bpp::PositionedContainer< T >.

Definition at line 139 of file VectorPositionedContainer.h.

◆ toString() [1/3]

std::string bpp::AbstractSequenceContainer::toString ( const std::string &  name) const
inlinevirtualinherited

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 106 of file AbstractSequenceContainer.h.

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

◆ toString() [2/3]

virtual std::string bpp::AbstractSequenceContainer::toString ( size_t  sequenceIndex) const
inlinevirtualinherited

◆ toString() [3/3]

virtual std::string bpp::OrderedValuesContainer::toString
inherited

◆ valueAt() [1/4]

const int& bpp::VectorSequenceContainer::valueAt ( const std::string &  key,
size_t  elementIndex 
) const
inlinevirtualinherited

Get the value at a Position in a Sequence with given sequenceName in the map (may be not the actual name of the Sequence..

Implements bpp::OrderedSequenceContainer.

Definition at line 349 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequenceByKey().

◆ valueAt() [2/4]

int& bpp::VectorSequenceContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
)
inlinevirtualinherited

Get the value of an element, given sequenceName in the map and the elementIndex position.

Implements bpp::OrderedSequenceContainer.

Definition at line 337 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequence_().

◆ valueAt() [3/4]

int& bpp::VectorSequenceContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
)
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container.

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 364 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::getSequence_().

◆ valueAt() [4/4]

const int& bpp::VectorSequenceContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
) const
inlinevirtualinherited

Element access operator.

Allows direct access to the data stored in the container.

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 369 of file VectorSequenceContainer.h.

References bpp::OrderedSequenceContainer::getSequence().

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::AbstractValuesContainer::alphabet_
protectedinherited

◆ comments_

Comments bpp::Commentable::comments_
protectedinherited

◆ length_

◆ mNames_

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

Definition at line 86 of file VectorMappedContainer.h.

◆ mObjects_

◆ positions_

std::vector<int> bpp::AlignedSequenceContainer::positions_
private

◆ vNames_

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

Definition at line 79 of file VectorMappedContainer.h.


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