bpp-seq3  3.0.0
bpp::TemplateVectorSiteContainer< SiteType, SequenceType > Class Template Referenceabstract

The VectorSiteContainer class. More...

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

+ Inheritance diagram for bpp::TemplateVectorSiteContainer< SiteType, SequenceType >:
+ Collaboration diagram for bpp::TemplateVectorSiteContainer< SiteType, SequenceType >:

Public Member Functions

 TemplateVectorSiteContainer (std::vector< std::unique_ptr< SiteType >> &vs, std::shared_ptr< const Alphabet > alphabet, bool checkPositions=true)
 Build a new container from a set of sites. More...
 
 TemplateVectorSiteContainer (size_t size, std::shared_ptr< const Alphabet > alphabet)
 Build a new empty container with specified size. More...
 
 TemplateVectorSiteContainer (const std::vector< std::string > &sequenceKeys, std::shared_ptr< const Alphabet > alphabet, bool useKeysAsNames=true)
 Build a new empty container with specified sequence keys. More...
 
 TemplateVectorSiteContainer (std::shared_ptr< const Alphabet > alphabet)
 Build a new empty container. More...
 
 TemplateVectorSiteContainer (const TemplateVectorSiteContainer< SiteType, SequenceType > &vsc)
 
 TemplateVectorSiteContainer (const TemplateSiteContainerInterface< SiteType, SequenceType, std::string > &sc)
 
 TemplateVectorSiteContainer (const TemplateSequenceContainerInterface< SequenceType, std::string > &sc)
 
TemplateVectorSiteContainer< SiteType, SequenceType > & operator= (const TemplateVectorSiteContainer< SiteType, SequenceType > &vsc)
 
TemplateVectorSiteContainer< SiteType, SequenceType > & operator= (const TemplateSiteContainerInterface< SiteType, SequenceType, std::string > &sc)
 
TemplateVectorSiteContainer< SiteType, SequenceType > & operator= (const TemplateSequenceContainerInterface< SequenceType, std::string > &sc)
 
virtual ~TemplateVectorSiteContainer ()
 
const Alphabetalphabet () const override
 Get the container's alphabet. More...
 
std::shared_ptr< const AlphabetgetAlphabet () const override
 Get a pointer toward the container's alphabet. More...
 
virtual const CommentsgetComments () const =0
 Get the comments. More...
 
const CommentsgetComments () const override
 Get the comments. More...
 
virtual void setComments (const Comments &comments)=0
 Set the comments. More...
 
void setComments (const Comments &comments) override
 Set the comments. More...
 
virtual void clearComments ()=0
 
void clearComments () override
 
The Clonable interface.
TemplateVectorSiteContainer< SiteType, SequenceType > * clone () const override
 
The SiteContainer interface implementation:
const SiteType & site (size_t sitePosition) const override
 Get a site from the container. More...
 
void setSite (size_t sitePosition, std::unique_ptr< SiteType > &site, bool checkCoordinate=true) override
 Set a site in the container. More...
 
std::unique_ptr< SiteType > removeSite (size_t sitePosition) override
 Remove a site from the container. More...
 
void deleteSite (size_t sitePosition) override
 Delete a site from the container. More...
 
void addSite (std::unique_ptr< SiteType > &site, bool checkCoordinate=true) override
 Add a site in the container. More...
 
void addSite (std::unique_ptr< SiteType > &site, size_t sitePosition, bool checkCoordinate=true) override
 Add a site in the container. More...
 
void deleteSites (size_t sitePosition, size_t length) override
 Remove a continuous range of sites in the container. More...
 
size_t getNumberOfSites () const override
 Get the number of aligned positions in the container. More...
 
void reindexSites () override
 Set all coordinate attributes. More...
 
Vint getSiteCoordinates () const override
 Get all coordinates of sites. More...
 
void setSiteCoordinates (const Vint &vCoordinates) override
 Set all coordinates of sites. More...
 
