bpp-seq  2.1.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:

List of all members.

Public Member Functions

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

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_
 The container's 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::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().

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

Build a new empty container.

Parameters:
alphaThe alphabet for this container.

Definition at line 119 of file CompressedVectorSiteContainer.cpp.

Definition at line 126 of file CompressedVectorSiteContainer.h.

References clear().


Member Function Documentation

void bpp::CompressedVectorSiteContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
) throw (Exception, NotImplementedException) [inline, virtual]

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.

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.

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

void bpp::CompressedVectorSiteContainer::addSite ( const Site site,
int  position,
bool  checkPosition = false 
) throw (Exception) [inline, virtual]

Add a site in the container.

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

Implements bpp::SiteContainer.

Definition at line 148 of file CompressedVectorSiteContainer.h.

References addSite().

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.

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

Add a site in the container.

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

Implements bpp::SiteContainer.

Definition at line 153 of file CompressedVectorSiteContainer.h.

References addSite().

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

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

void bpp::AbstractSequenceContainer::deleteGeneralComments ( ) [inline, virtual, inherited]

Delete the comments associated to this container.

Implements bpp::SequenceContainer.

Definition at line 150 of file AbstractSequenceContainer.h.

References bpp::AbstractSequenceContainer::comments_.

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.

void bpp::CompressedVectorSiteContainer::deleteSequence ( const std::string &  name) throw (SequenceNotFoundException, NotImplementedException) [inline, virtual]

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.

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.

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.

const Comments& bpp::AbstractSequenceContainer::getComments ( const std::string &  name) const throw (SequenceNotFoundException) [inline, virtual, inherited]

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

virtual const Comments& bpp::AbstractSequenceContainer::getComments ( size_t  sequenceIndex) const throw (IndexOutOfBoundsException) [inline, virtual, inherited]

Get comments of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 177 of file AbstractSequenceContainer.h.

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

const std::vector<int>& bpp::AbstractSequenceContainer::getContent ( const std::string &  name) const throw (SequenceNotFoundException) [inline, virtual, inherited]

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

virtual const std::vector<int>& bpp::AbstractSequenceContainer::getContent ( size_t  sequenceIndex) const throw (IndexOutOfBoundsException) [inline, virtual, inherited]

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

const Comments& bpp::AbstractSequenceContainer::getGeneralComments ( ) const [inline, virtual, inherited]
virtual const std::string& bpp::AbstractSequenceContainer::getName ( size_t  sequenceIndex) const throw (IndexOutOfBoundsException) [inline, virtual, inherited]

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

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

size_t bpp::CompressedVectorSiteContainer::getNumberOfSites ( ) const [inline, virtual]

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

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.

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.

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

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_.

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

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

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_.

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_.

int& bpp::CompressedVectorSiteContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
) [inline, virtual]

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_.

const int& bpp::CompressedVectorSiteContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
) const [inline, virtual]

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_.

int& bpp::CompressedVectorSiteContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
) [inline, virtual]

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_.

const int& bpp::CompressedVectorSiteContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
) const [inline, virtual]

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_.

Set all positions attributes.

Implements bpp::SiteContainer.

Definition at line 416 of file CompressedVectorSiteContainer.cpp.

References sites_.

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.

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.

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.

void AbstractSequenceContainer::setComments ( const std::string &  name,
const Comments &  comments 
) throw (SequenceNotFoundException) [virtual, inherited]

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.

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.

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

Replace a sequence in the container.

Parameters:
nameThe name of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.
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.

void bpp::CompressedVectorSiteContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName 
) throw (Exception, NotImplementedException) [inline, virtual]

Replace a sequence in the container.

Parameters:
sequenceIndexThe position of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.
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.

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.

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.

std::string bpp::AbstractSequenceContainer::toString ( const std::string &  name) const throw (SequenceNotFoundException) [inline, virtual, inherited]

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

Referenced by bpp::VectorSiteContainer::VectorSiteContainer().

virtual std::string bpp::AbstractSequenceContainer::toString ( size_t  sequenceIndex) const throw (IndexOutOfBoundsException) [inline, virtual, inherited]

Convert a particular sequence to a string.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 172 of file AbstractSequenceContainer.h.

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

int& bpp::CompressedVectorSiteContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
) throw (SequenceNotFoundException, IndexOutOfBoundsException) [inline, virtual]

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

Definition at line 214 of file CompressedVectorSiteContainer.h.

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

const int& bpp::CompressedVectorSiteContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
) const throw (SequenceNotFoundException, IndexOutOfBoundsException) [inline, virtual]

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

Definition at line 219 of file CompressedVectorSiteContainer.h.

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

int& bpp::CompressedVectorSiteContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
) throw (IndexOutOfBoundsException) [inline, virtual]

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_.

const int& bpp::CompressedVectorSiteContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
) const throw (IndexOutOfBoundsException) [inline, virtual]

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

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

The container's comments.

Reimplemented from bpp::AbstractSequenceContainer.

Definition at line 86 of file CompressedVectorSiteContainer.h.

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

std::vector<Sequence*> bpp::CompressedVectorSiteContainer::sequences_ [mutable, protected]

Definition at line 87 of file CompressedVectorSiteContainer.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends