bpp-seq  2.1.0
bpp::VectorSiteContainer Class Reference

The VectorSiteContainer class. More...

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

+ Inheritance diagram for bpp::VectorSiteContainer:
+ Collaboration diagram for bpp::VectorSiteContainer:

List of all members.

Public Member Functions

 VectorSiteContainer (const std::vector< const Site * > &vs, const Alphabet *alpha, bool checkPositions=true) throw (Exception)
 Build a new container from a set of sites.
 VectorSiteContainer (size_t size, const Alphabet *alpha)
 Build a new empty container with specified size.
 VectorSiteContainer (const std::vector< std::string > &names, const Alphabet *alpha)
 Build a new empty container with specified sequence names.
 VectorSiteContainer (const Alphabet *alpha)
 Build a new empty container.
 VectorSiteContainer (const VectorSiteContainer &vsc)
 VectorSiteContainer (const SiteContainer &sc)
 VectorSiteContainer (const OrderedSequenceContainer &osc)
 VectorSiteContainer (const SequenceContainer &sc)
VectorSiteContaineroperator= (const VectorSiteContainer &vsc)
VectorSiteContaineroperator= (const SiteContainer &sc)
VectorSiteContaineroperator= (const OrderedSequenceContainer &osc)
VectorSiteContaineroperator= (const SequenceContainer &sc)
 Assignation operator from any SequenceContainer object.
virtual ~VectorSiteContainer ()
void addSequence (const Sequence &sequence, bool checkName=true) throw (Exception)
 Add a sequence to the container.
void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true) throw (Exception)
void setSequence (const std::string &name, const Sequence &sequence, bool checkName) throw (Exception)
 Replace a sequence in the container.
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName) throw (Exception)
 Replace a sequence in the container.
The Clonable interface.
VectorSiteContainerclone () 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)
 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.
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)
 Extract (and remove) a sequence from the container.
SequenceremoveSequence (const std::string &name) throw (SequenceNotFoundException)
 Extract (and remove) a sequence from the container.
void deleteSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException)
 Delete a sequence of 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.
void clear ()
 Delete all sequences in the container.
VectorSiteContainercreateEmptyContainer () 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

void realloc (size_t n)

Protected Attributes

std::vector< Site * > sites_
std::vector< std::string > names_
std::vector< Comments * > comments_
 The container's comments.
std::vector< Sequence * > sequences_

Detailed Description

The VectorSiteContainer class.

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

See AlignedSequenceContainer for an alternative implementation.

See also:
Sequence, Site, AlignedSequenceContainer

Definition at line 68 of file VectorSiteContainer.h.


Constructor & Destructor Documentation

VectorSiteContainer::VectorSiteContainer ( const std::vector< const Site * > &  vs,
const Alphabet alpha,
bool  checkPositions = true 
) throw (Exception)

Build a new container from a set of sites.

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

Class constructors:

Definition at line 52 of file VectorSiteContainer.cpp.

Referenced by clone(), and createEmptyContainer().

