bpp-seq3  3.0.0
bpp::SequenceInterface Class Referenceabstract

The sequence interface. More...

#include <Bpp/Seq/Sequence.h>

+ Inheritance diagram for bpp::SequenceInterface:
+ Collaboration diagram for bpp::SequenceInterface:

Public Types

typedef int ElementType
 
typedef int SymbolType
 

Public Member Functions

virtual ~SequenceInterface ()
 
SequenceInterfaceclone () const override=0
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const =0
 Get the alphabet associated to the list. More...
 
virtual const Alphabetalphabet () const =0
 Get the alphabet associated to the list. More...
 
virtual size_t size () const =0
 Get the number of elements in the list. More...
 
virtual std::string toString () const =0
 Convert the list as a string. More...
 
virtual double getStateValueAt (size_t position, int state) const =0
 get value of a state at a position More...
 
virtual double operator() (size_t position, int state) const =0
 get value of a state at a position 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
 
Adjusting the content and size of the sequence.
virtual void setContent (const std::string &sequence)=0
 Set the whole content of the sequence. More...
 
virtual void setContent (const std::vector< std::string > &list) override=0
 Set the whole content of the list. More...
 
virtual void setContent (const std::vector< int > &list) override=0
 
virtual void append (const SequenceInterface &seq)=0
 Append the content of the sequence. More...
 
virtual void append (const std::vector< int > &content)=0
 Append the specified content to the sequence. More...
 
virtual void append (const std::vector< std::string > &content)=0
 Append the specified content to the sequence. More...
 
virtual void append (const std::string &content)=0
 Append the specified content to the sequence. More...
 
Setting/getting the name of the sequence.
virtual const std::string & getName () const =0
 Get the name of this sequence. More...
 
virtual void setName (const std::string &name)=0
 Set the name of this sequence. More...
 
Adjusting the size of the sequence.
virtual void setToSizeR (size_t newSize)=0
 Set up the size of a sequence from the right side. More...
 
virtual void setToSizeL (size_t newSize)=0
 Set up the size of a sequence from the left side. More...
 
Edition methods.
virtual void deleteElement (size_t pos)=0
 Remove the element at position 'pos'. More...
 
virtual void deleteElements (size_t pos, size_t len)=0
 Remove the elements at position 'pos'. More...
 
Provide direct access to the list content.
Warning
These operators allow you to modify the list content. No alphabet checking is performed for your modifications, so use with care, or consider using the setContent() method.
virtual void shuffle ()=0
 Randomly shuffle the content of the list, with linear complexity. More...
 
Acting on the content of the list.
virtual void setContent (const std::vector< T > &list)=0
 Set the whole content of the list. More...
 
Acting on the content of the list.
virtual void setContent (const std::vector< T > &list)=0
 Set the whole content of the list. More...
 
virtual const std::vector< T > & getContent () const =0
 
Edition methods.
virtual void addElement (const std::string &c)=0
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const std::string &c)=0
 Add a character at a certain position in the list. More...
 
virtual void addElement (const T &c)=0
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const T &c)=0
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const std::string &c)=0
 Set the element at position 'pos' to character 'c'. More...
 
virtual void setElement (size_t pos, const T &c)=0
 Set the element at position 'pos' to character 'c'. More...
 
virtual std::string getChar (size_t pos) const =0
 Get the element at position 'pos' as a character. More...
 
Edition methods.
virtual void addElement (const T &c)=0
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const T &c)=0
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const T &c)=0
 Set the element at position 'pos' to character 'c'. More...
 
virtual const T & getElement (size_t pos) const =0
 Get the element at position 'pos' as a character. More...
 
Provide direct access to the list content.
Warning
These operators allow you to modify the list content. No alphabet checking is performed for your modifications, so use with care, or consider using the setContent() method.
virtual const T & getValue (size_t pos) const =0
 checked access to a character in list. More...
 
virtual const T & operator[] (size_t pos) const =0
 Operator [] overloaded for quick access to a character in list. More...
 
virtual T & operator[] (size_t pos)=0
 Operator [] overloaded for quick access to a character in list. More...
 

Detailed Description

The sequence interface.

This is a general purpose container, containing an ordered list of states. The states that allowed to be present in the sequence are defined by an alphabet object.