The SequenceContainer interface.
bool hasSequence (const std::string &sequenceKey) const override
 Check if a certain key is associated to a sequence in the container. More...
 
size_t getSequencePosition (const std::string &sequenceKey) const override
 Get the position of a sequence with a given key in the container. More...
 
const SequenceType & sequence (const std::string &sequenceKey) const override
 Retrieve a sequence object from the container. More...
 
const SequenceType & sequence (size_t sequencePosition) const override
 Retrieve a sequence object from the container. More...
 
std::unique_ptr< SequenceType > removeSequence (size_t sequencePosition) override
 Remove a sequence from the container. More...
 
std::unique_ptr< SequenceType > removeSequence (const std::string &sequenceKey) override
 Remove a sequence from the container. More...
 
void deleteSequence (size_t sequencePosition) override
 Remove and delete a sequence from the container. More...
 
void deleteSequence (const std::string &sequenceKey) override
 Remove and delete a sequence from the container. More...
 
size_t getNumberOfSequences () const override
 Get the number of sequences in the container. More...
 
std::vector< std::string > getSequenceKeys () const override
 
void setSequenceKeys (const std::vector< std::string > &sequenceKeys) override
 Reset all sequence keys. More...
 
const std::string & sequenceKey (size_t sequencePosition) const override
 Get the key associated to a given sequence. More...
 
std::vector< std::string > getSequenceNames () const override
 
void setSequenceNames (const std::vector< std::string > &names, bool updateKeys) override
 Batch-set all sequence names. More...
 
std::vector< CommentsgetSequenceComments () const override
 
void clear () override
 Delete all data in the container. More...
 
TemplateVectorSiteContainer< SiteType, SequenceType > * createEmptyContainer () const override
 Return a copy of this container, but with no data inside. More...
 
const SequenceType::ElementType & valueAt (const std::string &sequenceKey, size_t sitePosition) const override
 Get the content of the dataset at a specific position (sequence key, site position). More...
 
SequenceType::ElementType & valueAt (const std::string &sequenceKey, size_t sitePosition) override
 Get the content of the dataset at a specific position (sequence key, site position). More...
 
const SequenceType::ElementType & valueAt (size_t sequencePosition, size_t sitePosition) const override
 Get the content of the dataset at a specific position (sequence position, site position). More...
 
SequenceType::ElementType & valueAt (size_t sequencePosition, size_t sitePosition) override
 Get the content of the dataset at a specific position (sequence position, site position). More...
 
double getStateValueAt (size_t sitePosition, const std::string &sequenceKey, int state) const override
 Get the value of a state at a given position. More...
 
double operator() (size_t sitePosition, const std::string &sequenceKey, int state) const override
 Get the value of a state at a given position. More...
 
double getStateValueAt (size_t sitePosition, size_t sequencePosition, int state) const override
 Get value of a state at a given position. More...
 
double operator() (size_t sitePosition, size_t sequencePosition, int state) const override
 Get the value of a state at a given position. More...
 
void setSequence (const std::string &sequenceKey, std::unique_ptr< SequenceType > &sequence) override
 Replace a sequence in the container. More...
 
void setSequence (size_t sequencePosition, std::unique_ptr< SequenceType > &sequence) override
 Replace a sequence in the container. More...
 
void setSequence (size_t sequencePosition, std::unique_ptr< SequenceType > &sequence, const std::string &sequenceKey) override
 Replace a sequence in the container. More...
 
void addSequence (const std::string &sequenceKey, std::unique_ptr< SequenceType > &sequence) override
 Add a sequence to the container. More...
 
void insertSequence (size_t sequencePosition, std::unique_ptr< SequenceType > &sequence, const std::string &sequenceKey) override
 Insert a sequence in the container. More...
 

Protected Member Functions

SiteType & site_ (size_t sitePosition)
 
void realloc_ (size_t n)
 

Protected Attributes

VectorPositionedContainer< SiteType > siteContainer_
 
VectorMappedContainer< SequenceType > sequenceContainer_
 
std::vector< std::string > sequenceNames_
 
