bpp-seq  2.2.0
bpp::VectorSequenceContainer Class Reference

The VectorSequenceContainer class. More...

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

+ Inheritance diagram for bpp::VectorSequenceContainer:
+ Collaboration diagram for bpp::VectorSequenceContainer:

Public Member Functions

 VectorSequenceContainer (const std::vector< const Sequence *> &vs, const Alphabet *alpha) throw (AlphabetMismatchException)
 Build a new container from a std::vector of pointers toward sequence objects. More...
 
 VectorSequenceContainer (const Alphabet *alpha)
 Build an empty container that will contain sequences of a particular alphabet. More...
 
VectorSequenceContaineroperator= (const VectorSequenceContainer &vsc)
 Assign from a VectorSequenceContainer. More...
 
VectorSequenceContaineroperator= (const OrderedSequenceContainer &osc)
 Copy from an OrderedSequenceContainer. More...
 
VectorSequenceContaineroperator= (const SequenceContainer &osc)
 Copy from a SequenceContainer. More...
 
virtual ~VectorSequenceContainer ()
 Container destructor: delete all sequences in the container. More...
 
Copy contructors:
 VectorSequenceContainer (const VectorSequenceContainer &vsc)
 Copy from a VectorSequenceContainer. More...
 
 VectorSequenceContainer (const OrderedSequenceContainer &osc)
 Copy from an OrderedSequenceContainer. More...
 
 VectorSequenceContainer (const SequenceContainer &osc)
 Copy from a SequenceContainer. More...
 
The Clonable interface.
Clonable * clone () const
 
The SequenceContainer interface.
bool hasSequence (const std::string &name) const
 Check if a sequence with a given name is present in the container. More...
 
const SequencegetSequence (const std::string &name) const throw (SequenceNotFoundException)
 Retrieve a sequence object from the container. More...
 
void setSequence (const std::string &name, const Sequence &sequence, bool checkName=true) throw (Exception)
 Replace a sequence in the container. More...
 
SequenceremoveSequence (const std::string &name) throw (SequenceNotFoundException)
 Extract (and remove) a sequence from 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...
 
VectorSequenceContainercreateEmptyContainer () 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...
 
The OrderedSequenceContainer interface.
void setComments (const std::string &name, const Comments &comments) throw (SequenceNotFoundException)
 Set the comments of a particular sequence. More...
 
void setComments (size_t sequenceIndex, const Comments &comments) throw (IndexOutOfBoundsException)
 Set the comments of a particular sequence. More...
 
size_t getSequencePosition (const std::string &name) const throw (SequenceNotFoundException)
 Get the position of a sequence in sequence container from its name. More...
 
const SequencegetSequence (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Retrieve a sequence object from the container. More...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true) throw (Exception)
 Replace a sequence in the container. More...
 
SequenceremoveSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException)
 Extract (and remove) a sequence from the container. More...
 
void deleteSequence (size_t sequenceIndex) throw (IndexOutOfBoundsException)
 Delete a sequence of the container. More...
 
Add sequence to this container.
virtual void addSequence (const Sequence &sequence, bool checkName=true) throw (Exception)
 Add a sequence at the end of the container. More...
 
virtual void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true) throw (Exception)
 Add a sequence to the container at a particular position. 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...
 
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

AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i) throw (IndexOutOfBoundsException)
 
SequencegetSequence_ (const std::string &name) throw (SequenceNotFoundException)
 

Private Attributes

std::vector< Sequence * > sequences_
 A std::vector of pointers toward the sequences stored in the container. More...
 

Detailed Description

The VectorSequenceContainer class.

This is the simplest implementation of the OrderedSequenceContainer interface. Sequences are stored in a std::vector of pointers. The container is responsible for the creation and destruction of the sequence objects it contains.

Definition at line 63 of file VectorSequenceContainer.h.

Constructor & Destructor Documentation

◆ VectorSequenceContainer() [1/5]

VectorSequenceContainer::VectorSequenceContainer ( const std::vector< const Sequence *> &  vs,
const Alphabet alpha 
)
throw (AlphabetMismatchException
)

Build a new container from a std::vector of pointers toward sequence objects.

The addSequence() method is called uppon each Sequence object, hence each sequence is copied into the container.

Parameters
vsThe std::vector of pointers toward sequence objects.
alphaThe alphabet to all sequences.
Exceptions
AlphabetMismatchExceptionif one sequence does not match the specified alphabet.

Class constructors:

Definition at line 49 of file VectorSequenceContainer.cpp.

Referenced by clone(), and createEmptyContainer().

◆ VectorSequenceContainer() [2/5]

bpp::VectorSequenceContainer::VectorSequenceContainer ( const Alphabet alpha)
inline

Build an empty container that will contain sequences of a particular alphabet.

Parameters
alphaThe alphabet of the container.

Definition at line 94 of file VectorSequenceContainer.h.

◆ VectorSequenceContainer() [3/5]

VectorSequenceContainer::VectorSequenceContainer ( const VectorSequenceContainer vsc)

Copy from a VectorSequenceContainer.

Parameters
vscThe VectorSequenceContainer to copy into this container.

Copy constructors:

Definition at line 64 of file VectorSequenceContainer.cpp.

References addSequence(), getNumberOfSequences(), and getSequence().

◆ VectorSequenceContainer() [4/5]

VectorSequenceContainer::VectorSequenceContainer ( const OrderedSequenceContainer osc)

◆ VectorSequenceContainer() [5/5]

VectorSequenceContainer::VectorSequenceContainer ( const SequenceContainer osc)

◆ ~VectorSequenceContainer()

virtual bpp::VectorSequenceContainer::~VectorSequenceContainer ( )
inlinevirtual

Container destructor: delete all sequences in the container.

Definition at line 149 of file VectorSequenceContainer.h.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

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

Implements bpp::SequenceContainer.

Reimplemented in bpp::AlignedSequenceContainer.

Definition at line 284 of file VectorSequenceContainer.cpp.

Referenced by bpp::AlignedSequenceContainer::addSequence(), bpp::SequenceContainerTools::createContainerOfSpecifiedSize(), bpp::SequenceContainerTools::getCodonPosition(), operator=(), and VectorSequenceContainer().

◆ addSequence() [2/2]

void VectorSequenceContainer::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 in bpp::AlignedSequenceContainer.

Definition at line 307 of file VectorSequenceContainer.cpp.

◆ clear()

void VectorSequenceContainer::clear ( )
virtual

Delete all sequences in the container.

Implements bpp::SequenceContainer.

Definition at line 371 of file VectorSequenceContainer.cpp.

References sequences_.

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

◆ clone()

Clonable* bpp::VectorSequenceContainer::clone ( ) const
inline

Definition at line 158 of file VectorSequenceContainer.h.

References VectorSequenceContainer().

◆ createEmptyContainer()

VectorSequenceContainer * VectorSequenceContainer::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 391 of file VectorSequenceContainer.cpp.

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

◆ deleteGeneralComments()

void bpp::AbstractSequenceContainer::deleteGeneralComments ( )
inlinevirtualinherited

Delete the comments associated to this container.

Implements bpp::SequenceContainer.

Definition at line 150 of file AbstractSequenceContainer.h.

References bpp::AbstractSequenceContainer::comments_.

◆ deleteSequence() [1/2]

void bpp::VectorSequenceContainer::deleteSequence ( const std::string &  name)
throw (SequenceNotFoundException
)
inlinevirtual

Delete a sequence of the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 180 of file VectorSequenceContainer.h.

References getSequencePosition().

◆ deleteSequence() [2/2]

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

◆ getComments() [2/2]

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

Get comments of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 177 of file AbstractSequenceContainer.h.

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

◆ getContent() [1/2]

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

Get the content of a sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 124 of file AbstractSequenceContainer.h.

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

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

◆ getContent() [2/2]

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

Get the content of a sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 167 of file AbstractSequenceContainer.h.

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

◆ getGeneralComments()

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

◆ getName()

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

Get the name of a particular sequence.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 162 of file AbstractSequenceContainer.h.

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

