bpp-seq3  3.0.0
bpp::MapSequenceContainer Class Referenceabstract

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
 Get a sequence. More...
 
void setSequenceByKey (const std::string &key, const Sequence &sequence, bool checkNames=true)
 Set a sequence. More...
 
SequenceremoveSequenceByKey (const std::string &key)
 Remove a sequence. More...
 
void deleteSequenceByKey (const std::string &key)
 Delete a sequence. More...
 
void addSequence (const std::string &key, const Sequence &sequence, bool checkNames=true)
 Add a sequence and key. More...
 
std::vector< std::string > getKeys () const
 
std::string getKey (size_t pos) const
 
std::string getKey (const std::string &name) const
 
std::string toString (const std::string &name) const
 Convert a particular sequence to a string. More...
 
const CommentsgetComments (const std::string &name) const
 Get comments of a particular sequence. More...
 
const CommentsgetComments () const
 Get the comments. More...
 
void setComments (const std::string &name, const Comments &comments)
 Set the comments of a particular sequence. More...
 
void setComments (const Comments &comments)
 Set the comments. More...
 
virtual const AlphabetgetAlphabet () const =0
 Get container's alphabet. More...
 
virtual double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const=0
 get value of a state in a position More...
 
virtual const CommentsgetGeneralComments () const =0
 Get the comments of this container. More...
 
virtual void setGeneralComments (const Comments &comments)=0
 Set the comments of this container. More...
 
virtual void deleteGeneralComments ()=0
 Delete the comments associated to this container. More...
 
void clearComments ()
 
The clonable interface
MapSequenceContainerclone () const
 
The SequenceContainer interface implementation:
const SequencegetSequence (const std::string &name) const
 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)
 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)
 Replace a sequence in the container. More...
 
SequenceremoveSequence (const std::string &name)
 Extract (and remove) a sequence from the container. More...
 
void deleteSequence (const std::string &name)
 
size_t getNumberOfSequences () const
 Get the number of sequences in the container. More...
 
void clear ()
 Delete all data in the container. More...
 
MapSequenceContainercreateEmptyContainer () const
 Return a copy of this container, but with no data inside. More...
 
int & valueAt (const std::string &sequenceName, size_t elementIndex)
 Element access function. More...
 
const int & valueAt (const std::string &sequenceName, size_t elementIndex) const
 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)
 Element access operator. More...
 
const int & valueAt (size_t sequenceIndex, size_t elementIndex) const
 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
 Retrieve a sequence object from the container. More...
 
size_t getSequencePosition (const std::string &name) const
 Get the position of a sequence in sequence container from its name. More...
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName=true)
 Replace a sequence in the container. More...
 
SequenceremoveSequence (size_t sequenceIndex)
 Extract (and remove) a sequence from the container. More...
 
void deleteSequence (size_t sequenceIndex)
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
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)
 Set all sequence names. More...
 
AbstractSequenceContainer methods.
SequencegetSequence_ (size_t i)
 
SequencegetSequence_ (const std::string &name)
 
SequencedValuesContainer methods.
double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const
 get value of a state in a position More...
 
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
OrderedValuesContainer methods.
double getStateValueAt (size_t siteIndex, size_t sequenceIndex, int state) const
 
double operator() (size_t siteIndex, size_t sequenceIndex, int state) const
 
From the OrderedSequenceContainer interface
virtual std::string toString (size_t sequenceIndex) const
 
virtual const CommentsgetComments (size_t sequenceIndex) const
 
virtual const std::string & getName (size_t sequenceIndex) const
 Get the name of a particular row of the alignement (aka sequence). More...
 
SequenceContainer methods.
virtual std::string toString (size_t sequenceIndex) const=0
 
virtual const CommentsgetComments (size_t sequenceIndex) const=0
 
virtual void setComments (size_t sequenceIndex, const Comments &comments)=0
 
From the SequencedValuesContainer interface
const AlphabetgetAlphabet () const
 Get container's alphabet. 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...
 

