bpp-seq  2.2.0
bpp::CompressedVectorSiteContainer Class Reference

A low memory, yet restricted, version of the VectorSiteContainer class. More...

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

+ Inheritance diagram for bpp::CompressedVectorSiteContainer:
+ Collaboration diagram for bpp::CompressedVectorSiteContainer:

Public Member Functions

 CompressedVectorSiteContainer (const std::vector< const Site *> &vs, const Alphabet *alpha) throw (Exception)
 Build a new container from a set of sites. More...
 
 CompressedVectorSiteContainer (size_t size, const Alphabet *alpha)
 Build a new empty container with specified size. More...
 
 CompressedVectorSiteContainer (const std::vector< std::string > &names, const Alphabet *alpha)
 Build a new empty container with specified sequence names. More...
 
 CompressedVectorSiteContainer (const Alphabet *alpha)
 Build a new empty container. More...
 
 CompressedVectorSiteContainer (const CompressedVectorSiteContainer &vsc)
 
 CompressedVectorSiteContainer (const SiteContainer &sc)
 
CompressedVectorSiteContaineroperator= (const CompressedVectorSiteContainer &vsc)
 
CompressedVectorSiteContaineroperator= (const SiteContainer &sc)
 
virtual ~CompressedVectorSiteContainer ()
 
void addSequence (const Sequence &sequence, bool checkName=true) throw (Exception, NotImplementedException)
 Add a sequence to the container. More...
 
void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true) throw (Exception, NotImplementedException)
 
void setSequence (const std::string &name, const Sequence &sequence, bool checkName) throw (Exception, NotImplementedException)
 Replace a sequence in the container. More...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName) throw (Exception, NotImplementedException)
 Replace a sequence in the container. More...
 
The Clonable interface.
CompressedVectorSiteContainerclone () const
 
The SiteContainer interface implementation:
const SitegetSite (size_t siteIndex) const throw (IndexOutOfBoundsException)
 Get a site from the container. More...
 
void setSite (size_t siteIndex, const Site &site, bool checkPosition=false) throw (Exception)
 Set a site in the container. More...
 
SiteremoveSite (size_t siteIndex) throw (IndexOutOfBoundsException)
 Remove a site from the container. More...
 
void deleteSite (size_t siteIndex) throw (IndexOutOfBoundsException)
 Delete a site in the container. More...
 
void deleteSites (size_t siteIndex, size_t length) throw (IndexOutOfBoundsException)
 Delete a continuous range of sites in the container. More...
 
void addSite (const Site &site, bool checkPosition=false) throw (Exception)
 Add a site in the container. More...
 
void addSite (const Site &site, int position, bool checkPosition=false) throw (Exception)
 Add a site in the container. More...
 
void addSite (const Site &site, size_t siteIndex, bool checkPosition=false) throw (Exception)
 Add a site in the container. More...
 
void addSite (const Site &site, size_t siteIndex, int position, bool checkPosition=false) throw (Exception)
 Add a site in the container. More...
 
size_t getNumberOfSites () const
 Get the number of sites in the container. More...
 
void reindexSites ()
 Set all positions attributes. More...
 
Vint getSitePositions () const
 Get all position attributes of sites. More...
 
The SequenceContainer interface.
void setComments (size_t sequenceIndex, const Comments &comments) throw (IndexOutOfBoundsException)
 Set the comments of a particular sequence. More...
 
const SequencegetSequence (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Retrieve a sequence object from the container. More...
 
const SequencegetSequence (const std::string &name) const throw (SequenceNotFoundException)
 Retrieve a sequence object from the container. More...
 
bool hasSequence (const std::string &name) const
 Check if a sequence with a given name is present in the container. More...
 
size_t getSequencePosition (const std::string &name) const throw (SequenceNotFoundException)
 Get the position of a sequence in sequence container from its name. More...
 
SequenceremoveSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException, NotImplementedException)
 Extract (and remove) a sequence from the container. More...
 
SequenceremoveSequence (const std::string &name) throw (SequenceNotFoundException, NotImplementedException)
 Extract (and remove) a sequence from the container. More...
 
void deleteSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException, NotImplementedException)
 Delete a sequence of the container. More...
 
void deleteSequence (const std::string &name) throw (SequenceNotFoundException, NotImplementedException)
 Delete a sequence of the container. More...
 
size_t getNumberOfSequences () const
 Get the number of sequences in the container. More...
 