Referenced by getSequencesNames(), and hasSequence().

◆ getNumberOfSequences()

size_t bpp::VectorSequenceContainer::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 185 of file VectorSequenceContainer.h.

References sequences_.

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

◆ getSequence() [1/2]

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

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

◆ getSequence() [2/2]

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

◆ getSequence_() [1/2]

Sequence & VectorSequenceContainer::getSequence_ ( size_t  i)
throw (IndexOutOfBoundsException
)
protected

Definition at line 194 of file VectorSequenceContainer.cpp.

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

◆ getSequence_() [2/2]

Sequence & VectorSequenceContainer::getSequence_ ( const std::string &  name)
throw (SequenceNotFoundException
)
protected

Definition at line 204 of file VectorSequenceContainer.cpp.

◆ getSequencePosition()

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

Referenced by deleteSequence(), removeSequence(), and setSequence().

◆ getSequencesNames()

std::vector< std::string > VectorSequenceContainer::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 332 of file VectorSequenceContainer.cpp.

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

◆ hasSequence()

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

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

◆ operator()() [1/4]

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

References getSequence_().

◆ operator()() [2/4]

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

References getSequence().

◆ operator()() [3/4]

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

References getSequence_().

◆ operator()() [4/4]

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

References getSequence().

◆ operator=() [1/3]

VectorSequenceContainer & VectorSequenceContainer::operator= ( const VectorSequenceContainer vsc)

Assign from a VectorSequenceContainer.

Parameters
vscThe VectorSequenceContainer to copy into this container.

Assignation operator:

Definition at line 105 of file VectorSequenceContainer.cpp.

References addSequence(), clear(), getNumberOfSequences(), getSequence(), and bpp::AbstractSequenceContainer::operator=().

Referenced by bpp::AlignedSequenceContainer::operator=().

◆ operator=() [2/3]

◆ operator=() [3/3]

VectorSequenceContainer & VectorSequenceContainer::operator= ( const SequenceContainer osc)

◆ removeSequence() [1/2]

Sequence* bpp::VectorSequenceContainer::removeSequence ( const std::string &  name)
throw (SequenceNotFoundException
)
inlinevirtual

Extract (and remove) a sequence from the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 175 of file VectorSequenceContainer.h.

References getSequencePosition().

◆ removeSequence() [2/2]

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

◆ setComments() [1/2]

void bpp::VectorSequenceContainer::setComments ( const std::string &  name,
const Comments comments 
)
throw (SequenceNotFoundException
)
inlinevirtual

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.

References bpp::AbstractSequenceContainer::setComments().

◆ setComments() [2/2]

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

◆ setGeneralComments()

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

◆ setSequence() [1/2]

void bpp::VectorSequenceContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName = true 
)
throw (Exception
)
inlinevirtual

Replace a sequence in the container.

Parameters
nameThe name of the sequence.
sequenceThe sequence to add.
checkNameTell if the container must check if the name of the sequence is already used in the container before adding it.
Exceptions
SequenceNotFoundExceptionIf the name does not match any sequence in the container.
ExceptionAny other kind of exception, if the name of the sequence is already used, are whatever else depending on the implementation.

Implements bpp::OrderedSequenceContainer.

Definition at line 170 of file VectorSequenceContainer.h.

References getSequencePosition().

Referenced by bpp::AlignedSequenceContainer::setSequence().

◆ setSequence() [2/2]

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

Implements bpp::OrderedSequenceContainer.

Definition at line 230 of file VectorSequenceContainer.cpp.

◆ setSequencesNames()

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

References getSequence_().

◆ valueAt() [2/4]

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

References getSequence().

◆ valueAt() [3/4]

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

References getSequence_().

◆ valueAt() [4/4]

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

References getSequence().

Member Data Documentation

◆ sequences_

std::vector<Sequence*> bpp::VectorSequenceContainer::sequences_
mutableprivate

A std::vector of pointers toward the sequences stored in the container.

Definition at line 71 of file VectorSequenceContainer.h.

Referenced by clear(), getNumberOfSequences(), getSequencesNames(), and hasSequence().


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