Sequence objects also contain a name attribute and potentially several comment lines. A sequence object is also event-driven, allowing easy extension.

See also
Alphabet

Definition at line 31 of file Sequence.h.

Member Typedef Documentation

◆ ElementType

Definition at line 36 of file Sequence.h.

◆ SymbolType

Definition at line 31 of file IntSymbolList.h.

Constructor & Destructor Documentation

◆ ~SequenceInterface()

virtual bpp::SequenceInterface::~SequenceInterface ( )
inlinevirtual

Definition at line 39 of file Sequence.h.

Member Function Documentation

◆ addElement() [1/6]

virtual void bpp::IntSymbolListInterface::addElement ( const std::string &  c)
pure virtualinherited

Add a character to the end of the list.

Parameters
cThe character to add, given as a string.

Implemented in bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.

◆ addElement() [2/6]

template<class T >
virtual void bpp::TemplateCoreSymbolListInterface< T >::addElement ( const T &  c)
pure virtualinherited

Add a character to the end of the list.

Parameters
cThe character to add.

Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.

◆ addElement() [3/6]

virtual void bpp::TemplateCoreSymbolListInterface< T >::addElement
inherited

Add a character to the end of the list.

Parameters
cThe character to add.

Referenced by bpp::SequenceWithQuality::addElement().

◆ addElement() [4/6]

virtual void bpp::IntSymbolListInterface::addElement ( size_t  pos,
const std::string &  c 
)
pure virtualinherited

Add a character at a certain position in the list.

Parameters
posThe position where to insert the element.
cThe character to add, given as a string.

Implemented in bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.

◆ addElement() [5/6]

template<class T >
virtual void bpp::TemplateCoreSymbolListInterface< T >::addElement ( size_t  pos,
const T &  c 
)
pure virtualinherited

Add a character at a certain position in the list.

Parameters
posThe position where to insert the element.
cThe character to add.

Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.

◆ addElement() [6/6]

virtual void bpp::TemplateCoreSymbolListInterface< T >::addElement
inherited

Add a character at a certain position in the list.

Parameters
posThe position where to insert the element.
cThe character to add.

◆ alphabet()

◆ append() [1/4]

virtual void bpp::SequenceInterface::append ( const SequenceInterface seq)
pure virtual

Append the content of the sequence.

Parameters
seqThe sequence to append.
Exceptions
AlphabetMismatchExceptionIf the alphabet of the specified sequence does not match the current alphabet.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

Referenced by bpp::SequenceTools::subseq().

◆ append() [2/4]

virtual void bpp::SequenceInterface::append ( const std::string &  content)
pure virtual

Append the specified content to the sequence.

Parameters
contentThe content to append to the sequence.
Exceptions
BadCharExceptionIf the content does not match the current alphabet.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ append() [3/4]

virtual void bpp::SequenceInterface::append ( const std::vector< int > &  content)
pure virtual

Append the specified content to the sequence.

Parameters
contentThe content to append to the sequence.
Exceptions
BadIntExceptionIf the content does not match the current alphabet.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ append() [4/4]

virtual void bpp::SequenceInterface::append ( const std::vector< std::string > &  content)
pure virtual

Append the specified content to the sequence.

Parameters
contentThe content to append to the sequence.
Exceptions
BadCharExceptionIf the content does not match the current alphabet.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ clearComments()

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

Implemented in bpp::SimpleCommentable.

◆ clone()

◆ deleteElement()

virtual void bpp::CruxSymbolListInterface::deleteElement ( size_t  pos)
pure virtualinherited

◆ deleteElements()

virtual void bpp::CruxSymbolListInterface::deleteElements ( size_t  pos,
size_t  len 
)
pure virtualinherited

Remove the elements at position 'pos'.

Parameters
posThe position of the first element to remove.
lenThe length of the region to remove.

Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, bpp::AbstractTemplateEventDrivenSymbolList< int >, bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

◆ getAlphabet()

virtual std::shared_ptr<const Alphabet> bpp::CruxSymbolListInterface::getAlphabet ( ) const
pure virtualinherited

Get the alphabet associated to the list.

Returns
A const pointer to the alphabet.
See also
Alphabet class.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

