bpp-seq3  3.0.0
bpp::VectorSequenceContainer Class Referenceabstract

The VectorSequenceContainer class. More...

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

+ Inheritance diagram for bpp::VectorSequenceContainer:
+ Collaboration diagram for bpp::VectorSequenceContainer:

Public Member Functions

 VectorSequenceContainer (const std::vector< std::shared_ptr< Sequence >> &vs, const Alphabet *alpha)
 Build a container with shared Sequences. More...
 
 VectorSequenceContainer (const Alphabet *alpha)
 Build an empty container that will contain sequences of a particular alphabet. More...
 
VectorSequenceContaineroperator= (const VectorSequenceContainer &vsc)
 Assign from a VectorSequenceContainer. More...
 
VectorSequenceContaineroperator= (const OrderedSequenceContainer &osc)
 Copy from an OrderedSequenceContainer. More...
 
VectorSequenceContaineroperator= (const SequenceContainer &osc)
 Copy from a SequenceContainer. 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...
 
const CommentsgetComments (const std::string &name) const
 Get comments of a particular sequence. More...
 
const CommentsgetComments () const
 Get the comments. More...
 
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 const AlphabetgetAlphabet () const =0
 Get container's alphabet. More...
 
virtual double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const=0
 get value of a state in a position 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...
 
Copy contructors:
 VectorSequenceContainer (const VectorSequenceContainer &vsc)
 Copy from a VectorSequenceContainer. More...
 
 VectorSequenceContainer (const OrderedSequenceContainer &osc)
 Copy from an OrderedSequenceContainer. More...
 
 VectorSequenceContainer (const SequenceContainer &osc)
 Copy from a SequenceContainer. More...
 
The Clonable interface.
VectorSequenceContainerclone () const
 
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...
 
void setSequence (const std::string &name, const Sequence &sequence, bool checkName=true)
 Copy a Sequence to the given 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...
 
VectorSequenceContainercreateEmptyContainer () const
 Return a copy of this container, but with no data inside. 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 & 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 & 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() (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.
size_t getSequencePosition (const std::string &name) const
 Get the position of a sequence in sequence container from its name. More...
 
const SequencegetSequence (size_t sequenceIndex) const
 Retrieve a sequence object from the container. More...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true)
 Replace a sequence in the container. More...
 
std::shared_ptr< SequenceremoveSequence (size_t sequenceIndex)
 Extract (and remove) a sequence from the container. More...
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
Add sequence to this container.
virtual void addSequence (const Sequence &sequence, bool checkName=true)
 Add a sequence at the end of the container. More...
 
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, bool checkName=true)
 Add a sequence to the container at a particular position. 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...
 
SequenceContainer methods.
virtual std::string toString (size_t sequenceIndex) const=0
 
virtual const CommentsgetComments (size_t sequenceIndex) const=0
 
virtual void setComments (size_t sequenceIndex, const Comments &comments)=0
 
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...
 
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< 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
 
AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i)
 
SequencegetSequence_ (const std::string &key)
 getSequence with given key More...
 
SequencedValuesContainer methods.
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...
 
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
OrderedValuesContainer methods.
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 VectorSequenceContainer class.

This is the simplest implementation of the OrderedSequenceContainer interface. std::shared_ptr<Sequence> are stored in a std::vector, as well as in a std::map.

Definition at line 67 of file VectorSequenceContainer.h.

Constructor & Destructor Documentation

◆ VectorSequenceContainer() [1/5]

VectorSequenceContainer::VectorSequenceContainer ( const std::vector< std::shared_ptr< Sequence >> &  vs,
const Alphabet alpha 
)

Build a container with shared Sequences.

The keys of the map are the names of the Sequences

Class constructors:

Definition at line 51 of file VectorSequenceContainer.cpp.

References addSequence().

Referenced by clone(), and createEmptyContainer().

◆ VectorSequenceContainer() [2/5]