std::vector< std::string > getSequencesNames () const
 Get all the names of the sequences in the container. More...
 
void setSequencesNames (const std::vector< std::string > &names, bool checkNames=true) throw (Exception)
 Set all sequence names. More...
 
void clear ()
 Delete all sequences in the container. More...
 
CompressedVectorSiteContainercreateEmptyContainer () const
 Return a copy of this container, but with no sequence inside. More...
 
int & valueAt (const std::string &sequenceName, size_t elementIndex) throw (SequenceNotFoundException, IndexOutOfBoundsException)
 Element access function. More...
 
const int & valueAt (const std::string &sequenceName, size_t elementIndex) const throw (SequenceNotFoundException, IndexOutOfBoundsException)
 Element access function. 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) throw (IndexOutOfBoundsException)
 Element access operator. More...
 
const int & valueAt (size_t sequenceIndex, size_t elementIndex) const throw (IndexOutOfBoundsException)
 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...
 
From the SequenceContainer interface
const AlphabetgetAlphabet () const
 Get sequence container's alphabet. More...
 
const std::vector< int > & getContent (const std::string &name) const throw (SequenceNotFoundException)
 Get the content of a sequence. More...
 
std::string toString (const std::string &name) const throw (SequenceNotFoundException)
 Convert a particular sequence to a string. More...
 
const CommentsgetComments (const std::string &name) const throw (SequenceNotFoundException)
 Get comments of a particular sequence. More...
 
void setComments (const std::string &name, const Comments &comments) throw (SequenceNotFoundException)
 Set the comments of a particular sequence. 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...
 
