bpp-seq  2.2.0
bpp::MapSequenceContainer Class Reference

MapSequenceContainer class. More...

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

+ Inheritance diagram for bpp::MapSequenceContainer:
+ Collaboration diagram for bpp::MapSequenceContainer:

Public Member Functions

 MapSequenceContainer (const std::map< std::string, Sequence *> &ms, const Alphabet *alpha)
 
 MapSequenceContainer (const Alphabet *alpha)
 
 MapSequenceContainer (const MapSequenceContainer &msc)
 
MapSequenceContaineroperator= (const MapSequenceContainer &msc)
 
virtual ~MapSequenceContainer ()
 
const SequencegetSequenceByKey (const std::string &key) const throw (SequenceNotFoundException)
 Get a sequence. More...
 
void setSequenceByKey (const std::string &key, const Sequence &sequence, bool checkNames=true) throw (SequenceNotFoundException)
 Set a sequence. More...
 
SequenceremoveSequenceByKey (const std::string &key) throw (SequenceNotFoundException)
 Remove a sequence. More...
 
void deleteSequenceByKey (const std::string &key) throw (SequenceNotFoundException)
 Delete a sequence. More...
 
void addSequence (const std::string &key, const Sequence &sequence, bool checkNames=true) throw (Exception)
 Add a sequence and key. More...
 
std::vector< std::string > getKeys () const
 
std::string getKey (size_t pos) const throw (IndexOutOfBoundsException)
 
std::string getKey (const std::string &name) const throw (SequenceNotFoundException)
 
The clonable interface
MapSequenceContainerclone () const
 
The SequenceContainer interface implementation:
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...
 
void addSequence (const Sequence &sequence, bool checkNames=true) throw (Exception)
 The SequenceContainer method. Calls the addSeqeucne(key, Sequence) method while using the resut of sequence.getName() as a key. More...
 
void setSequence (const std::string &name, const Sequence &sequence, bool checkName=true) throw (SequenceNotFoundException)
 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...
 
void clear ()
 Delete all sequences in the container. More...
 
MapSequenceContainercreateEmptyContainer () 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 implementation:
const SequencegetSequence (size_t sequenceIndex) const throw (IndexOutOfBoundsException)
 Retrieve a sequence object from 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...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true) throw (IndexOutOfBoundsException)
 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...
 
void setComments (size_t sequenceIndex, const Comments &comments) throw (IndexOutOfBoundsException)
 Set the comments of a particular sequence. 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) throw (Exception)
 Set all sequence names. More...
 
AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i) throw (IndexOutOfBoundsException)
 
SequencegetSequence_ (const std::string &name) throw (SequenceNotFoundException)
 
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...
 

Private Attributes

std::map< std::string, Sequence * > sequences_
 

Detailed Description

MapSequenceContainer class.

Sequences are stored using a key std::string, in a map object. Sequences are ordered according to the key order (defined by the < operator).

Definition at line 63 of file MapSequenceContainer.h.

Constructor & Destructor Documentation

◆ MapSequenceContainer() [1/3]

MapSequenceContainer::MapSequenceContainer ( const std::map< std::string, Sequence *> &  ms,
const Alphabet alpha 
)

Definition at line 50 of file MapSequenceContainer.cpp.

References addSequence().

Referenced by clone(), and createEmptyContainer().

◆ MapSequenceContainer() [2/3]

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

Definition at line 71 of file MapSequenceContainer.h.

◆ MapSequenceContainer() [3/3]

MapSequenceContainer::MapSequenceContainer ( const MapSequenceContainer msc)

◆ ~MapSequenceContainer()

MapSequenceContainer::~MapSequenceContainer ( )
virtual

Definition at line 87 of file MapSequenceContainer.cpp.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

void MapSequenceContainer::addSequence ( const std::string &  key,
const Sequence sequence,
bool  checkNames = true 
)
throw (Exception
)

Add a sequence and key.

Parameters
keyThe key of the new sequence.
sequenceThe new sequence that will be associated to the key.
checkNamesTell is the sequence name must be checked.

Definition at line 344 of file MapSequenceContainer.cpp.

Referenced by addSequence(), MapSequenceContainer(), and operator=().

◆ addSequence() [2/2]

void bpp::MapSequenceContainer::addSequence ( const Sequence sequence,
bool  checkNames = true 
)
throw (Exception
)
inlinevirtual

The SequenceContainer method. Calls the addSeqeucne(key, Sequence) method while using the resut of sequence.getName() as a key.

Implements bpp::SequenceContainer.

Definition at line 166 of file MapSequenceContainer.h.

References addSequence(), and bpp::Sequence::getName().

◆ clear()

void MapSequenceContainer::clear ( )
virtual

Delete all sequences in the container.

Implements bpp::SequenceContainer.

Definition at line 447 of file MapSequenceContainer.cpp.

References sequences_.

Referenced by operator=(), and ~MapSequenceContainer().

◆ clone()

MapSequenceContainer* bpp::MapSequenceContainer::clone ( ) const
inline

Definition at line 149 of file MapSequenceContainer.h.

References MapSequenceContainer().

◆ createEmptyContainer()

MapSequenceContainer * MapSequenceContainer::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 458 of file MapSequenceContainer.cpp.

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

◆ 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 MapSequenceContainer::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 318 of file MapSequenceContainer.cpp.

◆ deleteSequence() [2/2]

void MapSequenceContainer::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 306 of file MapSequenceContainer.cpp.

