bpp-seq
2.2.0
|
Partial implementation of the OrderedSequenceContainer interface. More...
#include <Bpp/Seq/Container/AbstractSequenceContainer.h>
Public Member Functions | |
AbstractSequenceContainer (const Alphabet *alpha) | |
This constructor initialize the alphabet pointer. More... | |
AbstractSequenceContainer (const AbstractSequenceContainer &sc) | |
AbstractSequenceContainer & | operator= (const AbstractSequenceContainer &sc) |
AbstractSequenceContainer (const SequenceContainer &sc) | |
Copy constructor from any SequenceContainer object. More... | |
AbstractSequenceContainer & | operator= (const SequenceContainer &sc) |
Assignation operator from any SequenceContainer object. More... | |
virtual | ~AbstractSequenceContainer () |
virtual const Sequence & | getSequence (size_t sequenceIndex) const =0 throw (IndexOutOfBoundsException) |
Retrieve a sequence object from the container. More... | |
virtual void | setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName)=0 throw (Exception) |
Replace a sequence in the container. More... | |
virtual Sequence * | removeSequence (size_t sequenceIndex)=0 throw (IndexOutOfBoundsException, Exception) |
Extract (and remove) a sequence from the container. More... | |
virtual void | deleteSequence (size_t sequenceIndex)=0 throw (IndexOutOfBoundsException, Exception) |
Delete a sequence of the container. More... | |
virtual size_t | getSequencePosition (const std::string &name) const =0 throw (SequenceNotFoundException) |
Get the position of a sequence in sequence container from its name. More... | |
virtual bool | hasSequence (const std::string &name) const =0 |
Check if a sequence with a given name is present in the container. More... | |
virtual void | addSequence (const Sequence &sequence, bool checkName)=0 throw (Exception) |
Add a sequence to the container. More... | |
virtual void | clear ()=0 |
Delete all sequences in the container. More... | |
virtual SequenceContainer * | createEmptyContainer () const =0 |
Return a copy of this container, but with no sequence inside. More... | |
From the SequenceContainer interface | |
const Alphabet * | getAlphabet () 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 Comments & | getComments (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 Comments & | getGeneralComments () 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::string & | getName (size_t sequenceIndex) const throw (IndexOutOfBoundsException) |
Get the name of a particular sequence. More... | |
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 Comments & | getComments (size_t sequenceIndex) const throw (IndexOutOfBoundsException) |
Get comments of a particular sequence. More... | |
virtual void | setComments (size_t sequenceIndex, const Comments &comments)=0 throw (IndexOutOfBoundsException) |
Set the comments of a particular sequence. More... | |
SequenceContainer methods. | |
virtual const Sequence & | getSequence (const std::string &name) const =0 throw (SequenceNotFoundException) |
Retrieve a sequence object from the container. More... | |
virtual void | setSequence (const std::string &name, const Sequence &sequence, bool checkName)=0 throw (Exception) |
Replace a sequence in the container. More... | |
virtual Sequence * | removeSequence (const std::string &name)=0 throw (SequenceNotFoundException, Exception) |
Extract (and remove) a sequence from the container. More... | |
virtual void | deleteSequence (const std::string &name)=0 throw (SequenceNotFoundException, Exception) |
Delete a sequence of the container. More... | |
virtual size_t | getNumberOfSequences () const =0 |
Get the number of sequences in the container. More... | |
virtual std::vector< std::string > | getSequencesNames () const =0 |
Get all the names of the sequences in the container. More... | |
virtual void | setSequencesNames (const std::vector< std::string > &names, bool checkNames)=0 throw (Exception) |
Set all sequence names. More... | |
Provide direct access to sequences content. | |
| |
virtual int & | valueAt (const std::string &sequenceName, size_t elementIndex)=0 throw (SequenceNotFoundException, IndexOutOfBoundsException) |
Element access function. More... | |
virtual const int & | valueAt (const std::string &sequenceName, size_t elementIndex) const =0 throw (SequenceNotFoundException, IndexOutOfBoundsException) |
Element access function. More... | |
virtual int & | valueAt (size_t sequenceIndex, size_t elementIndex)=0 throw (IndexOutOfBoundsException) |
Element access operator. More... | |
virtual const int & | valueAt (size_t sequenceIndex, size_t elementIndex) const =0 throw (IndexOutOfBoundsException) |
Element access operator. More... | |
virtual int & | operator() (size_t sequenceIndex, size_t elementIndex)=0 |
Element access operator. More... | |
virtual const int & | operator() (size_t sequenceIndex, size_t elementIndex) const =0 |
Element access operator. More... | |
Provide direct access to sequences content. | |
| |
virtual int & | operator() (const std::string &sequenceName, size_t elementIndex)=0 |
Element access operator. More... | |
virtual const int & | operator() (const std::string &sequenceName, size_t elementIndex) const =0 |
Element access operator. More... | |
Private Attributes | |
const Alphabet * | alphabet_ |
The container's alphabet. More... | |
Comments | comments_ |
The container's comments. More... | |
Partial implementation of the OrderedSequenceContainer interface.
This abstract class provides an alphabet and comments, with associated methods.
Definition at line 57 of file AbstractSequenceContainer.h.
|
inline |
This constructor initialize the alphabet pointer.
This constructor is to be called by constructors of derived classes.
alpha | The alphabet to be associated to this container. |
Definition at line 81 of file AbstractSequenceContainer.h.
|
inline |
Definition at line 84 of file AbstractSequenceContainer.h.
|
inline |
Copy constructor from any SequenceContainer object.
sc | Another sequence container. |
Definition at line 99 of file AbstractSequenceContainer.h.
|
inlinevirtual |
Definition at line 114 of file AbstractSequenceContainer.h.
|
pure virtualinherited |
Add a sequence to the container.
sequence | The sequence to add. |
checkName | Tell if the container must check if the name of the sequence is already used in the container before adding it. |
Exception | Any other kind of exception, if the name of the sequence is already used, are whatever else depending on the implementation. |
Implemented in bpp::VectorSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSiteContainer, bpp::AlignedSequenceContainer, and bpp::MapSequenceContainer.
Referenced by bpp::SequenceContainerTools::append(), and bpp::NexusIOSequence::appendAlignmentFromStream().
|
pure virtualinherited |
Delete all sequences in the container.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::AlignedSequenceContainer.
|
pure virtualinherited |
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.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::AlignedSequenceContainer.
|
inlinevirtual |
Delete the comments associated to this container.
Implements bpp::SequenceContainer.
Definition at line 150 of file AbstractSequenceContainer.h.
References comments_.
|
pure virtualinherited |
Delete a sequence of the container.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If the position does not match any sequence in the container. |
Implemented in bpp::VectorSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, and bpp::VectorSiteContainer.
Referenced by bpp::SequenceContainerTools::keepOnlySelectedSequences().
|
pure virtualinherited |
Delete a sequence of the container.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
inlinevirtual |
Get sequence container's alphabet.
Implements bpp::SequenceContainer.
Definition at line 123 of file AbstractSequenceContainer.h.
References alphabet_.
Referenced by bpp::MapSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::createEmptyContainer(), and bpp::VectorSiteContainer::realloc().
|
inlinevirtual |
Get comments of a particular sequence.
name | The name of the sequence. |
SequenceNotFoundException | If 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().
|
inlinevirtual |
Get comments of a particular sequence.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If 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().
|
inlinevirtual |
Get the content of a sequence.
name | The name of the sequence. |
SequenceNotFoundException | If 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().
|
inlinevirtual |
Get the content of a sequence.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If 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().
|
inlinevirtual |
Get the comments of this container.
Implements bpp::SequenceContainer.
Definition at line 140 of file AbstractSequenceContainer.h.
References comments_.
Referenced by bpp::MapSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), and bpp::CompressedVectorSiteContainer::createEmptyContainer().
|
inlinevirtual |
Get the name of a particular sequence.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If 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().
|
pure virtualinherited |
Get the number of sequences in the container.
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
Referenced by bpp::SequenceContainerTools::append(), bpp::NexusIOSequence::appendAlignmentFromStream(), bpp::SiteContainerTools::changeGapsToUnknownCharacters(), bpp::SiteContainerTools::changeUnresolvedCharactersToGaps(), bpp::CompressedVectorSiteContainer::CompressedVectorSiteContainer(), bpp::SiteContainerTools::computeSimilarityMatrix(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceApplicationTools::getSitesToAnalyse(), bpp::SimpleSequenceContainerIterator::hasMoreSequences(), bpp::VectorSiteContainer::operator=(), bpp::CompressedVectorSiteContainer::operator=(), bpp::VectorSequenceContainer::operator=(), bpp::VectorSequenceContainer::VectorSequenceContainer(), and bpp::VectorSiteContainer::VectorSiteContainer().
|
pure virtualinherited |
Retrieve a sequence object from the container.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If the position does not match any sequence in the container. |
Implemented in bpp::VectorSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, and bpp::VectorSiteContainer.
Referenced by bpp::SequenceContainerTools::append(), bpp::NexusIOSequence::appendAlignmentFromStream(), bpp::SiteContainerTools::computeSimilarityMatrix(), getComments(), getContent(), getName(), bpp::SiteContainerTools::getSequencePositions(), bpp::SimpleSequenceContainerIterator::nextSequence(), bpp::VectorSiteContainer::operator=(), bpp::VectorSequenceContainer::operator=(), toString(), bpp::SiteContainerTools::translateSequence(), bpp::VectorSequenceContainer::VectorSequenceContainer(), and bpp::VectorSiteContainer::VectorSiteContainer().
|
pure virtualinherited |
Retrieve a sequence object from the container.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
Get the position of a sequence in sequence container from its name.
name | The name of the sequence. |
SequenceNotFoundException | If no sequence with name 'name' could be found. |
Implemented in bpp::VectorSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, and bpp::VectorSiteContainer.
|
pure virtualinherited |
Get all the names of the sequences in the container.
Implements bpp::SequenceContainer.
Implemented in bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, and bpp::VectorSiteContainer.
Referenced by bpp::SiteContainerTools::computeSimilarityMatrix(), bpp::SiteContainerTools::getCompleteSites(), bpp::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSitesWithoutGaps(), bpp::SequenceContainerTools::keepOnlySelectedSequences(), bpp::VectorSiteContainer::operator=(), bpp::CompressedVectorSiteContainer::operator=(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), and bpp::SiteContainerTools::sampleSites().
|
pure virtualinherited |
Check if a sequence with a given name is present in the container.
name | The name of the sequence. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
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!
sequenceIndex | The sequence position. |
elementIndex | The element position within the sequence. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
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!
sequenceIndex | The sequence position. |
elementIndex | The element position within the sequence. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
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!
sequenceName | The sequence name. |
elementIndex | The element position within the sequence. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
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!
sequenceName | The sequence name. |
elementIndex | The element position within the sequence. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
inline |
Definition at line 87 of file AbstractSequenceContainer.h.
References alphabet_, and comments_.
Referenced by bpp::MapSequenceContainer::operator=(), bpp::VectorSiteContainer::operator=(), bpp::CompressedVectorSiteContainer::operator=(), and bpp::VectorSequenceContainer::operator=().
|
inline |
Assignation operator from any SequenceContainer object.
sc | Another sequence container. |
Definition at line 107 of file AbstractSequenceContainer.h.
References alphabet_, comments_, bpp::SequenceContainer::getAlphabet(), and bpp::SequenceContainer::getGeneralComments().
|
pure virtualinherited |
Extract (and remove) a sequence from the container.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If the name does not match any sequence in the container. |
Implemented in bpp::VectorSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, and bpp::VectorSiteContainer.
|
pure virtualinherited |
Extract (and remove) a sequence from the container.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::MapSequenceContainer, and bpp::VectorSiteContainer.
|
virtual |
Set the comments of a particular sequence.
name | The name of the sequence. |
comments | The comments to set to sequence with name 'name'. |
SequenceNotFoundException | If 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().
|
pure virtual |
Set the comments of a particular sequence.
sequenceIndex | The position of the sequence. |
comments | The comments to set to sequence with position 'i'. |
IndexOutOfBoundsException | If the position does not match any sequence in the container. |
Implements bpp::OrderedSequenceContainer.
Implemented in bpp::VectorSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, and bpp::VectorSiteContainer.
|
inlinevirtual |
Set the comments of this container.
comments | The comments to be associated to this container. |
Implements bpp::SequenceContainer.
Definition at line 145 of file AbstractSequenceContainer.h.
References comments_.
Referenced by bpp::AlignedSequenceContainer::createEmptyContainer(), bpp::MapSequenceContainer::createEmptyContainer(), bpp::VectorSiteContainer::createEmptyContainer(), bpp::VectorSequenceContainer::createEmptyContainer(), bpp::CompressedVectorSiteContainer::createEmptyContainer(), bpp::SiteContainerTools::getSelectedSites(), and bpp::VectorSequenceContainer::VectorSequenceContainer().
|
pure virtualinherited |
Replace a sequence in the container.
sequenceIndex | The position of the sequence. |
sequence | The sequence to add. |
checkName | Tell if the container must check if the name of the sequence is already used in the container before adding it. |
IndexOutOfBoundsException | If the position does not match any sequence in the container. |
Exception | Any other kind of exception. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::AlignedSequenceContainer.
|
pure virtualinherited |
Replace a sequence in the container.
name | The name of the sequence. |
sequence | The sequence to add. |
checkName | Tell if the container must check if the name of the sequence is already used in the container before adding it. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Exception | Any other kind of exception, if the name of the sequence is already used, are whatever else depending on the implementation. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSiteContainer, bpp::AlignedSequenceContainer, bpp::MapSequenceContainer, and bpp::VectorSequenceContainer.
|
pure virtualinherited |
Set all sequence names.
names | A vector of strings with all sequence names. Its size must be strictly equal to the the size of the container (the number of sequences). |
checkNames | Tell if the container must check if the name of the sequence is already used in the container before adding it. |
Exception | If there are redundant names in the input vector. |
Implements bpp::SequenceContainer.
Implemented in bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, and bpp::VectorSiteContainer.
|
inlinevirtual |
Convert a particular sequence to a string.
name | The name of the sequence. |
SequenceNotFoundException | If 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().
|
inlinevirtual |
Convert a particular sequence to a string.
sequenceIndex | The position of the sequence. |
IndexOutOfBoundsException | If 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().
|
pure virtualinherited |
Element access function.
Allows direct access to the data stored in the container.
sequenceName | The sequence name. |
elementIndex | The element position within the sequence. |
SequenceNotFoundException | If no corresponding sequence is found in the container. |
IndexOutOfBoundsException | If the element position is not valid. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
Element access function.
Allows direct access to the data stored in the container.
sequenceName | The sequence name. |
elementIndex | The element position within the sequence. |
SequenceNotFoundException | If no corresponding sequence is found in the container. |
IndexOutOfBoundsException | If the element position is not valid. |
Implements bpp::SequenceContainer.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
Element access operator.
Allows direct access to the data stored in the container.
sequenceIndex | The sequence position. |
elementIndex | The element position within the sequence. |
IndexOutOfBoundsException | If a position is not valid. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtualinherited |
Element access operator.
Allows direct access to the data stored in the container.
sequenceIndex | The sequence position. |
elementIndex | The element position within the sequence. |
IndexOutOfBoundsException | If a position is not valid. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
private |
The container's alphabet.
Definition at line 65 of file AbstractSequenceContainer.h.
Referenced by getAlphabet(), and operator=().
|
private |
The container's comments.
Definition at line 70 of file AbstractSequenceContainer.h.
Referenced by deleteGeneralComments(), getGeneralComments(), operator=(), and setGeneralComments().