From the OrderedSequenceContainer interface
virtual const std::vector< int > & getContent (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Get the content of a sequence. More...
 
virtual std::string toString (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Convert a particular sequence to a string. More...
 
virtual const CommentsgetComments (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Get comments of a particular sequence. More...
 
virtual const std::string & getName (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Get the name of a particular sequence. More...
 

Protected Member Functions

size_t getSiteIndex_ (const Site &site)
 

Protected Attributes

std::vector< Site * > sites_
 
std::vector< size_t > index_
 
std::vector< std::string > names_
 
std::vector< Comments * > comments_
 
std::vector< Sequence * > sequences_
 

Detailed Description

A low memory, yet restricted, version of the VectorSiteContainer class.

This implementation is very similar to VectorSiteContainer, but identical sites are stored only once, which significantly reduce memory usage in the case of containers where the number of sites is large compared to the number of sequences. site access is as fast as in the standard VectorSiteContainer class, but site addition takes more time, as the new site must be first compared to the existing set. A major restriction of this container is that you can't add or remove sequences. The number of sequences is fixed after the first site has been added.

Warning
Since the data is compressed, the sites given as input are modified. The major pratical consequence is that the 'position' attribute of sites will be lost. Instead, the position will correspond to the position in the compressed container. In addition, this container may lead to unexpected behavior if used with derived classes of Site. Use with care then...
See also
Sequence, Site, VectorSiteContainer

Definition at line 76 of file CompressedVectorSiteContainer.h.

Constructor & Destructor Documentation

◆ CompressedVectorSiteContainer() [1/6]

CompressedVectorSiteContainer::CompressedVectorSiteContainer ( const std::vector< const Site *> &  vs,
const Alphabet alpha 
)
throw (Exception
)

Build a new container from a set of sites.

Parameters
vsA std::vector of sites.
alphaThe common alphabet for all sites.
Exceptions
ExceptionIf sites differ in size or in alphabet.

Class constructors:

Definition at line 51 of file CompressedVectorSiteContainer.cpp.

Referenced by clone(), and createEmptyContainer().

◆ CompressedVectorSiteContainer() [2/6]

CompressedVectorSiteContainer::CompressedVectorSiteContainer ( size_t  size,
const Alphabet alpha 
)

Build a new empty container with specified size.

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

Definition at line 83 of file CompressedVectorSiteContainer.cpp.

References comments_, and names_.

◆ CompressedVectorSiteContainer() [3/6]

CompressedVectorSiteContainer::CompressedVectorSiteContainer ( const std::vector< std::string > &  names,
const Alphabet alpha 
)

Build a new empty container with specified sequence names.

Parameters
namesSequence names. This will set the number of sequences in the container.
alphaThe alphabet for this container.

Definition at line 101 of file CompressedVectorSiteContainer.cpp.

References comments_, and names_.

◆ CompressedVectorSiteContainer() [4/6]

CompressedVectorSiteContainer::CompressedVectorSiteContainer ( const Alphabet alpha)

Build a new empty container.

Parameters
alphaThe alphabet for this container.

Definition at line 119 of file CompressedVectorSiteContainer.cpp.

◆ CompressedVectorSiteContainer() [5/6]

CompressedVectorSiteContainer::CompressedVectorSiteContainer ( const CompressedVectorSiteContainer vsc)

◆ CompressedVectorSiteContainer() [6/6]

◆ ~CompressedVectorSiteContainer()

virtual bpp::CompressedVectorSiteContainer::~CompressedVectorSiteContainer ( )
inlinevirtual

Definition at line 126 of file CompressedVectorSiteContainer.h.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

void bpp::CompressedVectorSiteContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
)
throw (Exception,
NotImplementedException
)
inlinevirtual

Add a sequence to the container.

Parameters
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.
Exceptions
ExceptionAny other kind of exception, if the name of the sequence is already used, are whatever else depending on the implementation.

Implements bpp::SequenceContainer.

Definition at line 255 of file CompressedVectorSiteContainer.h.

◆ addSequence() [2/2]

void bpp::CompressedVectorSiteContainer::addSequence ( const Sequence sequence,
size_t  sequenceIndex,
bool  checkName = true 
)
throw (Exception,
NotImplementedException
)
inline

Definition at line 261 of file CompressedVectorSiteContainer.h.

◆ addSite() [1/4]

void CompressedVectorSiteContainer::addSite ( const Site site,
bool  checkPosition = false 
)
throw (Exception
)
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 368 of file CompressedVectorSiteContainer.cpp.

Referenced by addSite(), CompressedVectorSiteContainer(), and operator=().

◆ addSite() [2/4]

void bpp::CompressedVectorSiteContainer::addSite ( const Site site,
int  position,
bool  checkPosition = false 
)
throw (Exception
)
inlinevirtual

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 148 of file CompressedVectorSiteContainer.h.

References addSite().

◆ addSite() [3/4]

void CompressedVectorSiteContainer::addSite ( const Site site,
size_t  siteIndex,
bool  checkPosition = false 
)
throw (Exception
)
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 391 of file CompressedVectorSiteContainer.cpp.

◆ addSite() [4/4]

void bpp::CompressedVectorSiteContainer::addSite ( const Site site,
size_t  siteIndex,
int  position,
bool  checkPosition = false 
)
throw (Exception
)
inlinevirtual

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 153 of file CompressedVectorSiteContainer.h.

References addSite().

◆ clear()

void CompressedVectorSiteContainer::clear ( )
virtual

Delete all sequences in the container.

Implements bpp::SequenceContainer.

Definition at line 490 of file CompressedVectorSiteContainer.cpp.

References comments_, index_, names_, sequences_, and sites_.

Referenced by operator=(), and ~CompressedVectorSiteContainer().

◆ clone()

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

Implements bpp::SiteContainer.

Definition at line 134 of file CompressedVectorSiteContainer.h.

References CompressedVectorSiteContainer().

◆ createEmptyContainer()

CompressedVectorSiteContainer * CompressedVectorSiteContainer::createEmptyContainer ( ) const
virtual

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

This method creates a new SequenceContainer 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::SequenceContainer.

Definition at line 566 of file CompressedVectorSiteContainer.cpp.

References CompressedVectorSiteContainer(), bpp::AbstractSequenceContainer::getAlphabet(), bpp::AbstractSequenceContainer::getGeneralComments(), and bpp::AbstractSequenceContainer::setGeneralComments().

◆ deleteGeneralComments()

void bpp::AbstractSequenceContainer::deleteGeneralComments ( )
inlinevirtualinherited

Delete the comments associated to this container.

Implements bpp::SequenceContainer.

Definition at line 150 of file AbstractSequenceContainer.h.

References bpp::AbstractSequenceContainer::comments_.

◆ deleteSequence() [1/2]

void bpp::CompressedVectorSiteContainer::deleteSequence ( size_t  sequenceIndex)
throw (IndexOutOfBoundsException,
NotImplementedException
)
inlinevirtual

Delete a sequence of the container.

Parameters
sequenceIndexThe position of the sequence.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 192 of file CompressedVectorSiteContainer.h.

◆ deleteSequence() [2/2]

void bpp::CompressedVectorSiteContainer::deleteSequence ( const std::string &  name)
throw (SequenceNotFoundException,
NotImplementedException
)
inlinevirtual

Delete a sequence of the container.

Parameters
nameThe name of the sequence.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 198 of file CompressedVectorSiteContainer.h.

◆ deleteSite()

void CompressedVectorSiteContainer::deleteSite ( size_t  siteIndex)
throw (IndexOutOfBoundsException
)
virtual

Delete a site in the container.

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

Implements bpp::SiteContainer.

Definition at line 327 of file CompressedVectorSiteContainer.cpp.

◆ deleteSites()

void CompressedVectorSiteContainer::deleteSites ( size_t  siteIndex,
size_t  length 
)
throw (IndexOutOfBoundsException
)
virtual

Delete 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::SiteContainer.

Definition at line 358 of file CompressedVectorSiteContainer.cpp.

◆ getAlphabet()

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

◆ getComments() [1/2]

const Comments& bpp::AbstractSequenceContainer::getComments ( const std::string &  name) const
throw (SequenceNotFoundException
)
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::OrderedSequenceContainer.

Definition at line 134 of file AbstractSequenceContainer.h.

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

Referenced by CompressedVectorSiteContainer(), bpp::VectorSiteContainer::operator=(), operator=(), and bpp::VectorSiteContainer::VectorSiteContainer().

◆ getComments() [2/2]

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

Get comments of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 177 of file AbstractSequenceContainer.h.

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

◆ getContent() [1/2]

const std::vector<int>& bpp::AbstractSequenceContainer::getContent ( const std::string &  name) const
throw (SequenceNotFoundException
)
inlinevirtualinherited

Get the content of a sequence.

Parameters
nameThe name of the sequence.
Returns
The content of the sequence as a vector of integers.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 124 of file AbstractSequenceContainer.h.

References bpp::SymbolList::getContent(), and bpp::OrderedSequenceContainer::getSequence().

Referenced by bpp::SequenceContainerTools::getCodonPosition().

◆ getContent() [2/2]

virtual const std::vector<int>& bpp::AbstractSequenceContainer::getContent ( size_t  sequenceIndex) const
throw (IndexOutOfBoundsException
)
inlinevirtualinherited

Get the content of a sequence.

Parameters
sequenceIndexThe position of the sequence.
Returns
The content of the sequence as a vector of integers.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 167 of file AbstractSequenceContainer.h.

References bpp::SymbolList::getContent(), and bpp::OrderedSequenceContainer::getSequence().

◆ getGeneralComments()

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

◆ getName()

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

Get the name of a particular 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::OrderedSequenceContainer.

Definition at line 162 of file AbstractSequenceContainer.h.

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

Referenced by bpp::VectorSequenceContainer::getSequencesNames(), and bpp::VectorSequenceContainer::hasSequence().

◆ getNumberOfSequences()

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

Get the number of sequences in the container.

Returns
The number of sequences in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 204 of file CompressedVectorSiteContainer.h.

References names_.

Referenced by CompressedVectorSiteContainer(), operator=(), and valueAt().

◆ getNumberOfSites()

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

Get the number of sites in the container.

Returns
The number of sites in the container.

Implements bpp::SiteContainer.

Definition at line 157 of file CompressedVectorSiteContainer.h.

References index_.

Referenced by CompressedVectorSiteContainer(), getSitePositions(), and valueAt().

◆ getSequence() [1/2]

const Sequence & CompressedVectorSiteContainer::getSequence ( size_t  sequenceIndex) const
throw (IndexOutOfBoundsException
)
virtual

Retrieve a sequence object from the container.

Parameters
sequenceIndexThe position of the sequence.
Returns
A reference toward the Sequence object with corresponding name.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 440 of file CompressedVectorSiteContainer.cpp.

◆ getSequence() [2/2]

const Sequence & CompressedVectorSiteContainer::getSequence ( const std::string &  name) const
throw (SequenceNotFoundException
)
virtual

Retrieve a sequence object from the container.

Parameters
nameThe name of the sequence.
Returns
A reference toward the Sequence with corresponding name.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 458 of file CompressedVectorSiteContainer.cpp.

◆ getSequencePosition()

size_t CompressedVectorSiteContainer::getSequencePosition ( const std::string &  name) const
throw (SequenceNotFoundException
)
virtual

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::OrderedSequenceContainer.

Definition at line 478 of file CompressedVectorSiteContainer.cpp.

Referenced by operator()(), and valueAt().

◆ getSequencesNames()

vector< string > CompressedVectorSiteContainer::getSequencesNames ( ) const
virtual

Get all the names of the sequences in the container.

Returns
A vector of strings with all sequence names.

Implements bpp::OrderedSequenceContainer.

Definition at line 520 of file CompressedVectorSiteContainer.cpp.

References names_.

◆ getSite()

const Site & CompressedVectorSiteContainer::getSite ( size_t  siteIndex) const
throw (IndexOutOfBoundsException
)
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 230 of file CompressedVectorSiteContainer.cpp.

Referenced by CompressedVectorSiteContainer().

◆ getSiteIndex_()

size_t CompressedVectorSiteContainer::getSiteIndex_ ( const Site site)
protected
Returns
The position of the site in the compressed set. If the site is not found, this will return the number of sites in the compressed set.

Definition at line 575 of file CompressedVectorSiteContainer.cpp.

References sites_, and bpp::BasicSymbolList::size().

◆ getSitePositions()

Vint CompressedVectorSiteContainer::getSitePositions ( ) const
virtual

Get all position attributes of sites.

Returns
A vector with all site positions.

Implements bpp::SiteContainer.

Definition at line 427 of file CompressedVectorSiteContainer.cpp.

References getNumberOfSites(), index_, and sites_.

◆ hasSequence()

bool CompressedVectorSiteContainer::hasSequence ( const std::string &  name) const
virtual

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

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

Implements bpp::SequenceContainer.

Definition at line 467 of file CompressedVectorSiteContainer.cpp.

References names_.

◆ operator()() [1/4]

int& bpp::CompressedVectorSiteContainer::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 224 of file CompressedVectorSiteContainer.h.

References getSequencePosition(), index_, and sites_.

◆ operator()() [2/4]

const int& bpp::CompressedVectorSiteContainer::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 228 of file CompressedVectorSiteContainer.h.

References getSequencePosition(), index_, and sites_.

◆ operator()() [3/4]

int& bpp::CompressedVectorSiteContainer::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 245 of file CompressedVectorSiteContainer.h.

References index_, and sites_.

◆ operator()() [4/4]

const int& bpp::CompressedVectorSiteContainer::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 249 of file CompressedVectorSiteContainer.h.

References index_, and sites_.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ reindexSites()

void CompressedVectorSiteContainer::reindexSites ( )
virtual

Set all positions attributes.

Implements bpp::SiteContainer.

Definition at line 416 of file CompressedVectorSiteContainer.cpp.

References sites_.

◆ removeSequence() [1/2]

Sequence* bpp::CompressedVectorSiteContainer::removeSequence ( size_t  sequenceIndex)
throw (IndexOutOfBoundsException,
NotImplementedException
)
inlinevirtual

Extract (and remove) a sequence from the container.

Parameters
sequenceIndexThe position of the sequence.
Exceptions
IndexOutOfBoundsExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 180 of file CompressedVectorSiteContainer.h.

◆ removeSequence() [2/2]

Sequence* bpp::CompressedVectorSiteContainer::removeSequence ( const std::string &  name)
throw (SequenceNotFoundException,
NotImplementedException
)
inlinevirtual

Extract (and remove) a sequence from the container.

Parameters
nameThe name of the sequence.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 186 of file CompressedVectorSiteContainer.h.

◆ removeSite()

Site * CompressedVectorSiteContainer::removeSite ( size_t  siteIndex)
throw (IndexOutOfBoundsException
)
virtual

Remove a site from the container.

The site is not deleted, a pointer toward it is returned.

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

Implements bpp::SiteContainer.

Definition at line 316 of file CompressedVectorSiteContainer.cpp.

◆ setComments() [1/2]

void AbstractSequenceContainer::setComments ( const std::string &  name,
const Comments comments 
)
throw (SequenceNotFoundException
)
virtualinherited

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::OrderedSequenceContainer.

Reimplemented in bpp::VectorSequenceContainer.

Definition at line 48 of file AbstractSequenceContainer.cpp.

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

◆ setComments() [2/2]

void CompressedVectorSiteContainer::setComments ( size_t  sequenceIndex,
const Comments comments 
)
throw (IndexOutOfBoundsException
)
virtual

Set the comments of a particular sequence.

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

Implements bpp::AbstractSequenceContainer.

Definition at line 559 of file CompressedVectorSiteContainer.cpp.

◆ setGeneralComments()

void bpp::AbstractSequenceContainer::setGeneralComments ( const Comments comments)
inlinevirtualinherited

◆ setSequence() [1/2]

void bpp::CompressedVectorSiteContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName 
)
throw (Exception,
NotImplementedException
)
inlinevirtual

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.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.
ExceptionAny other kind of exception, if the name of the sequence is already used, are whatever else depending on the implementation.

Implements bpp::OrderedSequenceContainer.

Definition at line 267 of file CompressedVectorSiteContainer.h.

◆ setSequence() [2/2]

void bpp::CompressedVectorSiteContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName 
)
throw (Exception,
NotImplementedException
)
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.
Exceptions
IndexOutOfBoundsExceptionIf the position does not match any sequence in the container.
ExceptionAny other kind of exception.

Implements bpp::OrderedSequenceContainer.

Definition at line 273 of file CompressedVectorSiteContainer.h.

◆ setSequencesNames()

void CompressedVectorSiteContainer::setSequencesNames ( const std::vector< std::string > &  names,
bool  checkNames = true 
)
throw (Exception
)
virtual

Set all sequence names.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 532 of file CompressedVectorSiteContainer.cpp.

◆ setSite()

void CompressedVectorSiteContainer::setSite ( size_t  siteIndex,
const Site site,
bool  checkPosition = false 
)
throw (Exception
)
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 239 of file CompressedVectorSiteContainer.cpp.

◆ toString() [1/2]

std::string bpp::AbstractSequenceContainer::toString ( const std::string &  name) const
throw (SequenceNotFoundException
)
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::OrderedSequenceContainer.

Definition at line 129 of file AbstractSequenceContainer.h.

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

◆ toString() [2/2]

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

Convert a particular sequence to a string.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 172 of file AbstractSequenceContainer.h.

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

◆ valueAt() [1/4]

int& bpp::CompressedVectorSiteContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
)
throw (SequenceNotFoundException,
IndexOutOfBoundsException
)
inlinevirtual