bpp::VectorSequenceContainer::VectorSequenceContainer ( 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 88 of file VectorSequenceContainer.h.

◆ VectorSequenceContainer() [3/5]

VectorSequenceContainer::VectorSequenceContainer ( const VectorSequenceContainer vsc)

Copy from a VectorSequenceContainer.

Parameters
vscThe VectorSequenceContainer to copy into this container.

Copy constructors:

Definition at line 65 of file VectorSequenceContainer.cpp.

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

◆ VectorSequenceContainer() [4/5]

VectorSequenceContainer::VectorSequenceContainer ( const OrderedSequenceContainer osc)

Copy from an OrderedSequenceContainer.

Parameters
oscThe OrderedSequenceContainer to copy into this container.

The keys of the map are the names of the Sequences

Definition at line 77 of file VectorSequenceContainer.cpp.

References addSequence(), bpp::SequencedValuesContainer::getNumberOfSequences(), and bpp::OrderedSequenceContainer::getSequence().

◆ VectorSequenceContainer() [5/5]

VectorSequenceContainer::VectorSequenceContainer ( const SequenceContainer osc)

Member Function Documentation

◆ addObject() [1/4]

void bpp::VectorMappedContainer< Sequence >::addObject ( std::shared_ptr< T >  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< Sequence >::addObject_ ( std::shared_ptr< T >  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/5]

virtual void bpp::VectorSequenceContainer::addSequence ( const Sequence 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.

Implements bpp::SequenceContainer.

Reimplemented in bpp::AlignedSequenceContainer.

Definition at line 442 of file VectorSequenceContainer.h.

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

Referenced by bpp::AlignedSequenceContainer::addSequence(), bpp::SequenceContainerTools::createContainerOfSpecifiedSize(), bpp::SequenceContainerTools::getCodonPosition(), operator=(), and VectorSequenceContainer().

◆ addSequence() [2/5]

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

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]

virtual void bpp::VectorSequenceContainer::addSequence ( const Sequence 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.

Reimplemented in bpp::AlignedSequenceContainer.

Definition at line 510 of file VectorSequenceContainer.h.

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

◆ addSequence() [4/5]

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

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

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

◆ appendObject() [1/2]

void bpp::VectorMappedContainer< Sequence >::appendObject ( std::shared_ptr< T >  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::VectorSequenceContainer::clear ( )
inlinevirtual

Delete all objects in the container.

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 158 of file VectorSequenceContainer.h.

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

Referenced by bpp::AlignedSequenceContainer::clear(), and operator=().

◆ clearComments()

◆ clone()

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

Reimplemented from bpp::MappedNamedContainer< T >.

Definition at line 169 of file VectorSequenceContainer.h.

References VectorSequenceContainer().

◆ createEmptyContainer()

VectorSequenceContainer * VectorSequenceContainer::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 233 of file VectorSequenceContainer.cpp.

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

◆ 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/2]

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

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.

◆ deleteObjects()

◆ deleteSequence() [1/2]

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

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

Definition at line 268 of file VectorSequenceContainer.h.

References deleteSequenceByKey().

Referenced by deleteSequenceByKey(), and deleteSequenceByName().

◆ deleteSequence() [2/2]

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

◆ deleteSequenceByKey()

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

remove & return a Sequence with this key from the map.

Definition at line 283 of file VectorSequenceContainer.h.

References deleteSequence(), and getSequencePosition().

Referenced by deleteSequence().

◆ deleteSequenceByName()

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

◆ 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(), 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(), bpp::VectorProbabilisticSequenceContainer::createEmptyContainer(), bpp::VectorProbabilisticSiteContainer::createEmptyContainer(), 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(), bpp::VectorProbabilisticSequenceContainer::getStateValueAt(), getStateValueAt(), bpp::CompressedVectorSiteContainer::operator()(), bpp::VectorProbabilisticSiteContainer::operator()(), bpp::VectorSiteContainer::operator()(), bpp::VectorProbabilisticSequenceContainer::operator()(), operator()(), bpp::VectorProbabilisticSiteContainer::realloc(), bpp::VectorSiteContainer::realloc(), bpp::CompressedVectorSiteContainer::removeSite(), bpp::CompressedVectorSiteContainer::setComments(), bpp::VectorProbabilisticSiteContainer::setSequence(), bpp::VectorProbabilisticSequenceContainer::setSequence(), bpp::VectorSiteContainer::setSequence(), setSequence(), bpp::AlignedSequenceContainer::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
inline
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 getSequenceNames(), and hasSequenceByName().

◆ getNumberOfObjects()

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

Definition at line 144 of file VectorMappedContainer.h.

◆ getNumberOfSequences()

◆ getObject() [1/4]

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

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

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

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

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
inlinevirtual

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

Implements bpp::SequenceContainer.

Definition at line 207 of file VectorSequenceContainer.h.

References getSequenceByKey().

Referenced by VectorSequenceContainer().

◆ getSequence() [2/3]

◆ getSequence() [3/3]

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

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)
inlineprotected

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
inline

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 getSequence(), and valueAt().

◆ getSequenceByName()

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

◆ getSequenceKeys()

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

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
virtual

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

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

Referenced by deleteSequenceByKey(), removeSequenceByKey(), and setSequence().

◆ getSize()

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.

◆ getStateValueAt() [1/3]

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

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
inlineprotectedvirtual

◆ 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
inlinevirtual

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

◆ hasSequenceByKey()

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

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

◆ hasSequenceByName()

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

◆ insertObject() [1/3]

void bpp::VectorMappedContainer< Sequence >::insertObject ( std::shared_ptr< T >  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/6]

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

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

◆ operator()() [2/6]

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

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 
)
inlinevirtual

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

◆ operator()() [4/6]

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

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
inlineprotectedvirtual

◆ operator()() [6/6]

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

◆ operator=() [1/3]

VectorSequenceContainer & VectorSequenceContainer::operator= ( const OrderedSequenceContainer osc)

Copy from an OrderedSequenceContainer.

Parameters
oscThe OrderedSequenceContainer to copy into this container.

The keys of the map are the names of the Sequences

Definition at line 115 of file VectorSequenceContainer.cpp.

References addSequence(), clear(), bpp::SequencedValuesContainer::getNumberOfSequences(), bpp::OrderedSequenceContainer::getSequence(), and bpp::AbstractSequenceContainer::operator=().

◆ operator=() [2/3]

VectorSequenceContainer & VectorSequenceContainer::operator= ( const SequenceContainer osc)

Copy from a SequenceContainer.

Parameters
oscThe SequenceContainer to copy into this container.

The keys of the map are the names of the Sequences

Definition at line 133 of file VectorSequenceContainer.cpp.

References addSequence(), clear(), bpp::SequenceContainer::getSequence(), bpp::SequencedValuesContainer::getSequenceNames(), and bpp::AbstractSequenceContainer::operator=().

◆ operator=() [3/3]

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

Assign from a VectorSequenceContainer.

Parameters
vscThe VectorSequenceContainer to copy into this container.

Assignation operator:

Definition at line 105 of file VectorSequenceContainer.cpp.

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

Referenced by bpp::AlignedSequenceContainer::operator=().

◆ removeObject() [1/2]

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

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.

◆ removeSequence() [1/3]

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

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

Implements bpp::SequenceContainer.

Definition at line 240 of file VectorSequenceContainer.h.

References 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(), removeSequenceByKey(), and removeSequenceByName().

◆ removeSequence() [3/3]

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

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)
inline

