bpp-seq3  3.0.0
bpp::TemplateSequenceDataInterface< HashType > Class Template Referenceabstract

The SequenceData interface. More...

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

+ Inheritance diagram for bpp::TemplateSequenceDataInterface< HashType >:
+ Collaboration diagram for bpp::TemplateSequenceDataInterface< HashType >:

Public Member Functions

 TemplateSequenceDataInterface ()
 
virtual ~TemplateSequenceDataInterface ()
 
TemplateSequenceDataInterface< HashType > * clone () const override=0
 
virtual const Alphabetalphabet () const =0
 Get the container's alphabet. More...
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 Get a pointer toward the container's alphabet. More...
 
virtual size_t getNumberOfSequences () const =0
 Get the number of sequences in the container. More...
 
virtual std::vector< HashType > getSequenceKeys () const =0
 
virtual void setSequenceKeys (const std::vector< HashType > &sequenceKeys)=0
 Reset all sequence keys. More...
 
virtual double getStateValueAt (size_t sitePosition, const HashType &sequenceKey, int state) const =0
 Get the value of a state at a given position. More...
 
virtual double operator() (size_t sitePosition, const HashType &sequenceKey, int state) const =0
 Get the value of a state at a given position. More...
 
virtual double getStateValueAt (size_t sitePosition, size_t sequencePosition, int state) const =0
 Get value of a state at a given position. More...
 
virtual double operator() (size_t sitePosition, size_t sequencePosition, int state) const =0
 Get the value of a state at a given position. More...
 
virtual void clear ()=0
 Delete all data in the container. More...
 
virtual TemplateSequenceDataInterface< HashType > * createEmptyContainer () const =0
 Return a copy of this container, but with no data inside. More...
 
virtual bool hasSequence (const HashType &sequenceKey) const =0
 Check if a certain key is associated to a sequence in the container. More...
 
virtual const CommentsgetComments () const =0
 Get the comments. More...
 
virtual void setComments (const Comments &comments)=0
 Set the comments. More...
 
virtual void clearComments ()=0
 
Access by key
virtual const CoreSequenceInterfacesequence (const HashType &sequenceKey) const =0
 Retrieve a sequence object from the container. More...
 
virtual void deleteSequence (const HashType &sequenceKey)=0
 Remove and delete a sequence from the container. More...
 
Access by position
virtual const CoreSequenceInterfacesequence (size_t sequencePosition) const =0
 Retrieve a sequence object from the container. More...
 
virtual void deleteSequence (size_t sequencePosition)=0
 Remove and delete a sequence from the container. More...
 
Index management

Position to key and key to position.

virtual const HashType & sequenceKey (size_t sequencePosition) const =0
 Get the key associated to a given sequence. More...
 
virtual size_t getSequencePosition (const HashType &sequenceKey) const =0
 Get the position of a sequence with a given key in the container. More...
 
Access sequence names
virtual std::vector< std::string > getSequenceNames () const =0
 
virtual void setSequenceNames (const std::vector< std::string > &names, bool updateKeys)=0
 Batch-set all sequence names. More...
 
virtual std::vector< CommentsgetSequenceComments () const =0
 

Detailed Description

template<class HashType = std::string>
class bpp::TemplateSequenceDataInterface< HashType >

The SequenceData interface.

This interface is the most general one in the container hierarchy. No assumption is made on the data in the container (no ordering, no alignment, no type).

Definition at line 27 of file SequenceData.h.

Constructor & Destructor Documentation

◆ TemplateSequenceDataInterface()

template<class HashType = std::string>
bpp::TemplateSequenceDataInterface< HashType >::TemplateSequenceDataInterface ( )
inline

Definition at line 32 of file SequenceData.h.

◆ ~TemplateSequenceDataInterface()

template<class HashType = std::string>
virtual bpp::TemplateSequenceDataInterface< HashType >::~TemplateSequenceDataInterface ( )
inlinevirtual

Definition at line 33 of file SequenceData.h.

Member Function Documentation

◆ alphabet()

template<class HashType = std::string>
virtual const Alphabet& bpp::TemplateSequenceDataInterface< HashType >::alphabet ( ) const
pure virtual

◆ clear()

◆ clearComments()

virtual void bpp::Commentable::clearComments ( )
pure virtualinherited

Implemented in bpp::SimpleCommentable.

◆ clone()

◆ createEmptyContainer()

◆ deleteSequence() [1/2]

template<class HashType = std::string>
virtual void bpp::TemplateSequenceDataInterface< HashType >::deleteSequence ( const HashType &  sequenceKey)
pure virtual

