bpp-seq  2.1.0
bpp::AlignedSequenceContainer Class Reference

Aligned sequences container. More...

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

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

List of all members.

Public Member Functions

 AlignedSequenceContainer (const Alphabet *alpha)
 Build a new empty container with the specified alphabet.
 AlignedSequenceContainer (const AlignedSequenceContainer &asc)
 Copy constructor.
 AlignedSequenceContainer (const SiteContainer &sc)
 Convert any SiteContainer object into a AlignedSequenceContainer object.
 AlignedSequenceContainer (const OrderedSequenceContainer &osc) throw (SequenceNotAlignedException)
 Try to coerce an OrderedSequenceContainer object into an AlignedSequenceContainer object.
AlignedSequenceContaineroperator= (const AlignedSequenceContainer &asc)
AlignedSequenceContaineroperator= (const SiteContainer &sc)
AlignedSequenceContaineroperator= (const OrderedSequenceContainer &osc) throw (SequenceNotAlignedException)
 Copy from an OrderedSequenceContainer.
virtual ~AlignedSequenceContainer ()
The Clonable interface.
AlignedSequenceContainerclone () 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=true) 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, Exception)
 Delete a continuous range of sites in the container.
void addSite (const Site &site, bool checkPosition=true) throw (Exception)
 Add a site in the container.
void addSite (const Site &site, int position, bool checkPosition=true) throw (Exception)
 Add a site in the container.
void addSite (const Site &site, size_t siteIndex, bool checkPosition=true) throw (Exception)
 Add a site in the container.
void addSite (const Site &site, size_t siteIndex, int position, bool checkPosition=true) throw (Exception)
 Add a site in the container.
size_t getNumberOfSites () const
 Get the number of sites in the container.
Vint getSitePositions () const
 Get all position attributes of sites.
void reindexSites ()
 Set all positions attributes.
void clear ()
 Delete all sequences in the container.
AlignedSequenceContainercreateEmptyContainer () const
 Return a copy of this container, but with no sequence inside.
Redefinition of VectorSequenceContainer methods, to check for sequence lengths.
void setSequence (const std::string &name, const Sequence &sequence, bool checkName=true) throw (Exception)
 Replace a sequence in the container.
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true) throw (Exception)
 Replace a sequence in the container.
void addSequence (const Sequence &sequence, bool checkName=true) throw (Exception)
 Add a sequence at the end of the container.
void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true) throw (Exception)
 Add a sequence to the container at a particular position.
The SequenceContainer interface.
bool hasSequence (const std::string &name) const
 Check if a sequence with a given name is present in the container.
const SequencegetSequence (const std::string &name) const throw (SequenceNotFoundException)
 Retrieve a sequence object from the container.
SequenceremoveSequence (const std::string &name) throw (SequenceNotFoundException)
 Extract (and remove) a sequence from the container.
void deleteSequence (const std::string &name) throw (SequenceNotFoundException)
 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.
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 & 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() (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 & operator() (size_t sequenceIndex, size_t elementIndex)
 Element access operator.
const int & operator() (size_t sequenceIndex, size_t elementIndex) const
 Element access operator.
The OrderedSequenceContainer interface.
const SequencegetSequence (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Retrieve a sequence object from the container.
SequenceremoveSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException)
 Extract (and remove) a sequence from the container.
void deleteSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException)
 Delete a sequence of the container.
void setComments (const std::string &name, const Comments &comments) throw (SequenceNotFoundException)
 Set the comments of a particular sequence.
void setComments (size_t sequenceIndex, const Comments &comments) throw (IndexOutOfBoundsException)
 Set the comments of a particular sequence.
size_t getSequencePosition (const std::string &name) const throw (SequenceNotFoundException)
 Get the position of a sequence in sequence container from its name.
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.
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

bool checkSize_ (const Sequence &sequence)
 Check sequence's size before insertion in sequence container.
AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i) throw (IndexOutOfBoundsException)
SequencegetSequence_ (const std::string &name) throw (SequenceNotFoundException)

Private Attributes

std::vector< int > positions_
size_t length_
std::vector< Site * > sites_

Detailed Description

Aligned sequences container.

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

See VectorSiteContainer for an alternative implementation.

See also:
VectorSequenceContainer, Sequence, Site, VectorSiteContainer

Definition at line 68 of file AlignedSequenceContainer.h.


Constructor & Destructor Documentation

Build a new empty container with the specified alphabet.

Parameters:
alphaThe alphabet to use.

Definition at line 95 of file AlignedSequenceContainer.h.

References reindexSites().

Referenced by clone().

Copy constructor.

Parameters:
ascThe container to copy.

Definition at line 109 of file AlignedSequenceContainer.h.

Convert any SiteContainer object into a AlignedSequenceContainer object.

Parameters:
scThe container to copy.

Definition at line 121 of file AlignedSequenceContainer.h.

Try to coerce an OrderedSequenceContainer object into an AlignedSequenceContainer object.

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

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

Definition at line 54 of file AlignedSequenceContainer.cpp.

Class destructor:

Definition at line 121 of file AlignedSequenceContainer.cpp.


Member Function Documentation

void AlignedSequenceContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
) throw (Exception) [virtual]

Add a sequence at the end of the container.

The sequence is copied into the container. If checkNames is set to true, the method check if the name of the sequence is already used in the container, and sends an exception if it is the case. Otherwise, do not check the name: the method is hence faster, but use it at your own risks!

Parameters:
sequenceThe sequence to add.
checkNameTell if the method must check the name of the sequence before adding it.
Exceptions:
ExceptionIf the sequence couldn't be added to the container.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 472 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::addSequence().

Referenced by bpp::SiteContainerTools::alignNW().

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

Add a sequence to the container at a particular position.

The sequence is copied into the container. If checkName is set to true, the method check if the name of the sequence is already used in the container, and sends an exception if it is the case. Otherwise, do not check the name: the method is hence faster, but use it at your own risks!

Parameters:
sequenceThe sequence to add.
sequenceIndexThe position where to insert the new sequence. All the following sequences will be pushed.
checkNameTell if the method must check the name of the sequence before adding it.
Exceptions:
ExceptionIf the sequence couldn't be added to the container.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 489 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::addSequence().

void AlignedSequenceContainer::addSite ( const Site site,
bool  checkPosition = true 
) 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 269 of file AlignedSequenceContainer.cpp.