Element access function.

Allows direct access to the data stored in the container.

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.
Exceptions
SequenceNotFoundExceptionIf no corresponding sequence is found in the container.
IndexOutOfBoundsExceptionIf the element position is not valid.

Implements bpp::OrderedSequenceContainer.

Definition at line 214 of file CompressedVectorSiteContainer.h.

References getNumberOfSites(), getSequencePosition(), index_, and sites_.

◆ valueAt() [2/4]

const int& bpp::CompressedVectorSiteContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
) const
throw (SequenceNotFoundException,
IndexOutOfBoundsException
)
inlinevirtual

Element access function.

Allows direct access to the data stored in the container.

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.
Exceptions
SequenceNotFoundExceptionIf no corresponding sequence is found in the container.
IndexOutOfBoundsExceptionIf the element position is not valid.

Implements bpp::OrderedSequenceContainer.

Definition at line 219 of file CompressedVectorSiteContainer.h.

References getNumberOfSites(), getSequencePosition(), index_, and sites_.

◆ valueAt() [3/4]

int& bpp::CompressedVectorSiteContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
)
throw (IndexOutOfBoundsException
)
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container.

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.
Exceptions
IndexOutOfBoundsExceptionIf a position is not valid.

Implements bpp::OrderedSequenceContainer.

Definition at line 233 of file CompressedVectorSiteContainer.h.

References getNumberOfSequences(), getNumberOfSites(), index_, and sites_.

◆ valueAt() [4/4]

const int& bpp::CompressedVectorSiteContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
) const
throw (IndexOutOfBoundsException
)
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container.

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.
Exceptions
IndexOutOfBoundsExceptionIf a position is not valid.

Implements bpp::OrderedSequenceContainer.

Definition at line 239 of file CompressedVectorSiteContainer.h.

References getNumberOfSequences(), getNumberOfSites(), index_, and sites_.

Member Data Documentation

◆ comments_

std::vector<Comments*> bpp::CompressedVectorSiteContainer::comments_
protected

Definition at line 86 of file CompressedVectorSiteContainer.h.

Referenced by clear(), CompressedVectorSiteContainer(), and operator=().

◆ index_

std::vector<size_t> bpp::CompressedVectorSiteContainer::index_
protected

◆ names_

std::vector<std::string> bpp::CompressedVectorSiteContainer::names_
protected

◆ sequences_

std::vector<Sequence*> bpp::CompressedVectorSiteContainer::sequences_
mutableprotected

Definition at line 87 of file CompressedVectorSiteContainer.h.

Referenced by clear(), and operator=().

◆ sites_

std::vector<Site*> bpp::CompressedVectorSiteContainer::sites_
protected

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