Remove and delete a sequence from the container.

Parameters
sequenceKeyThe key to which the sequence is associated.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ deleteSequence() [2/2]

template<class HashType = std::string>
virtual void bpp::TemplateSequenceDataInterface< HashType >::deleteSequence ( size_t  sequencePosition)
pure virtual

Remove and delete a sequence from the container.

Parameters
sequencePositionThe position of the sequence.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ getAlphabet()

template<class HashType = std::string>
virtual std::shared_ptr<const Alphabet> bpp::TemplateSequenceDataInterface< HashType >::getAlphabet ( ) const
pure virtual

Get a pointer toward the container's alphabet.

Returns
A pointer toward the alphabet associated to this container.

Implemented in bpp::AbstractTemplateSequenceContainer< SequenceType, HashType >, bpp::AbstractTemplateSequenceContainer< SequenceType, std::string >, and bpp::AbstractTemplateSequenceContainer< Sequence, std::string >.

Referenced by bpp::Pasta::appendAlignmentFromStream(), bpp::Clustal::appendAlignmentFromStream(), bpp::DCSE::appendAlignmentFromStream(), bpp::GenBank::appendSequencesFromStream(), bpp::Fasta::appendSequencesFromStream(), bpp::Mase::appendSequencesFromStream(), bpp::SiteContainerTools::bootstrapSites(), 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::SiteContainerTools::getSelectedSites(), bpp::SiteContainerTools::getSequencePositions(), bpp::SiteContainerTools::getSitesWithoutGaps(), bpp::SiteContainerTools::getSitesWithoutStopCodon(), bpp::SiteContainerTools::merge(), bpp::SequenceContainerTools::mergeByKey(), bpp::AbstractTemplateSequenceContainer< SequenceType, HashType >::operator=(), bpp::Phylip::readInterleaved(), bpp::Phylip::readSequential(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::removeSitesWithStopCodon(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::SiteContainerTools::sampleSites(), bpp::Phylip::writeInterleaved(), and bpp::Phylip::writeSequential().

◆ getComments()

◆ getNumberOfSequences()

template<class HashType = std::string>
virtual size_t bpp::TemplateSequenceDataInterface< HashType >::getNumberOfSequences ( ) const
pure virtual

Get the number of sequences in the container.

Returns
The number of sequences in the container.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

Referenced by bpp::SequenceContainerTools::append(), bpp::SiteContainerTools::changeGapsToUnknownCharacters(), bpp::SiteContainerTools::changeUnresolvedCharactersToGaps(), bpp::SiteContainerTools::computeSimilarityMatrix(), bpp::SequenceContainerTools::convertAlphabet(), bpp::SequenceContainerTools::getCodonPosition(), bpp::SequenceContainerTools::getCounts(), bpp::SequenceContainerTools::getFrequencies(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceApplicationTools::getSitesToAnalyse(), bpp::SiteContainerTools::getSitesWithoutStopCodon(), bpp::SequenceContainerTools::hasSequenceWithName(), bpp::TemplateAlignedSequenceContainer< SequenceType, SiteType >::operator=(), bpp::TemplateVectorSequenceContainer< SequenceType >::operator=(), bpp::SiteContainerTools::removeGapOnlySites(), bpp::SiteContainerTools::removeGapOrUnresolvedOnlySites(), bpp::SiteContainerTools::removeGapSites(), bpp::SiteContainerTools::removeSitesWithStopCodon(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::TemplateAlignedSequenceContainer< SequenceType, SiteType >::TemplateAlignedSequenceContainer(), bpp::TemplateVectorSequenceContainer< SequenceType >::TemplateVectorSequenceContainer(), bpp::Pasta::writeAlignment(), bpp::Clustal::writeAlignment(), bpp::Phylip::writeAlignment(), bpp::Stockholm::writeAlignment(), bpp::Phylip::writeInterleaved(), bpp::Pasta::writeSequences(), and bpp::Phylip::writeSequential().

◆ getSequenceComments()

template<class HashType = std::string>
virtual std::vector<Comments> bpp::TemplateSequenceDataInterface< HashType >::getSequenceComments ( ) const
pure virtual

◆ getSequenceKeys()

◆ getSequenceNames()

◆ getSequencePosition()

template<class HashType = std::string>
virtual size_t bpp::TemplateSequenceDataInterface< HashType >::getSequencePosition ( const HashType &  sequenceKey) const
pure virtual

Get the position of a sequence with a given key in the container.

Parameters
sequenceKeyThe key to which the sequence is associated.
Returns
The position of the sequence with name 'name', if it exists.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ getStateValueAt() [1/2]

template<class HashType = std::string>
virtual double bpp::TemplateSequenceDataInterface< HashType >::getStateValueAt ( size_t  sitePosition,
const HashType &  sequenceKey,
int  state 
) const
pure virtual

Get the value of a state at a given position.

Parameters
sitePositionindex of the site
sequenceKeykey of the sequence in the container
statestate in the alphabet

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ getStateValueAt() [2/2]

template<class HashType = std::string>
virtual double bpp::TemplateSequenceDataInterface< HashType >::getStateValueAt ( size_t  sitePosition,
size_t  sequencePosition,
int  state 
) const
pure virtual

Get value of a state at a given position.

Parameters
sitePositionindex of the site
sequencePositionindex of the sequence in the container
statestate in the alphabet

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ hasSequence()

template<class HashType = std::string>
virtual bool bpp::TemplateSequenceDataInterface< HashType >::hasSequence ( const HashType &  sequenceKey) const
pure virtual

Check if a certain key is associated to a sequence in the container.

Parameters
sequenceKeyThe key to which the sequence is associated.
Returns
True if the key was found in the contained.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

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

◆ operator()() [1/2]

template<class HashType = std::string>
virtual double bpp::TemplateSequenceDataInterface< HashType >::operator() ( size_t  sitePosition,
const HashType &  sequenceKey,
int  state 
) const
pure virtual

Get the value of a state at a given position.

Same as getValueAt.

Parameters
sitePositionindex of the site
sequenceKeykey of the sequence in the container
statestate in the alphabet

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ operator()() [2/2]

template<class HashType = std::string>
virtual double bpp::TemplateSequenceDataInterface< HashType >::operator() ( size_t  sitePosition,
size_t  sequencePosition,
int  state 
) const
pure virtual

Get the value of a state at a given position.

Same as getValueAt.

Parameters
sitePositionindex of the site
sequencePositionindex of the sequence in the container
statestate in the alphabet

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

◆ sequence() [1/2]

template<class HashType = std::string>
virtual const CoreSequenceInterface& bpp::TemplateSequenceDataInterface< HashType >::sequence ( const HashType &  sequenceKey) const
pure virtual

Retrieve a sequence object from the container.

Parameters
sequenceKeyThe key to which the sequence is associated.
Returns
A reference toward the Sequence with corresponding name.

Implemented in bpp::TemplateSequenceContainerInterface< SequenceType, std::string >, bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, bpp::CompressedVectorSiteContainer, and bpp::TemplateSequenceContainerInterface< SequenceType, HashType >.

◆ sequence() [2/2]

template<class HashType = std::string>
virtual const CoreSequenceInterface& bpp::TemplateSequenceDataInterface< HashType >::sequence ( size_t  sequencePosition) const
pure virtual

◆ sequenceKey()

template<class HashType = std::string>
virtual const HashType& bpp::TemplateSequenceDataInterface< HashType >::sequenceKey ( size_t  sequencePosition) const
pure virtual

Get the key associated to a given sequence.

Parameters
sequencePositionThe position of the sequence in the container.
Returns
The key to which the sequence is associated.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

Referenced by bpp::TemplateVectorSequenceContainer< SequenceType >::operator=(), and bpp::TemplateVectorSequenceContainer< SequenceType >::TemplateVectorSequenceContainer().

◆ setComments()

virtual void bpp::Commentable::setComments ( const Comments comments)
pure virtualinherited

◆ setSequenceKeys()

template<class HashType = std::string>
virtual void bpp::TemplateSequenceDataInterface< HashType >::setSequenceKeys ( const std::vector< HashType > &  sequenceKeys)
pure virtual

◆ setSequenceNames()

template<class HashType = std::string>
virtual void bpp::TemplateSequenceDataInterface< HashType >::setSequenceNames ( const std::vector< std::string > &  names,
bool  updateKeys 
)
pure virtual

Batch-set all sequence names.

Parameters
namesA vector of sequence names. Must be the same size as the number of sequences in the container, otherwise a DimensionException is thrown.
updateKeysTell whether the keys of the sequences should be updated with the new sequence names.

Implemented in bpp::TemplateVectorSiteContainer< SiteType, SequenceType >, bpp::TemplateVectorSequenceContainer< SequenceType >, and bpp::CompressedVectorSiteContainer.

Referenced by bpp::SiteContainerTools::getSelectedSites(), and bpp::SiteContainerTools::sampleSites().


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