Referenced by bpp::Sequence::append(), bpp::SequenceWithAnnotation::append(), bpp::SequenceTools::areSequencesIdentical(), bpp::SymbolListTools::areSymbolListsIdentical(), bpp::SequenceTools::bowkerTest(), bpp::SymbolListTools::changeGapsToUnknownCharacters(), bpp::SymbolListTools::changeUnresolvedCharactersToGaps(), bpp::SequenceTools::combineSequences(), bpp::SequenceWithQualityTools::complement(), bpp::SequenceTools::complement(), bpp::SiteContainerTools::computeSimilarity(), bpp::SequenceTools::concatenate(), bpp::SequenceWithQualityTools::concatenate(), bpp::SequenceTools::findFirstOf(), bpp::SequenceTools::getCDS(), bpp::SequenceTools::getComplement(), bpp::SymbolListTools::getCountsResolveUnknowns(), bpp::SymbolListTools::getGCContent(), bpp::SymbolListTools::getNumberOfDistinctPositions(), bpp::SymbolListTools::getNumberOfPositionsWithoutGap(), bpp::SequenceTools::getNumberOfUnresolvedSites(), bpp::SequenceTools::getPercentIdentity(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::SequenceTools::getSequenceWithoutGaps(), bpp::SequenceTools::getSequenceWithoutStops(), bpp::SymbolListTools::hasGap(), bpp::SymbolListTools::hasUnknown(), bpp::SymbolListTools::hasUnresolved(), bpp::SequenceTools::invertComplement(), bpp::SymbolListTools::isComplete(), bpp::SymbolListTools::isConstant(), bpp::SymbolListTools::isGapOnly(), bpp::SymbolListTools::isGapOrUnresolvedOnly(), bpp::SymbolListTools::jointEntropy(), bpp::SequenceWithAnnotation::merge(), bpp::SymbolListTools::mutualInformation(), bpp::SymbolListTools::numberOfGaps(), bpp::SymbolListTools::numberOfUnresolved(), bpp::ProbabilisticSymbolList::operator=(), bpp::AbstractTemplateSymbolList< T >::operator=(), bpp::SequenceWithQualityTools::removeGaps(), bpp::SequenceTools::removeGaps(), bpp::SequenceTools::removeStops(), bpp::SequenceTools::replaceStopsWithGaps(), bpp::WordAlphabet::reverse(), bpp::NucleicAcidsReplication::reverse(), bpp::SequenceWithQualityTools::reverseTranscript(), bpp::SequenceTools::RNYslice(), bpp::SequenceTools::subseq(), bpp::SequenceWithQualityTools::subseq(), bpp::SequenceTools::subtractHaplotype(), bpp::SequenceWithQualityTools::transcript(), bpp::NucleicAcidsReplication::translate(), bpp::AbstractTransliterator::translate(), bpp::WordAlphabet::translate(), and bpp::SymbolListTools::variabilityShannon().

◆ getChar()

virtual std::string bpp::IntSymbolListInterface::getChar ( size_t  pos) const
pure virtualinherited

Get the element at position 'pos' as a character.

Parameters
posThe position of the character to retrieve.

Implemented in bpp::Sequence, bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.

◆ getComments()

◆ getContent()

◆ getElement()

template<class T >
virtual const T& bpp::TemplateCoreSymbolListInterface< T >::getElement ( size_t  pos) const
pure virtualinherited

Get the element at position 'pos' as a character.

Parameters
posThe position of the character to retrieve.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

◆ getName()

◆ getStateValueAt()

virtual double bpp::CruxSymbolListInterface::getStateValueAt ( size_t  position,
int  state 
) const
pure virtualinherited

get value of a state at a position

Parameters
positionposition in the list
statestate in the alphabet
Returns
The state value at the given position.

Implemented in bpp::Sequence, bpp::ProbabilisticSequence, bpp::ProbabilisticSymbolList, bpp::IntSymbolList, bpp::CoreSiteInterface, bpp::Site, and bpp::ProbabilisticSite.

Referenced by bpp::ProbabilisticSymbolList::ProbabilisticSymbolList().

◆ getValue()

◆ operator()()

virtual double bpp::CruxSymbolListInterface::operator() ( size_t  position,
int  state 
) const
pure virtualinherited

get value of a state at a position

Short-cut for getStateValueAt.

Parameters
positionposition in the list
statestate in the alphabet
Returns
The state value at the given position.

Implemented in bpp::ProbabilisticSymbolList, and bpp::IntSymbolList.

◆ operator[]() [1/2]

template<class T >
virtual const T& bpp::TemplateCoreSymbolListInterface< T >::operator[] ( size_t  pos) const
pure virtualinherited

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

◆ operator[]() [2/2]

template<class T >
virtual T& bpp::TemplateCoreSymbolListInterface< T >::operator[] ( size_t  pos)
pure virtualinherited

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

◆ setComments()

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

◆ setContent() [1/5]

virtual void bpp::SequenceInterface::setContent ( const std::string &  sequence)
pure virtual

Set the whole content of the sequence.

Parameters
sequenceThe new content of the sequence.
See also
The Sequence constructor for information about the way sequences are internally stored.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ setContent() [2/5]

virtual void bpp::SequenceInterface::setContent ( const std::vector< int > &  list)
overridepure virtual

◆ setContent() [3/5]

virtual void bpp::SequenceInterface::setContent ( const std::vector< std::string > &  list)
overridepure virtual

Set the whole content of the list.

Parameters
listThe new content of the list.
See also
The list constructor for information about the way lists are internally stored.

Implements bpp::IntSymbolListInterface.

Implemented in bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ setContent() [4/5]

template<class T >
virtual void bpp::TemplateCoreSymbolListInterface< T >::setContent ( const std::vector< T > &  list)
pure virtualinherited

Set the whole content of the list.

Parameters
listThe new content of the list.
See also
The list constructor for information about the way lists are internally stored.

Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.

◆ setContent() [5/5]

virtual void bpp::TemplateCoreSymbolListInterface< T >::setContent
inherited

◆ setElement() [1/3]

virtual void bpp::IntSymbolListInterface::setElement ( size_t  pos,
const std::string &  c 
)
pure virtualinherited

Set the element at position 'pos' to character 'c'.

Parameters
posThe position of the character to set.
cThe value of the element, given as a string.

Implemented in bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.

Referenced by bpp::SequenceTools::complement(), bpp::SequenceTools::invert(), bpp::SequenceTools::invertComplement(), and bpp::SequenceTools::replaceStopsWithGaps().

◆ setElement() [2/3]

template<class T >
virtual void bpp::TemplateCoreSymbolListInterface< T >::setElement ( size_t  pos,
const T &  c 
)
pure virtualinherited

Set the element at position 'pos' to character 'c'.

Parameters
posThe position of the character to set.
cThe value of the element.

Implemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateSymbolList< T >.

◆ setElement() [3/3]

virtual void bpp::TemplateCoreSymbolListInterface< T >::setElement
inherited

Set the element at position 'pos' to character 'c'.

Parameters
posThe position of the character to set.
cThe value of the element.

◆ setName()

virtual void bpp::CoreSequenceInterface::setName ( const std::string &  name)
pure virtualinherited

Set the name of this sequence.

Parameters
nameThe new name of the sequence.

Implemented in bpp::AbstractCoreSequence.

◆ setToSizeL()

virtual void bpp::CoreSequenceInterface::setToSizeL ( size_t  newSize)
pure virtualinherited

Set up the size of a sequence from the left side.

All new characters are filled with gaps. If the specified size is < to the sequence size, the sequence will be truncated.

Parameters
newSizeThe new size of the sequence.

Implemented in bpp::SequenceWithAnnotation, bpp::Sequence, and bpp::ProbabilisticSequence.

◆ setToSizeR()

virtual void bpp::CoreSequenceInterface::setToSizeR ( size_t  newSize)
pure virtualinherited

Set up the size of a sequence from the right side.

All new characters are filled with gaps. If the specified size is < to the sequence size, the sequence will be truncated.

Parameters
newSizeThe new size of the sequence.

Implemented in bpp::SequenceWithAnnotation, bpp::Sequence, and bpp::ProbabilisticSequence.

◆ shuffle()

virtual void bpp::CruxSymbolListInterface::shuffle ( )
pure virtualinherited

Randomly shuffle the content of the list, with linear complexity.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

◆ size()

virtual size_t bpp::CruxSymbolListInterface::size ( ) const
pure virtualinherited

Get the number of elements in the list.

Returns
The number of sites in the list.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, and bpp::ProbabilisticSymbolList.

Referenced by bpp::AbstractTemplateSymbolList< T >::AbstractTemplateSymbolList(), bpp::SequenceWithQuality::addElement(), bpp::SequenceWithAnnotation::append(), bpp::SequenceTools::areSequencesIdentical(), bpp::SymbolListTools::areSymbolListsIdentical(), bpp::SequenceTools::bowkerTest(), bpp::SymbolListTools::changeGapsToUnknownCharacters(), bpp::SymbolListTools::changeUnresolvedCharactersToGaps(), bpp::SequenceTools::combineSequences(), bpp::SequenceTools::complement(), bpp::SiteContainerTools::computeSimilarity(), bpp::SequenceTools::concatenate(), bpp::SequenceTools::findFirstOf(), bpp::SequenceTools::getCDS(), bpp::GeneticCode::getCodingSequence(), bpp::SymbolListTools::getCounts(), bpp::SymbolListTools::getCountsResolveUnknowns(), bpp::SymbolListTools::getFrequencies(), bpp::SymbolListTools::getGCContent(), bpp::SymbolListTools::getMajorAllele(), bpp::SymbolListTools::getMajorAlleleFrequency(), bpp::SymbolListTools::getMinorAllele(), bpp::SymbolListTools::getMinorAlleleFrequency(), bpp::SequenceTools::getNumberOfCompleteSites(), bpp::SymbolListTools::getNumberOfDistinctCharacters(), bpp::SymbolListTools::getNumberOfDistinctPositions(), bpp::SymbolListTools::getNumberOfPositionsWithoutGap(), bpp::SequenceTools::getNumberOfSites(), bpp::SequenceTools::getNumberOfUnresolvedSites(), bpp::SequenceTools::getPercentIdentity(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::SequenceTools::getSequenceWithCompleteSites(), bpp::SequenceTools::getSequenceWithoutGaps(), bpp::SequenceTools::getSequenceWithoutStops(), bpp::SymbolListTools::hasGap(), bpp::SymbolListTools::hasSingleton(), bpp::SymbolListTools::hasUnknown(), bpp::SymbolListTools::hasUnresolved(), bpp::SymbolListTools::heterozygosity(), bpp::SequenceTools::invert(), bpp::SequenceTools::invertComplement(), bpp::SymbolListTools::isComplete(), bpp::SymbolListTools::isConstant(), bpp::SymbolListTools::isDoubleton(), bpp::SymbolListTools::isGapOnly(), bpp::SymbolListTools::isGapOrUnresolvedOnly(), bpp::SymbolListTools::isParsimonyInformativeSite(), bpp::SymbolListTools::isTriplet(), bpp::SequenceMask::isValidWith(), bpp::SequenceQuality::isValidWith(), bpp::SymbolListTools::jointEntropy(), bpp::SymbolListTools::mutualInformation(), bpp::SymbolListTools::numberOfGaps(), bpp::SymbolListTools::numberOfUnresolved(), bpp::AbstractTemplateSymbolList< T >::operator=(), bpp::SiteInterface::operator==(), bpp::SequenceWithQualityTools::removeGaps(), bpp::SequenceTools::removeGaps(), bpp::SequenceTools::removeStops(), bpp::SequenceTools::replaceStopsWithGaps(), bpp::CodonAlphabet::reverse(), bpp::WordAlphabet::reverse(), bpp::NucleicAcidsReplication::reverse(), bpp::AbstractReverseTransliterator::reverse(), bpp::SequenceTools::RNYslice(), bpp::SequenceWalker::SequenceWalker(), bpp::SequenceTools::subseq(), bpp::SequenceWithQualityTools::subseq(), bpp::SequenceTools::subtractHaplotype(), bpp::NucleicAcidsReplication::translate(), bpp::AbstractTransliterator::translate(), bpp::CodonAlphabet::translate(), bpp::WordAlphabet::translate(), bpp::SymbolListTools::variabilityFactorial(), and bpp::SymbolListTools::variabilityShannon().

◆ toString()

virtual std::string bpp::CruxSymbolListInterface::toString ( ) const
pure virtualinherited

Convert the list as a string.

This method is useful for dumping a list to a file or to the screen for display.

Returns
The whole list as a string.

Implemented in bpp::AbstractTemplateSymbolList< T >, bpp::AbstractTemplateSymbolList< int >, bpp::Sequence, bpp::ProbabilisticSymbolList, bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.


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