◆ deleteSequenceByKey()

void MapSequenceContainer::deleteSequenceByKey ( const std::string &  key)
throw (SequenceNotFoundException
)

Delete a sequence.

Parameters
keyThe key of the sequence.
Exceptions
SequenceNotFoundExceptionIf no sequence is associated to the given key.

Definition at line 333 of file MapSequenceContainer.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

◆ getKey() [1/2]

string MapSequenceContainer::getKey ( size_t  pos) const
throw (IndexOutOfBoundsException
)
Returns
The key of a given sequence specified by its position in the container.
Parameters
posThe index of the sequence.
Exceptions
IndexOutOfBoundsExceptionIf pos is not a valid index.

Definition at line 380 of file MapSequenceContainer.cpp.

Referenced by MapSequenceContainer().

◆ getKey() [2/2]

string MapSequenceContainer::getKey ( const std::string &  name) const
throw (SequenceNotFoundException
)
Returns
The key of a given sequence specified by its name.
Parameters
nameThe name of the sequence.
Exceptions
SequenceNotFoundExceptionIf no sequence was found with the given name.

Definition at line 391 of file MapSequenceContainer.cpp.

References bpp::SequenceNotFoundException::getSequenceId().

◆ getKeys()

vector< string > MapSequenceContainer::getKeys ( ) const
Returns
All sequences keys.

Definition at line 370 of file MapSequenceContainer.cpp.

References sequences_.

Referenced by operator=().

◆ 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::MapSequenceContainer::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 173 of file MapSequenceContainer.h.

References sequences_.

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

◆ getSequence() [1/2]

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

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

◆ getSequence() [2/2]

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

◆ getSequence_() [1/2]

Sequence & MapSequenceContainer::getSequence_ ( size_t  i)
throw (IndexOutOfBoundsException
)

Definition at line 130 of file MapSequenceContainer.cpp.

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

◆ getSequence_() [2/2]

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

Definition at line 141 of file MapSequenceContainer.cpp.

◆ getSequenceByKey()

const Sequence & MapSequenceContainer::getSequenceByKey ( const std::string &  key) const
throw (SequenceNotFoundException
)

Get a sequence.

Parameters
keyThe key of the sequence to retrieve.
Returns
The sequence associated to the given key.
Exceptions
SequenceNotFoundExceptionIf no sequence is associated to the given key.

Definition at line 152 of file MapSequenceContainer.cpp.

◆ getSequencePosition()

size_t MapSequenceContainer::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 163 of file MapSequenceContainer.cpp.

◆ getSequencesNames()

vector< string > MapSequenceContainer::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 416 of file MapSequenceContainer.cpp.

References sequences_.

◆ hasSequence()

bool MapSequenceContainer::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 119 of file MapSequenceContainer.cpp.

References sequences_.

◆ operator()() [1/4]

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

References getSequence_().

◆ operator()() [2/4]

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

References getSequence().

◆ operator()() [3/4]

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

References getSequence_().

◆ operator()() [4/4]

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

References getSequence().

◆ operator=()

◆ removeSequence() [1/2]

Sequence * MapSequenceContainer::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 278 of file MapSequenceContainer.cpp.

◆ removeSequence() [2/2]

Sequence * MapSequenceContainer::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 265 of file MapSequenceContainer.cpp.

◆ removeSequenceByKey()

Sequence * MapSequenceContainer::removeSequenceByKey ( const std::string &  key)
throw (SequenceNotFoundException
)

Remove a sequence.

Parameters
keyThe key of the sequence.
Returns
The sequence previously associated to the given key.
Exceptions
SequenceNotFoundExceptionIf no sequence is associated to the given key.

Definition at line 293 of file MapSequenceContainer.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 MapSequenceContainer::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 405 of file MapSequenceContainer.cpp.

◆ setGeneralComments()

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

◆ setSequence() [1/2]

void MapSequenceContainer::setSequence ( const std::string &  name,
const Sequence sequence,
bool  checkName = true 
)
throw (SequenceNotFoundException
)
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 209 of file MapSequenceContainer.cpp.

◆ setSequence() [2/2]

void MapSequenceContainer::setSequence ( size_t  sequenceIndex,
const Sequence sequence,
bool  checkName = true 
)
throw (IndexOutOfBoundsException
)
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 179 of file MapSequenceContainer.cpp.

◆ setSequenceByKey()

void MapSequenceContainer::setSequenceByKey ( const std::string &  key,
const Sequence sequence,
bool  checkNames = true 
)
throw (SequenceNotFoundException
)

Set a sequence.

Parameters
keyThe key of the sequence.
sequenceThe new sequence that will be associated to the key.
checkNamesTell is the sequence name must be checked.
Exceptions
SequenceNotFoundExceptionIf no sequence is associated to the given key.

Definition at line 237 of file MapSequenceContainer.cpp.

◆ setSequencesNames()

void MapSequenceContainer::setSequencesNames ( const std::vector< std::string > &  names,
bool  checkNames 
)
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 426 of file MapSequenceContainer.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::MapSequenceContainer::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 177 of file MapSequenceContainer.h.

References getSequence_().

◆ valueAt() [2/4]

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

References getSequence().

◆ valueAt() [3/4]

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

References getSequence_().

◆ valueAt() [4/4]

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

References getSequence().

Member Data Documentation

◆ sequences_

std::map<std::string, Sequence*> bpp::MapSequenceContainer::sequences_
private

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