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

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

Protected Member Functions

void realloc (size_t n)
 

Protected Attributes

std::vector< Site * > sites_
 
std::vector< std::string > names_
 
std::vector< Comments * > 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() [1/8]

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() [2/8]

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_, and names_.

◆ VectorSiteContainer() [3/8]

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

◆ VectorSiteContainer() [4/8]

VectorSiteContainer::VectorSiteContainer ( const Alphabet alpha)

Build a new empty container.

Parameters
alphaThe alphabet for this container.

Definition at line 119 of file VectorSiteContainer.cpp.

◆ VectorSiteContainer() [5/8]

VectorSiteContainer::VectorSiteContainer ( const VectorSiteContainer vsc)

◆ VectorSiteContainer() [6/8]

◆ VectorSiteContainer() [7/8]

◆ VectorSiteContainer() [8/8]

VectorSiteContainer::VectorSiteContainer ( const SequenceContainer sc)

◆ ~VectorSiteContainer()

virtual bpp::VectorSiteContainer::~VectorSiteContainer ( )
inlinevirtual

Definition at line 122 of file VectorSiteContainer.h.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

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.

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

◆ addSequence() [2/2]

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

Definition at line 730 of file VectorSiteContainer.cpp.

◆ addSite() [1/4]

void VectorSiteContainer::addSite ( const Site site,
bool  checkPosition = true 
)
throw (Exception
)
virtual

◆ addSite() [2/4]

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

◆ addSite() [3/4]

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.

◆ addSite() [4/4]

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

◆ clear()

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

◆ clone()

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

Implements bpp::SiteContainer.

Definition at line 130 of file VectorSiteContainer.h.

References VectorSiteContainer().

◆ createEmptyContainer()

VectorSiteContainer * VectorSiteContainer::createEmptyContainer ( ) const
virtual

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

This method creates a new SequenceContainer objet. The class of this container depends on the derivative class.

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

Implements bpp::SequenceContainer.

Definition at line 854 of file VectorSiteContainer.cpp.

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

◆ deleteGeneralComments()

void bpp::AbstractSequenceContainer::deleteGeneralComments ( )
inlinevirtualinherited

Delete the comments associated to this container.

Implements bpp::SequenceContainer.

Definition at line 150 of file AbstractSequenceContainer.h.

References bpp::AbstractSequenceContainer::comments_.

◆ deleteSequence() [1/2]

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

◆ deleteSequence() [2/2]

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.

◆ deleteSite()

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.

◆ deleteSites()

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.

◆ getAlphabet()

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

◆ getComments() [1/2]

const Comments& bpp::AbstractSequenceContainer::getComments ( const std::string &  name) const
throw (SequenceNotFoundException
)
inlinevirtualinherited

Get comments of a particular sequence.

Parameters
nameThe name of the sequence.
Returns
The comments associated to sequence with name 'name'.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 134 of file AbstractSequenceContainer.h.

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

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

◆ getComments() [2/2]

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

Get comments of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 177 of file AbstractSequenceContainer.h.

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

◆ getContent() [1/2]

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

Get the content of a sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 124 of file AbstractSequenceContainer.h.

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

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

◆ getContent() [2/2]

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

Get the content of a sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 167 of file AbstractSequenceContainer.h.

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

◆ getGeneralComments()

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

◆ getName()

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

Get the name of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 162 of file AbstractSequenceContainer.h.

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

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

◆ getNumberOfSequences()

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

Get the number of sequences in the container.

Returns
The number of sequences in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 176 of file VectorSiteContainer.h.

References names_.

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

◆ getNumberOfSites()

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

◆ getSequence() [1/2]

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

◆ getSequence() [2/2]

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.

◆ getSequencePosition()

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

◆ getSequencesNames()

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

◆ getSite()

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

◆ getSitePositions()

Vint VectorSiteContainer::getSitePositions ( ) const
virtual

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

◆ hasSequence()

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

◆ operator()() [1/4]

int& bpp::VectorSiteContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
)
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.

Implements bpp::SequenceContainer.

Definition at line 196 of file VectorSiteContainer.h.

References getSequencePosition(), and sites_.

◆ operator()() [2/4]

const int& bpp::VectorSiteContainer::operator() ( const std::string &  sequenceName,
size_t  elementIndex 
) const
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceNameThe sequence name.
elementIndexThe element position within the sequence.

Implements bpp::SequenceContainer.

Definition at line 200 of file VectorSiteContainer.h.

References getSequencePosition(), and sites_.

◆ operator()() [3/4]

int& bpp::VectorSiteContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
)
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 217 of file VectorSiteContainer.h.

References sites_.

◆ operator()() [4/4]

const int& bpp::VectorSiteContainer::operator() ( size_t  sequenceIndex,
size_t  elementIndex 
) const
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container. This method is faster then the valueAt function, but input parameters are not checked!

Parameters
sequenceIndexThe sequence position.
elementIndexThe element position within the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 221 of file VectorSiteContainer.h.

References sites_.

◆ operator=() [1/4]

◆ operator=() [2/4]

◆ operator=() [3/4]

◆ operator=() [4/4]

◆ realloc()

void VectorSiteContainer::realloc ( size_t  n)
protected

◆ reindexSites()

void VectorSiteContainer::reindexSites ( )
virtual

Set all positions attributes.

Implements bpp::SiteContainer.

Definition at line 494 of file VectorSiteContainer.cpp.

References sites_.

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

◆ removeSequence() [1/2]

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

◆ removeSequence() [2/2]

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.

◆ removeSite()

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.

◆ setComments() [1/2]

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

Set the comments of a particular sequence.

Parameters
nameThe name of the sequence.
commentsThe comments to set to sequence with name 'name'.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Reimplemented in bpp::VectorSequenceContainer.

Definition at line 48 of file AbstractSequenceContainer.cpp.

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

◆ setComments() [2/2]

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

◆ setGeneralComments()

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

◆ setSequence() [1/2]

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.

◆ setSequence() [2/2]

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.

◆ setSequencesNames()

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

◆ setSite()

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.

◆ toString() [1/2]

std::string bpp::AbstractSequenceContainer::toString ( const std::string &  name) const
throw (SequenceNotFoundException
)
inlinevirtualinherited

Convert a particular sequence to a string.

Parameters
nameThe name of the sequence.
Returns
A string describing the content of the sequence.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.

Implements bpp::OrderedSequenceContainer.

Definition at line 129 of file AbstractSequenceContainer.h.

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

◆ toString() [2/2]

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

Convert a particular sequence to a string.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 172 of file AbstractSequenceContainer.h.

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

◆ valueAt() [1/4]

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

Element access function.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 186 of file VectorSiteContainer.h.

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

◆ valueAt() [2/4]

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

Element access function.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 191 of file VectorSiteContainer.h.

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

◆ valueAt() [3/4]

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

Element access operator.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 205 of file VectorSiteContainer.h.

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

◆ valueAt() [4/4]

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

Element access operator.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 211 of file VectorSiteContainer.h.

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

Member Data Documentation

◆ comments_

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

Definition at line 77 of file VectorSiteContainer.h.

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

◆ names_

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

◆ sequences_

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

Definition at line 78 of file VectorSiteContainer.h.

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

◆ sites_

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

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