bpp-seq
2.2.0
|
The SequenceContainer interface. More...
#include <Bpp/Seq/Container/SequenceContainer.h>
Public Member Functions | |
SequenceContainer () | |
virtual | ~SequenceContainer () |
virtual const Alphabet * | getAlphabet () const =0 |
Get sequence container's alphabet. More... | |
virtual const std::vector< int > & | getContent (const std::string &name) const =0 throw (SequenceNotFoundException) |
Get the content of a sequence. More... | |
virtual std::string | toString (const std::string &name) const =0 throw (SequenceNotFoundException) |
Convert a particular sequence to a string. More... | |
virtual const Sequence & | getSequence (const std::string &name) const =0 throw (SequenceNotFoundException) |
Retrieve a sequence object from the container. 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 | 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... | |
virtual const Comments & | getComments (const std::string &name) const =0 throw (SequenceNotFoundException) |
Get comments of a particular sequence. More... | |
virtual void | setComments (const std::string &name, const Comments &comments)=0 throw (SequenceNotFoundException) |
Set the comments of a particular sequence. More... | |
virtual const Comments & | getGeneralComments () 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... | |
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... | |
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 & | 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... | |
The SequenceContainer interface.
This interface is the most general one in the container hierarchy. No assumption is made on the sequences in the container (no ordering, no alignment). Sequences may be retrieved using their names, which must be unique.
The container is the only one responsible for the allocation/destruction of sequences it contains. This means that any sequence passed to it will be copied into the container. The container also provides methods that send const pointers towards these sequences (without performing any copy of the underlying objects).
Notes :
Definition at line 80 of file SequenceContainer.h.
|
inline |
Definition at line 84 of file SequenceContainer.h.
|
inlinevirtual |
Definition at line 85 of file SequenceContainer.h.
|
pure virtual |
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 virtual |
Delete all sequences in the container.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::AlignedSequenceContainer.
|
pure 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.
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::AlignedSequenceContainer.
|
pure virtual |
Delete the comments associated to this container.
Implemented in bpp::AbstractSequenceContainer.
|
pure virtual |
Delete a sequence of the container.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implemented in bpp::OrderedSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
|
pure virtual |
Get sequence container's alphabet.
Implemented in bpp::AbstractSequenceContainer.
Referenced by bpp::NexusIOSequence::appendAlignmentFromStream(), bpp::SiteContainerTools::changeGapsToUnknownCharacters(), bpp::SiteContainerTools::changeUnresolvedCharactersToGaps(), bpp::SiteContainerTools::getCompleteSites(), bpp::SiteContainerTools::getConsensus(), bpp::SequenceContainerTools::getFrequencies(), bpp::SiteContainerTools::getSelectedPositions(), bpp::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceApplicationTools::getSitesToAnalyse(), bpp::SiteContainerTools::getSitesWithoutGaps(), bpp::AbstractSequenceContainer::operator=(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::sampleSites(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().
|
pure virtual |
Get comments of a particular sequence.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implemented in bpp::OrderedSequenceContainer, and bpp::AbstractSequenceContainer.
|
pure virtual |
Get the content of a sequence.
name | The name of the sequence. |
SequenceNotFoundException | If the name does not match any sequence in the container. |
Implemented in bpp::OrderedSequenceContainer, and bpp::AbstractSequenceContainer.
Referenced by bpp::SequenceContainerTools::getCounts(), and bpp::SequenceContainerTools::getFrequencies().
|
pure virtual |
Get the comments of this container.
Implemented in bpp::AbstractSequenceContainer.
Referenced by bpp::SiteContainerTools::getSelectedSites(), bpp::AbstractSequenceContainer::operator=(), and bpp::VectorSequenceContainer::VectorSequenceContainer().
|
pure virtual |
Get the number of sequences in the container.
Implemented in bpp::OrderedSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
Referenced by bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().
|
pure virtual |
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. |
Implemented in bpp::OrderedSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, and bpp::MapSequenceContainer.
Referenced by bpp::VectorSiteContainer::operator=(), bpp::VectorSequenceContainer::operator=(), bpp::SequenceContainerTools::sequencesHaveTheSameLength(), bpp::VectorSequenceContainer::VectorSequenceContainer(), bpp::VectorSiteContainer::VectorSiteContainer(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().
|
pure virtual |
Get all the names of the sequences in the container.
Implemented in bpp::OrderedSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, and bpp::VectorSiteContainer.
Referenced by bpp::SequenceContainerTools::getCounts(), bpp::SequenceContainerTools::getFrequencies(), bpp::VectorSiteContainer::operator=(), bpp::VectorSequenceContainer::operator=(), bpp::SequenceContainerTools::sequencesHaveTheSameLength(), bpp::VectorSequenceContainer::VectorSequenceContainer(), bpp::VectorSiteContainer::VectorSiteContainer(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().
|
pure virtual |
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 virtual |
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 virtual |
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 virtual |
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. |
Implemented in bpp::OrderedSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::MapSequenceContainer, and bpp::VectorSiteContainer.
|
pure 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. |
Implemented in bpp::OrderedSequenceContainer, bpp::VectorSequenceContainer, and bpp::AbstractSequenceContainer.
|
pure virtual |
Set the comments of this container.
comments | The comments to be associated to this container. |
Implemented in bpp::AbstractSequenceContainer.
|
pure virtual |
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. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::OrderedSequenceContainer, bpp::VectorSiteContainer, bpp::AlignedSequenceContainer, bpp::MapSequenceContainer, and bpp::VectorSequenceContainer.
|
pure virtual |
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. |
Implemented in bpp::OrderedSequenceContainer, bpp::MapSequenceContainer, bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, and bpp::VectorSiteContainer.
Referenced by bpp::SequenceContainerTools::createContainerWithSequenceNames().
|
pure virtual |
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. |
Implemented in bpp::OrderedSequenceContainer, and bpp::AbstractSequenceContainer.
Referenced by bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().
|
pure virtual |
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. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::OrderedSequenceContainer.
|
pure virtual |
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. |
Implemented in bpp::CompressedVectorSiteContainer, bpp::VectorSequenceContainer, bpp::VectorSiteContainer, bpp::MapSequenceContainer, and bpp::OrderedSequenceContainer.