std::vector< CommentssequenceComments_
 
std::shared_ptr< const Alphabetalphabet_
 The container's alphabet. More...
 
Comments comments_
 

Detailed Description

template<class SiteType, class SequenceType>
class bpp::TemplateVectorSiteContainer< SiteType, SequenceType >

The VectorSiteContainer class.

Sites are stored in a std::vector of pointers. Site access is hence in $O(1)$, and sequence access in $O(l)$, where $l$ is the number of sites in the container.

Sequences are built & stored on the fly, with a cache for time efficiency.

See VectorSequenceContainer for an alternative implementation.

See also
Sequence, Site, AlignedSequenceContainer

Definition at line 41 of file VectorSiteContainer.h.

Constructor & Destructor Documentation

◆ TemplateVectorSiteContainer() [1/7]

template<class SiteType , class SequenceType >
bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer ( std::vector< std::unique_ptr< SiteType >> &  vs,
std::shared_ptr< const Alphabet alphabet,
bool  checkPositions = true 
)
inline

Build a new container from a set of sites.

Parameters
vsA std::vector of sites.
alphabetThe common alphabet for all sites.
checkPositionsCheck for the redundancy of site position tag. This may turn to be very time consuming!
Exceptions
ExceptionIf sites differ in size or in alphabet.

Definition at line 60 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::addSite(), bpp::VectorMappedContainer< T >::appendObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceComments_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_, and bpp::TextTools::toString().

◆ TemplateVectorSiteContainer() [2/7]

template<class SiteType , class SequenceType >
bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer ( size_t  size,
std::shared_ptr< const Alphabet alphabet 
)
inline

Build a new empty container with specified size.

Parameters
sizeNumber of sequences in the container.
alphabetThe alphabet for this container.

Definition at line 94 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::appendObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_, and bpp::TextTools::toString().

◆ TemplateVectorSiteContainer() [3/7]

template<class SiteType , class SequenceType >
bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer ( const std::vector< std::string > &  sequenceKeys,
std::shared_ptr< const Alphabet alphabet,
bool  useKeysAsNames = true 
)
inline

Build a new empty container with specified sequence keys.

Parameters
sequenceKeysSequence keys. This will set the number of sequences in the container.
alphabetThe alphabet for this container.
useKeysAsNamesIf yes, the sequence keys will also be used as sequence names (default). Otherwise, sequence names will be set to Seq_1, Seq_2, etc.

Definition at line 118 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::appendObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_, and bpp::TextTools::toString().

◆ TemplateVectorSiteContainer() [4/7]

template<class SiteType , class SequenceType >
bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer ( std::shared_ptr< const Alphabet alphabet)
inline

Build a new empty container.

Parameters
alphabetThe alphabet for this container.

Definition at line 155 of file VectorSiteContainer.h.

◆ TemplateVectorSiteContainer() [5/7]

◆ TemplateVectorSiteContainer() [6/7]

◆ TemplateVectorSiteContainer() [7/7]

◆ ~TemplateVectorSiteContainer()

template<class SiteType , class SequenceType >
virtual bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::~TemplateVectorSiteContainer ( )
inlinevirtual

Member Function Documentation

◆ addSequence()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::addSequence ( const std::string &  sequenceKey,
std::unique_ptr< SequenceType > &  sequencePtr 
)
inlineoverridevirtual

Add a sequence to the container.

Similar to setSequence, with the exception that an Exception will be raised in case of an existing key. Existing sequences will not be updated, only new ones will be appended.