Protected Attributes

const Alphabetalphabet_
 The container's alphabet. More...
 
Comments comments_
 

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 52 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 91 of file MapSequenceContainer.cpp.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

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

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

Implements bpp::SequencedValuesContainer.

Definition at line 160 of file MapSequenceContainer.h.

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

◆ addSequence() [2/2]

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

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 367 of file MapSequenceContainer.cpp.

References bpp::Sequence::clone(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::Sequence::getName(), and sequences_.

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

◆ clear()

void MapSequenceContainer::clear ( )
virtual

Delete all data in the container.

Implements bpp::SequencedValuesContainer.

Definition at line 488 of file MapSequenceContainer.cpp.

References sequences_.

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

◆ clearComments()

◆ clone()

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

Implements bpp::OrderedValuesContainer.

Definition at line 143 of file MapSequenceContainer.h.

References MapSequenceContainer().

◆ createEmptyContainer()

MapSequenceContainer * MapSequenceContainer::createEmptyContainer ( ) const
virtual

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

This method creates a new SequencedValuesContainer 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::SequencedValuesContainer.

Definition at line 501 of file MapSequenceContainer.cpp.

References bpp::AbstractValuesContainer::getAlphabet(), and MapSequenceContainer().

◆ deleteGeneralComments() [1/2]

void bpp::AbstractValuesContainer::deleteGeneralComments ( )
inlinevirtualinherited

Delete the comments associated to this container.

Implements bpp::SequencedValuesContainer.

Definition at line 115 of file AbstractValuesContainer.h.

References bpp::Commentable::clearComments().

◆ deleteGeneralComments() [2/2]

virtual void bpp::SequencedValuesContainer::deleteGeneralComments ( )
pure virtualinherited

Delete the comments associated to this container.

Implemented in bpp::AbstractValuesContainer, and bpp::AbstractProbabilisticSequenceContainer.

◆ deleteSequence() [1/2]

void MapSequenceContainer::deleteSequence ( const std::string &  name)

Definition at line 340 of file MapSequenceContainer.cpp.

References sequences_.

◆ deleteSequence() [2/2]

void MapSequenceContainer::deleteSequence ( size_t  sequenceIndex)

Definition at line 325 of file MapSequenceContainer.cpp.

References sequences_.

◆ deleteSequenceByKey()

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

Delete a sequence.

Parameters
keyThe key of the sequence.

Definition at line 356 of file MapSequenceContainer.cpp.

References sequences_.

◆ getAlphabet() [1/2]

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

Get container's alphabet.

Returns
The alphabet associated to this container.

Implements bpp::SequencedValuesContainer.

Definition at line 99 of file AbstractValuesContainer.h.

References bpp::AbstractValuesContainer::alphabet_.

Referenced by bpp::VectorSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), addSequence(), bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::CompressedVectorSiteContainer::addSite(), bpp::AlignedSequenceContainer::addSite(), bpp::VectorSiteContainer::addSite(), bpp::Pasta::appendSequencesFromStream(), bpp::VectorProbabilisticSiteContainer::appendSite(), bpp::CompressedVectorSiteContainer::CompressedVectorSiteContainer(), bpp::AlignedSequenceContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::createEmptyContainer(), createEmptyContainer(), bpp::VectorProbabilisticSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::getSequence(), bpp::VectorSiteContainer::getSequence(), bpp::VectorProbabilisticSiteContainer::getSequence(), bpp::AlignedSequenceContainer::getSite(), bpp::CompressedVectorSiteContainer::getStateValueAt(), bpp::VectorSiteContainer::getStateValueAt(), getStateValueAt(), bpp::VectorSequenceContainer::getStateValueAt(), bpp::CompressedVectorSiteContainer::operator()(), bpp::VectorSiteContainer::operator()(), operator()(), bpp::VectorSequenceContainer::operator()(), bpp::CompressedVectorSiteContainer::operator=(), bpp::VectorSiteContainer::realloc(), bpp::VectorSiteContainer::setSequence(), setSequence(), bpp::VectorSequenceContainer::setSequence(), setSequenceByKey(), bpp::AlignedSequenceContainer::setSite(), bpp::CompressedVectorSiteContainer::setSite(), and bpp::VectorSiteContainer::setSite().