VectorSiteContainer::VectorSiteContainer ( 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 85 of file VectorSiteContainer.cpp.

References comments_, names_, and bpp::AbstractSequenceContainer::toString().

VectorSiteContainer::VectorSiteContainer ( 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 102 of file VectorSiteContainer.cpp.

References comments_, and names_.

Build a new empty container.

Parameters:
alphaThe alphabet for this container.

Definition at line 119 of file VectorSiteContainer.cpp.

virtual bpp::VectorSiteContainer::~VectorSiteContainer ( ) [inline, virtual]

Definition at line 122 of file VectorSiteContainer.h.

References clear().


Member Function Documentation

void VectorSiteContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
) throw (Exception) [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 690 of file VectorSiteContainer.cpp.

References bpp::TextTools::toString().

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

void VectorSiteContainer::addSequence ( const Sequence sequence,
size_t  sequenceIndex,
bool  checkName = true 
) throw (Exception)

Definition at line 730 of file VectorSiteContainer.cpp.

void VectorSiteContainer::addSite ( const Site site,
bool  checkPosition = true 
) throw (Exception) [virtual]
void VectorSiteContainer::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 392 of file VectorSiteContainer.cpp.

References bpp::Site::setPosition().

void VectorSiteContainer::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 421 of file VectorSiteContainer.cpp.

void VectorSiteContainer::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 454 of file VectorSiteContainer.cpp.

References bpp::Site::setPosition().

void VectorSiteContainer::clear ( ) [virtual]

Delete all sequences in the container.

Implements bpp::SequenceContainer.

Definition at line 769 of file VectorSiteContainer.cpp.

References comments_, names_, sequences_, and sites_.

Referenced by operator=(), realloc(), and ~VectorSiteContainer().

Implements bpp::SiteContainer.

Definition at line 130 of file VectorSiteContainer.h.

References VectorSiteContainer().

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 854 of file VectorSiteContainer.cpp.

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

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 VectorSiteContainer::deleteSequence ( size_t  sequenceIndex) throw (IndexOutOfBoundsException) [virtual]

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 660 of file VectorSiteContainer.cpp.

void VectorSiteContainer::deleteSequence ( const std::string &  name) throw (SequenceNotFoundException) [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 681 of file VectorSiteContainer.cpp.

void VectorSiteContainer::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 340 of file VectorSiteContainer.cpp.

void VectorSiteContainer::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 350 of file VectorSiteContainer.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(), operator=(), bpp::CompressedVectorSiteContainer::operator=(), and 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().

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

Get the number of sequences in the container.

Returns:
The number of sequences in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 176 of file VectorSiteContainer.h.

References names_.

Referenced by bpp::SequenceApplicationTools::getSiteContainer(), operator=(), valueAt(), and VectorSiteContainer().

size_t VectorSiteContainer::getNumberOfSites ( ) const [virtual]

Get the number of sites in the container.

Returns:
The number of sites in the container.

Implements bpp::SiteContainer.

Definition at line 487 of file VectorSiteContainer.cpp.

References sites_.

Referenced by bpp::SequenceApplicationTools::getSiteContainer(), operator=(), valueAt(), and VectorSiteContainer().

const Sequence & VectorSiteContainer::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 517 of file VectorSiteContainer.cpp.

Referenced by bpp::SequenceApplicationTools::getSiteContainer().

const Sequence & VectorSiteContainer::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 537 of file VectorSiteContainer.cpp.

size_t VectorSiteContainer::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 559 of file VectorSiteContainer.cpp.

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

vector< string > VectorSiteContainer::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 813 of file VectorSiteContainer.cpp.

References names_.

Referenced by operator=().

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

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

Get all position attributes of sites.

Returns:
A vector with all site positions.

Implements bpp::SiteContainer.

Definition at line 505 of file VectorSiteContainer.cpp.

References sites_.

bool VectorSiteContainer::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 546 of file VectorSiteContainer.cpp.

References names_.

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

References getSequencePosition(), and sites_.

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

References getSequencePosition(), and sites_.

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

References sites_.

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

References sites_.

VectorSiteContainer & VectorSiteContainer::operator= ( const SequenceContainer sc)

Assignation operator from any SequenceContainer object.

Parameters:
scAnother sequence container.

Reimplemented from bpp::AbstractSequenceContainer.

Definition at line 273 of file VectorSiteContainer.cpp.

References addSequence(), clear(), bpp::SequenceContainer::getSequence(), bpp::SequenceContainer::getSequencesNames(), operator=(), and reindexSites().

void VectorSiteContainer::realloc ( size_t  n) [protected]

Set all positions attributes.

Implements bpp::SiteContainer.

Definition at line 494 of file VectorSiteContainer.cpp.

References sites_.

Referenced by operator=(), realloc(), and VectorSiteContainer().

Sequence * VectorSiteContainer::removeSequence ( size_t  sequenceIndex) throw (IndexOutOfBoundsException) [virtual]

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 625 of file VectorSiteContainer.cpp.

References bpp::SymbolList::deleteElement().

Sequence * VectorSiteContainer::removeSequence ( const std::string &  name) throw (SequenceNotFoundException) [virtual]

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 651 of file VectorSiteContainer.cpp.

Site * VectorSiteContainer::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 329 of file VectorSiteContainer.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 VectorSiteContainer::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 847 of file VectorSiteContainer.cpp.

void VectorSiteContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName 
) 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.

Implements bpp::OrderedSequenceContainer.

Definition at line 572 of file VectorSiteContainer.cpp.

void VectorSiteContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName 
) 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.

Implements bpp::OrderedSequenceContainer.

Definition at line 581 of file VectorSiteContainer.cpp.

void VectorSiteContainer::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 820 of file VectorSiteContainer.cpp.

Referenced by bpp::SiteContainerTools::getCompleteSites(), bpp::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSitesWithoutGaps(), operator=(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::removeStopCodonSites(), and bpp::SiteContainerTools::resolveDottedAlignment().

void VectorSiteContainer::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 299 of file VectorSiteContainer.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 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::VectorSiteContainer::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 186 of file VectorSiteContainer.h.

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

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

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

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

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

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

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


Member Data Documentation

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

The container's comments.

Reimplemented from bpp::AbstractSequenceContainer.

Definition at line 77 of file VectorSiteContainer.h.

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

std::vector<std::string> bpp::VectorSiteContainer::names_ [protected]
std::vector<Sequence*> bpp::VectorSiteContainer::sequences_ [mutable, protected]

Definition at line 78 of file VectorSiteContainer.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