Parameters
sequenceKeyThe key to which the sequence is associated.
sequencePtrThe sequence to add.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 731 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::appendObject(), bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >::getAlphabet(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSites(), bpp::MappedNamedContainer< T >::hasObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::realloc_(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceComments_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site_(), and bpp::TextTools::toString().

Referenced by bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::operator=(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer().

◆ addSite() [1/2]

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::addSite ( std::unique_ptr< SiteType > &  site,
bool  checkCoordinate = true 
)
inlineoverridevirtual

◆ addSite() [2/2]

◆ alphabet()

const Alphabet& bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >::alphabet ( ) const
inlineoverridevirtualinherited

Get the container's alphabet.

Returns
The alphabet associated to this container.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 95 of file AbstractSequenceContainer.h.

◆ clear()

◆ clearComments() [1/2]

void bpp::SimpleCommentable::clearComments ( )
inlineoverridevirtualinherited

Implements bpp::Commentable.

Definition at line 88 of file Commentable.h.

References bpp::SimpleCommentable::comments_.

◆ clearComments() [2/2]

virtual void bpp::Commentable::clearComments ( )
pure virtualinherited

Implemented in bpp::SimpleCommentable.

◆ clone()

template<class SiteType , class SequenceType >
TemplateVectorSiteContainer<SiteType, SequenceType>* bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::clone ( ) const
inlineoverridevirtual

◆ createEmptyContainer()

template<class SiteType , class SequenceType >
TemplateVectorSiteContainer<SiteType, SequenceType>* bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::createEmptyContainer ( ) const
inlineoverridevirtual

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

This method creates a new SequencedContainer object. The class of this container depends on the class implementing this interface.

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

Implements bpp::TemplateSiteContainerInterface< SiteType, SequenceType, std::string >.

Definition at line 642 of file VectorSiteContainer.h.

References bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >::getAlphabet(), and bpp::SimpleCommentable::getComments().

◆ deleteSequence() [1/2]

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::deleteSequence ( const std::string &  sequenceKey)
inlineoverridevirtual

◆ deleteSequence() [2/2]

◆ deleteSite()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::deleteSite ( size_t  sitePosition)
inlineoverridevirtual

Delete a site from the container.

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

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

Implements bpp::TemplateSiteContainerInterface< SiteType, SequenceType, std::string >.

Definition at line 347 of file VectorSiteContainer.h.

References bpp::VectorPositionedContainer< T >::deleteObject(), bpp::VectorMappedContainer< T >::nullify(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::siteContainer_.

◆ deleteSites()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::deleteSites ( size_t  sitePosition,
size_t  length 
)
inlineoverridevirtual

Remove a continuous range of sites in the container.

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

Implements bpp::TemplateSiteContainerInterface< SiteType, SequenceType, std::string >.

Definition at line 444 of file VectorSiteContainer.h.

References bpp::VectorPositionedContainer< T >::deleteObjects(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::siteContainer_.

◆ getAlphabet()

std::shared_ptr<const Alphabet> bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >::getAlphabet ( ) const
inlineoverridevirtualinherited

Get a pointer toward the container's alphabet.

Returns
A pointer toward the alphabet associated to this container.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 101 of file AbstractSequenceContainer.h.

◆ getComments() [1/2]

◆ getComments() [2/2]

◆ getNumberOfSequences()

◆ getNumberOfSites()

template<class SiteType , class SequenceType >
size_t bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSites ( ) const
inlineoverridevirtual

◆ getSequenceComments()

template<class SiteType , class SequenceType >
std::vector<Comments> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequenceComments ( ) const
inlineoverridevirtual
Returns
a vector with all sequence comments.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 629 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceComments_.

◆ getSequenceKeys()

template<class SiteType , class SequenceType >
std::vector<std::string> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequenceKeys ( ) const
inlineoverridevirtual

◆ getSequenceNames()

template<class SiteType , class SequenceType >
std::vector<std::string> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequenceNames ( ) const
inlineoverridevirtual
Returns
a vector with all sequence names.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 612 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_.

◆ getSequencePosition()

◆ getSiteCoordinates()

template<class SiteType , class SequenceType >
Vint bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSiteCoordinates ( ) const
inlineoverridevirtual

◆ getStateValueAt() [1/2]

template<class SiteType , class SequenceType >
double bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getStateValueAt ( size_t  sitePosition,
const std::string &  sequenceKey,
int  state 
) const
inlineoverridevirtual

Get the value of a state at a given position.

Parameters
sitePositionindex of the site
sequenceKeykey of the sequence in the container
statestate in the alphabet

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 675 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequencePosition(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ getStateValueAt() [2/2]

template<class SiteType , class SequenceType >
double bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getStateValueAt ( size_t  sitePosition,
size_t  sequencePosition,
int  state 
) const
inlineoverridevirtual

Get value of a state at a given position.

Parameters
sitePositionindex of the site
sequencePositionindex of the sequence in the container
statestate in the alphabet

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 685 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ hasSequence()

template<class SiteType , class SequenceType >
bool bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::hasSequence ( const std::string &  sequenceKey) const
inlineoverridevirtual

Check if a certain key is associated to a sequence in the container.

Parameters
sequenceKeyThe key to which the sequence is associated.
Returns
True if the key was found in the contained.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 491 of file VectorSiteContainer.h.

References bpp::MappedNamedContainer< T >::hasObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey().

◆ insertSequence()

◆ operator()() [1/2]

template<class SiteType , class SequenceType >
double bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::operator() ( size_t  sitePosition,
const std::string &  sequenceKey,
int  state 
) const
inlineoverridevirtual

Get the value of a state at a given position.

Same as getValueAt.

Parameters
sitePositionindex of the site
sequenceKeykey of the sequence in the container
statestate in the alphabet

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 680 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequencePosition(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ operator()() [2/2]

template<class SiteType , class SequenceType >
double bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::operator() ( size_t  sitePosition,
size_t  sequencePosition,
int  state 
) const
inlineoverridevirtual

Get the value of a state at a given position.

Same as getValueAt.

Parameters
sitePositionindex of the site
sequencePositionindex of the sequence in the container
statestate in the alphabet

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 690 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ operator=() [1/3]

◆ operator=() [2/3]

◆ operator=() [3/3]

◆ realloc_()

◆ reindexSites()

◆ removeSequence() [1/2]

template<class SiteType , class SequenceType >
std::unique_ptr<SequenceType> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::removeSequence ( const std::string &  sequenceKey)
inlineoverridevirtual

◆ removeSequence() [2/2]

◆ removeSite()

template<class SiteType , class SequenceType >
std::unique_ptr<SiteType> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::removeSite ( size_t  sitePosition)
inlineoverridevirtual

Remove a site from the container.

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

Parameters
sitePositionThe 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::TemplateSiteContainerInterface< SiteType, SequenceType, std::string >.

Definition at line 337 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::nullify(), bpp::VectorPositionedContainer< T >::removeObject(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::siteContainer_.

◆ sequence() [1/2]

◆ sequence() [2/2]

◆ sequenceKey()

template<class SiteType , class SequenceType >
const std::string& bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey ( size_t  sequencePosition) const
inlineoverridevirtual

◆ setComments() [1/2]

◆ setComments() [2/2]

virtual void bpp::Commentable::setComments ( const Comments comments)
pure virtualinherited

◆ setSequence() [1/3]

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence ( const std::string &  sequenceKey,
std::unique_ptr< SequenceType > &  sequencePtr 
)
inlineoverridevirtual

Replace a sequence in the container.

If a sequence is found with the given key, it will be updated with the new one. If no sequence with the given key is found, the new sequence will be added to the container.

Parameters
sequenceKeyThe key to which the sequence is associated.
sequencePtrThe sequence to set.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 696 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequencePosition(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequence(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey().

Referenced by bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence().

◆ setSequence() [2/3]

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence ( size_t  sequencePosition,
std::unique_ptr< SequenceType > &  sequencePtr 
)
inlineoverridevirtual

Replace a sequence in the container.

The original key associated to the sequence will be kept.

Parameters
sequencePositionThe position of the sequence.
sequencePtrThe sequence to add.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 703 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::getObjectName(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence().

◆ setSequence() [3/3]

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence ( size_t  sequencePosition,
std::unique_ptr< SequenceType > &  sequencePtr,
const std::string &  sequenceKey 
)
inlineoverridevirtual

◆ setSequenceKeys()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequenceKeys ( const std::vector< std::string > &  sequenceKeys)
inlineoverridevirtual

◆ setSequenceNames()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequenceNames ( const std::vector< std::string > &  names,
bool  updateKeys 
)
inlineoverridevirtual

Batch-set all sequence names.

Parameters
namesA vector of sequence names. Must be the same size as the number of sequences in the container, otherwise a DimensionException is thrown.
updateKeysTell whether the keys of the sequences should be updated with the new sequence names.

Implements bpp::TemplateSequenceDataInterface< std::string >.

Definition at line 617 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSequences(), bpp::VectorMappedContainer< T >::nullify(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceNames_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequenceKeys().

◆ setSite()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSite ( size_t  sitePosition,
std::unique_ptr< SiteType > &  site,
bool  checkCoordinate = true 
)
inlineoverridevirtual

◆ setSiteCoordinates()

template<class SiteType , class SequenceType >
void bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSiteCoordinates ( const Vint vCoordinates)
inlineoverridevirtual

Set all coordinates of sites.

Parameters
vCoordinatesA vector with all site coordinates.

Implements bpp::TemplateAlignmentDataInterface< HashType >.

Definition at line 472 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSites(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site_().

◆ site()

◆ site_()

◆ valueAt() [1/4]

template<class SiteType , class SequenceType >
const SequenceType::ElementType& bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::valueAt ( const std::string &  sequenceKey,
size_t  sitePosition 
) const
inlineoverridevirtual

Get the content of the dataset at a specific position (sequence key, site position).

Parameters
sequenceKeykey of the sequence in the container
sitePositionindex of the site
Returns
The element at the given position.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 650 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequencePosition(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ valueAt() [2/4]

template<class SiteType , class SequenceType >
SequenceType::ElementType& bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::valueAt ( const std::string &  sequenceKey,
size_t  sitePosition 
)
inlineoverridevirtual

◆ valueAt() [3/4]

template<class SiteType , class SequenceType >
const SequenceType::ElementType& bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::valueAt ( size_t  sequencePosition,
size_t  sitePosition 
) const
inlineoverridevirtual

Get the content of the dataset at a specific position (sequence position, site position).

Parameters
sequencePositionindex of the sequence in the container
sitePositionindex of the site
Returns
The element at the given position.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 663 of file VectorSiteContainer.h.

References bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site().

◆ valueAt() [4/4]

template<class SiteType , class SequenceType >
SequenceType::ElementType& bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::valueAt ( size_t  sequencePosition,
size_t  sitePosition 
)
inlineoverridevirtual

Get the content of the dataset at a specific position (sequence position, site position).

Parameters
sequencePositionindex of the sequence in the container
sitePositionindex of the site
Returns
The element at the given position.

Implements bpp::TemplateSequenceContainerInterface< SequenceType, std::string >.

Definition at line 668 of file VectorSiteContainer.h.

References bpp::VectorMappedContainer< T >::addObject(), bpp::VectorMappedContainer< T >::getObjectName(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_, and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site_().

Member Data Documentation

◆ alphabet_

std::shared_ptr<const Alphabet> bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >::alphabet_
protectedinherited

The container's alphabet.

Definition at line 31 of file AbstractSequenceContainer.h.

◆ comments_

◆ sequenceComments_

◆ sequenceContainer_

template<class SiteType , class SequenceType >
VectorMappedContainer<SequenceType> bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceContainer_
protected

Definition at line 47 of file VectorSiteContainer.h.

Referenced by bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::addSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::addSite(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::clear(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::deleteSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::deleteSite(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequenceKeys(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::getSequencePosition(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::hasSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::insertSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::operator=(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::removeSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::removeSite(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::sequenceKey(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequence(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequenceKeys(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSequenceNames(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::setSite(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::TemplateVectorSiteContainer(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::valueAt().

◆ sequenceNames_

◆ siteContainer_


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