◆ getAlphabet() [2/2]

virtual const Alphabet* bpp::SequencedValuesContainer::getAlphabet ( ) const
pure virtualinherited

Get container's alphabet.

Returns
The alphabet associated to this container.

Implemented in bpp::AbstractValuesContainer.

Referenced by bpp::Clustal::appendAlignmentFromStream(), bpp::DCSE::appendAlignmentFromStream(), bpp::NexusIOSequence::appendAlignmentFromStream(), bpp::Fasta::appendSequencesFromStream(), bpp::GenBank::appendSequencesFromStream(), bpp::Mase::appendSequencesFromStream(), bpp::SiteContainerTools::changeGapsToUnknownCharacters(), bpp::SiteContainerTools::changeUnresolvedCharactersToGaps(), bpp::SequenceContainerTools::convertAlphabet(), bpp::SequenceContainerTools::getCodonPosition(), bpp::SiteContainerTools::getCompleteSites(), bpp::SiteContainerTools::getConsensus(), bpp::SequenceContainerTools::getFrequencies(), bpp::SiteContainerTools::getSelectedPositions(), bpp::MaseTools::getSelectedSequences(), bpp::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceApplicationTools::getSitesToAnalyse(), bpp::SiteContainerTools::getSitesWithoutGaps(), bpp::SequenceContainerTools::merge(), bpp::SiteContainerTools::merge(), bpp::AbstractSequenceContainer::operator=(), bpp::Phylip::readInterleaved(), bpp::Phylip::readSequential(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::removeStopCodonSites(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::SiteContainerTools::sampleSites(), bpp::VectorProbabilisticSiteContainer::VectorProbabilisticSiteContainer(), bpp::VectorSiteContainer::VectorSiteContainer(), bpp::Pasta::writeAlignedValues(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().

◆ getComments() [1/4]

◆ getComments() [2/4]

const Comments& bpp::AbstractSequenceContainer::getComments ( const std::string &  name) const
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 111 of file AbstractSequenceContainer.h.

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

◆ getComments() [3/4]

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

◆ getComments() [4/4]

virtual const Comments& bpp::OrderedValuesContainer::getComments
inherited

◆ getGeneralComments() [1/2]

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

◆ getGeneralComments() [2/2]

◆ getKey() [1/2]

string MapSequenceContainer::getKey ( const std::string &  name) const
Returns
The key of a given sequence specified by its name.
Parameters
nameThe name of the sequence.

Definition at line 422 of file MapSequenceContainer.cpp.

References getKey(), bpp::SequenceNotFoundException::getSequenceId(), and getSequencePosition().

◆ getKey() [2/2]

string MapSequenceContainer::getKey ( size_t  pos) const
Returns
The key of a given sequence specified by its position in the container.
Parameters
posThe index of the sequence.

Definition at line 408 of file MapSequenceContainer.cpp.

References getNumberOfSequences(), and sequences_.

Referenced by getKey(), MapSequenceContainer(), and setSequence().

◆ getKeys()

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

Definition at line 396 of file MapSequenceContainer.cpp.

References sequences_.

Referenced by operator=().

◆ getName()

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

Get the name of a particular row of the alignement (aka 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::OrderedValuesContainer.

Definition at line 127 of file AbstractSequenceContainer.h.

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

Referenced by bpp::CompressedVectorSiteContainer::getSequence().

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

References sequences_.

Referenced by getKey(), getStateValueAt(), MapSequenceContainer(), operator=(), setComments(), and setSequencesNames().

◆ getSequence() [1/2]

const Sequence & MapSequenceContainer::getSequence ( const std::string &  name) const
virtual

Retrieve a sequence object from the container.

Parameters
nameThe name of the sequence.
Returns
A reference toward the Sequence with corresponding name.

Implements bpp::OrderedSequenceContainer.

Definition at line 115 of file MapSequenceContainer.cpp.

References sequences_.

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

◆ getSequence() [2/2]

const Sequence & MapSequenceContainer::getSequence ( size_t  sequenceIndex) const
virtual

Retrieve a sequence object from the container.

Parameters
sequenceIndexThe position of the sequence.
Returns
A reference toward the Sequence object with corresponding name.

Implements bpp::OrderedSequenceContainer.

Definition at line 98 of file MapSequenceContainer.cpp.

References sequences_.

◆ getSequence_() [1/2]

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

Definition at line 155 of file MapSequenceContainer.cpp.

References sequences_.

◆ getSequence_() [2/2]

Sequence & MapSequenceContainer::getSequence_ ( size_t  i)

Definition at line 141 of file MapSequenceContainer.cpp.

References sequences_.

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

◆ getSequenceByKey()

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

Get a sequence.

Parameters
keyThe key of the sequence to retrieve.
Returns
The sequence associated to the given key.

Definition at line 168 of file MapSequenceContainer.cpp.

References sequences_.

◆ getSequencePosition()

size_t MapSequenceContainer::getSequencePosition ( const std::string &  name) const
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::OrderedValuesContainer.

Definition at line 178 of file MapSequenceContainer.cpp.

References sequences_.

Referenced by getKey().

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

References sequences_.

◆ getStateValueAt() [1/3]

double bpp::MapSequenceContainer::getStateValueAt ( size_t  siteIndex,
const std::string &  sequenceName,
int  state 
) const
inlinevirtual

get value of a state in a position

Parameters
siteIndexindex of the site
sequenceNamename of the sequence in the container
statestate in the alphabet

Implements bpp::SequencedValuesContainer.

Definition at line 235 of file MapSequenceContainer.h.

References getSequence(), and bpp::CruxSymbolList::getStateValueAt().

◆ getStateValueAt() [2/3]

virtual double bpp::SequencedValuesContainer::getStateValueAt
inherited

get value of a state in a position

Parameters
siteIndexindex of the site
sequenceNamename of the sequence in the container
statestate in the alphabet

◆ getStateValueAt() [3/3]

double bpp::MapSequenceContainer::getStateValueAt ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlinevirtual

◆ 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::SequencedValuesContainer.

Definition at line 128 of file MapSequenceContainer.cpp.

References sequences_.

◆ operator()() [1/6]

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 179 of file MapSequenceContainer.h.

References getSequence_().

◆ operator()() [2/6]

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 183 of file MapSequenceContainer.h.

References getSequence().

◆ operator()() [3/6]

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 196 of file MapSequenceContainer.h.

References getSequence_().

◆ operator()() [4/6]

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 200 of file MapSequenceContainer.h.

References getSequence().

◆ operator()() [5/6]

double bpp::MapSequenceContainer::operator() ( size_t  siteIndex,
const std::string &  sequenceName,
int  state 
) const
inlinevirtual

Implements bpp::SequencedValuesContainer.

Definition at line 240 of file MapSequenceContainer.h.

References getSequence().

◆ operator()() [6/6]

double bpp::MapSequenceContainer::operator() ( size_t  siteIndex,
size_t  sequenceIndex,
int  state 
) const
inlinevirtual

◆ operator=()

◆ removeSequence() [1/2]

Sequence * MapSequenceContainer::removeSequence ( const std::string &  name)
virtual

Extract (and remove) a sequence from the container.

Parameters
nameThe name of the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 296 of file MapSequenceContainer.cpp.

References sequences_.

◆ removeSequence() [2/2]

Sequence * MapSequenceContainer::removeSequence ( size_t  sequenceIndex)
virtual

Extract (and remove) a sequence from the container.

Parameters
sequenceIndexThe position of the sequence.

Implements bpp::OrderedSequenceContainer.

Definition at line 280 of file MapSequenceContainer.cpp.

References sequences_.

◆ removeSequenceByKey()

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

Remove a sequence.

Parameters
keyThe key of the sequence.
Returns
The sequence previously associated to the given key.

Definition at line 312 of file MapSequenceContainer.cpp.

References sequences_.

◆ setComments() [1/4]

◆ setComments() [2/4]

void bpp::AbstractSequenceContainer::setComments ( const std::string &  name,
const Comments comments 
)
inlinevirtualinherited

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.

Definition at line 116 of file AbstractSequenceContainer.h.

References bpp::OrderedValuesContainer::getSequencePosition(), and bpp::OrderedSequenceContainer::setComments().

◆ setComments() [3/4]

void MapSequenceContainer::setComments ( size_t  sequenceIndex,
const Comments comments 
)
virtual

Implements bpp::AbstractSequenceContainer.

Definition at line 436 of file MapSequenceContainer.cpp.

References getNumberOfSequences(), and sequences_.

◆ setComments() [4/4]

virtual void bpp::OrderedValuesContainer::setComments
inherited

◆ setGeneralComments() [1/2]

◆ setGeneralComments() [2/2]

virtual void bpp::SequencedValuesContainer::setGeneralComments ( const Comments comments)
pure virtualinherited

Set the comments of this container.

Parameters
commentsThe comments to be associated to this container.

Implemented in bpp::AbstractValuesContainer, and bpp::AbstractProbabilisticSequenceContainer.

Referenced by bpp::Clustal::appendAlignmentFromStream(), bpp::Fasta::appendSequencesFromStream(), and bpp::Mase::appendSequencesFromStream().

◆ setSequence() [1/2]

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

Implements bpp::OrderedSequenceContainer.

Definition at line 224 of file MapSequenceContainer.cpp.

References bpp::Sequence::clone(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), and sequences_.

◆ setSequence() [2/2]

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

Implements bpp::OrderedSequenceContainer.

Definition at line 194 of file MapSequenceContainer.cpp.

References bpp::Sequence::clone(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), getKey(), bpp::Sequence::getName(), and sequences_.

◆ setSequenceByKey()

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

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.

Definition at line 252 of file MapSequenceContainer.cpp.

References bpp::Sequence::clone(), bpp::AbstractValuesContainer::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), bpp::Sequence::getName(), and sequences_.

◆ setSequencesNames()

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

References getNumberOfSequences(), and sequences_.

◆ toString() [1/3]

std::string bpp::AbstractSequenceContainer::toString ( const std::string &  name) const
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 106 of file AbstractSequenceContainer.h.

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

◆ toString() [2/3]

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

◆ toString() [3/3]

virtual std::string bpp::OrderedValuesContainer::toString
inherited

◆ valueAt() [1/4]

int& bpp::MapSequenceContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
)
inlinevirtual

Element access function.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 171 of file MapSequenceContainer.h.

References getSequence_().

◆ valueAt() [2/4]

const int& bpp::MapSequenceContainer::valueAt ( const std::string &  sequenceName,
size_t  elementIndex 
) const
inlinevirtual

Element access function.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 175 of file MapSequenceContainer.h.

References getSequence().

◆ valueAt() [3/4]

int& bpp::MapSequenceContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
)
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 188 of file MapSequenceContainer.h.

References getSequence_().

◆ valueAt() [4/4]

const int& bpp::MapSequenceContainer::valueAt ( size_t  sequenceIndex,
size_t  elementIndex 
) const
inlinevirtual

Element access operator.

Allows direct access to the data stored in the container.

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

Implements bpp::OrderedSequenceContainer.

Definition at line 192 of file MapSequenceContainer.h.

References getSequence().

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::AbstractValuesContainer::alphabet_
protectedinherited

◆ comments_

Comments bpp::Commentable::comments_
protectedinherited

◆ sequences_


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