void AlignedSequenceContainer::addSite ( const Site site,
int  position,
bool  checkPosition = true 
) throw (Exception) [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 310 of file AlignedSequenceContainer.cpp.

void AlignedSequenceContainer::addSite ( const Site site,
size_t  siteIndex,
bool  checkPosition = true 
) 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 350 of file AlignedSequenceContainer.cpp.

void AlignedSequenceContainer::addSite ( const Site site,
size_t  siteIndex,
int  position,
bool  checkPosition = true 
) throw (Exception) [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 392 of file AlignedSequenceContainer.cpp.

bool bpp::AlignedSequenceContainer::checkSize_ ( const Sequence sequence) [inline, protected]

Check sequence's size before insertion in sequence container.

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

Definition at line 195 of file AlignedSequenceContainer.h.

References length_.

void AlignedSequenceContainer::clear ( ) [virtual]

Delete all sequences in the container.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 504 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::clear().

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.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 512 of file AlignedSequenceContainer.cpp.

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

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

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

References bpp::VectorSequenceContainer::getSequencePosition().

void VectorSequenceContainer::deleteSequence ( size_t  sequenceIndex) throw (IndexOutOfBoundsException) [virtual, inherited]

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 272 of file VectorSequenceContainer.cpp.

void AlignedSequenceContainer::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 220 of file AlignedSequenceContainer.cpp.

void AlignedSequenceContainer::deleteSites ( size_t  siteIndex,
size_t  length 
) throw (IndexOutOfBoundsException, Exception) [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 243 of file AlignedSequenceContainer.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 bpp::CompressedVectorSiteContainer::CompressedVectorSiteContainer(), bpp::VectorSiteContainer::operator=(), bpp::CompressedVectorSiteContainer::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().

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

size_t bpp::VectorSequenceContainer::getNumberOfSequences ( ) const [inline, virtual, inherited]

Get the number of sequences in the container.

Returns:
The number of sequences in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 185 of file VectorSequenceContainer.h.

References bpp::VectorSequenceContainer::sequences_.

Referenced by bpp::VectorSequenceContainer::operator=(), and bpp::VectorSequenceContainer::VectorSequenceContainer().

size_t bpp::AlignedSequenceContainer::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 168 of file AlignedSequenceContainer.h.

References length_.

Referenced by operator=().

const Sequence & VectorSequenceContainer::getSequence ( const std::string &  name) const throw (SequenceNotFoundException) [virtual, inherited]

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 181 of file VectorSequenceContainer.cpp.

Referenced by bpp::VectorSequenceContainer::operator()(), bpp::VectorSequenceContainer::operator=(), bpp::VectorSequenceContainer::valueAt(), and bpp::VectorSequenceContainer::VectorSequenceContainer().

const Sequence & VectorSequenceContainer::getSequence ( size_t  sequenceIndex) const throw (IndexOutOfBoundsException) [virtual, inherited]

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 158 of file VectorSequenceContainer.cpp.

Sequence & VectorSequenceContainer::getSequence_ ( const std::string &  name) throw (SequenceNotFoundException) [protected, inherited]

Definition at line 204 of file VectorSequenceContainer.cpp.

size_t VectorSequenceContainer::getSequencePosition ( const std::string &  name) const throw (SequenceNotFoundException) [virtual, inherited]

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 217 of file VectorSequenceContainer.cpp.

Referenced by bpp::VectorSequenceContainer::deleteSequence(), bpp::VectorSequenceContainer::removeSequence(), and bpp::VectorSequenceContainer::setSequence().

std::vector< std::string > VectorSequenceContainer::getSequencesNames ( ) const [virtual, inherited]

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 332 of file VectorSequenceContainer.cpp.

References bpp::AbstractSequenceContainer::getName(), and bpp::VectorSequenceContainer::sequences_.

const Site & AlignedSequenceContainer::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 133 of file AlignedSequenceContainer.cpp.

Get all position attributes of sites.

Returns:
A vector with all site positions.

Implements bpp::SiteContainer.

Definition at line 169 of file AlignedSequenceContainer.h.

References positions_.

Referenced by operator=().

bool VectorSequenceContainer::hasSequence ( const std::string &  name) const [virtual, inherited]

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 168 of file VectorSequenceContainer.cpp.

References bpp::AbstractSequenceContainer::getName(), and bpp::VectorSequenceContainer::sequences_.

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

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

References bpp::VectorSequenceContainer::getSequence_().

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

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

References bpp::VectorSequenceContainer::getSequence().

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

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

References bpp::VectorSequenceContainer::getSequence_().

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

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

References bpp::VectorSequenceContainer::getSequence().

AlignedSequenceContainer & AlignedSequenceContainer::operator= ( const AlignedSequenceContainer asc)
AlignedSequenceContainer & AlignedSequenceContainer::operator= ( const OrderedSequenceContainer osc) throw (SequenceNotAlignedException)

Copy from an OrderedSequenceContainer.

Parameters:
oscThe OrderedSequenceContainer to copy into this container.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 107 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::operator=().

Set all positions attributes.

Implements bpp::SiteContainer.

Definition at line 433 of file AlignedSequenceContainer.cpp.

Referenced by AlignedSequenceContainer().

Sequence* bpp::VectorSequenceContainer::removeSequence ( const std::string &  name) throw (SequenceNotFoundException) [inline, virtual, inherited]

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

References bpp::VectorSequenceContainer::getSequencePosition().

Sequence * VectorSequenceContainer::removeSequence ( size_t  sequenceIndex) throw (IndexOutOfBoundsException) [virtual, inherited]

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 258 of file VectorSequenceContainer.cpp.

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

References bpp::BasicSymbolList::deleteElement().

void bpp::VectorSequenceContainer::setComments ( const std::string &  name,
const Comments &  comments 
) throw (SequenceNotFoundException) [inline, 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.

Reimplemented from bpp::AbstractSequenceContainer.

Definition at line 238 of file VectorSequenceContainer.h.

void VectorSequenceContainer::setComments ( size_t  sequenceIndex,
const Comments &  comments 
) throw (IndexOutOfBoundsException) [virtual, inherited]

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 384 of file VectorSequenceContainer.cpp.

void AlignedSequenceContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName = true 
) throw (Exception) [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.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 459 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::setSequence().

void AlignedSequenceContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName = true 
) throw (Exception) [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.

Reimplemented from bpp::VectorSequenceContainer.

Definition at line 444 of file AlignedSequenceContainer.cpp.

References bpp::VectorSequenceContainer::setSequence().

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

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 344 of file VectorSequenceContainer.cpp.

void AlignedSequenceContainer::setSite ( size_t  siteIndex,
const Site site,
bool  checkPosition = true 
) 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 154 of file AlignedSequenceContainer.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::VectorSequenceContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
) throw (SequenceNotFoundException, IndexOutOfBoundsException) [inline, virtual, inherited]

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

References bpp::VectorSequenceContainer::getSequence_().

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

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

References bpp::VectorSequenceContainer::getSequence().

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

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

References bpp::VectorSequenceContainer::getSequence_().

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

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

References bpp::VectorSequenceContainer::getSequence().


Member Data Documentation

Definition at line 76 of file AlignedSequenceContainer.h.

Referenced by checkSize_(), and getNumberOfSites().

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

Definition at line 74 of file AlignedSequenceContainer.h.

Referenced by getSitePositions().

std::vector<Site*> bpp::AlignedSequenceContainer::sites_ [mutable, private]

This is used in order to implement the SiteContainer interface. A SiteContainer is expected to work on Site objects, but this class -- since it is a VectorSequenceContainer -- has its data sored as Sequence object. When the SiteContainer method getSite() is invoked it creates a new Site object and send the address of it. To avoid memory leaks, this object is put into a std::vector so that it can be destroyed when the container is destroyed.

Definition at line 87 of file AlignedSequenceContainer.h.


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