remove & return a Sequence with this key from the map.

Definition at line 250 of file VectorSequenceContainer.h.

References getSequencePosition(), and bpp::OrderedSequenceContainer::removeSequence().

Referenced by removeSequence().

◆ removeSequenceByName()

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

◆ 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 
)
inlinevirtual

◆ 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(), setSequence(), and bpp::AlignedSequenceContainer::setSequence().

◆ setSequence() [2/3]

void bpp::VectorSequenceContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName = true 
)
inlinevirtual

Copy a Sequence to the given key in the map.

Implements bpp::SequenceContainer.

Definition at line 229 of file VectorSequenceContainer.h.

References getSequencePosition(), and bpp::OrderedSequenceContainer::setSequence().

◆ setSequence() [3/3]

void bpp::VectorSequenceContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName = true 
)
inlinevirtual

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

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

◆ setSequenceNames()

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

set the proper names of the Sequences, in the order of the vector.

Implements bpp::SequencedValuesContainer.

Definition at line 205 of file VectorSequenceContainer.cpp.

References getNumberOfSequences(), getSequence_(), bpp::CoreSequence::setName(), and bpp::VectorMappedContainer< Sequence >::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::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
inlinevirtual

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

◆ valueAt() [2/4]

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

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

◆ valueAt() [3/4]

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

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

◆ valueAt() [4/4]

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

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

◆ mNames_

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

Definition at line 86 of file VectorMappedContainer.h.

◆ mObjects_

◆ positions_

◆ 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: