bpp-seq3
3.0.0
|
A partial implementation of a SymbolList object. More...
#include <Bpp/Seq/SymbolList.h>
Public Member Functions | |
AbstractTemplateSymbolList (std::shared_ptr< const Alphabet > alpha) | |
Build a new void SymbolList object with the specified alphabet. More... | |
AbstractTemplateSymbolList (const std::vector< T > &list, std::shared_ptr< const Alphabet > alpha) | |
Build a new SymbolList object with the specified alphabet. The content of the site is initialized from a vector of T objects. More... | |
AbstractTemplateSymbolList (const AbstractTemplateSymbolList< T > &list) | |
The generic copy constructor. More... | |
AbstractTemplateSymbolList (const TemplateCoreSymbolListInterface< T > &list) | |
The copy constructor. More... | |
AbstractTemplateSymbolList< T > & | operator= (const TemplateCoreSymbolListInterface< T > &list) |
The generic assignment operator. More... | |
AbstractTemplateSymbolList< T > & | operator= (const AbstractTemplateSymbolList< T > &list) |
The assignment operator. More... | |
virtual | ~AbstractTemplateSymbolList () |
std::shared_ptr< const Alphabet > | getAlphabet () const override |
Get the alphabet associated to the list. More... | |
const Alphabet & | alphabet () const override |
Get the alphabet associated to the list. More... | |
size_t | size () const override |
Get the number of elements in the list. More... | |
virtual void | setContent (const std::vector< T > &list) override |
Set the whole content of the list. More... | |
virtual const std::vector< T > & | getContent () const override |
virtual std::string | toString () const override |
Convert the list as a string. More... | |
void | deleteElement (size_t pos) override |
Remove the element at position 'pos'. More... | |
void | deleteElements (size_t pos, size_t len) override |
Remove the elements at position 'pos'. More... | |
void | addElement (const T &c) override |
Add a character to the end of the list. More... | |
void | addElement (size_t pos, const T &c) override |
Add a character at a certain position in the list. More... | |
void | setElement (size_t pos, const T &c) override |
Set the element at position 'pos' to character 'c'. More... | |
const T & | getElement (size_t pos) const override |
Get the element at position 'pos' as a character. More... | |
const T & | getValue (size_t pos) const override |
checked access to a character in list. More... | |
const T & | operator[] (size_t pos) const override |
Operator [] overloaded for quick access to a character in list. More... | |
T & | operator[] (size_t pos) override |
Operator [] overloaded for quick access to a character in list. More... | |
void | shuffle () override |
Randomly shuffle the content of the list, with linear complexity. 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... | |
The Clonable interface | |
TemplateCoreSymbolListInterface * | clone () const override=0 |
Protected Attributes | |
std::vector< T > | content_ |
The list content. More... | |
Private Attributes | |
std::shared_ptr< const Alphabet > | alphabet_ |
The Alphabet attribute must be initialized in constructor and then can never be changed. More... | |
A partial implementation of a SymbolList object.
This class implements most of the CoreSymbolList interface, with the exception of the getStateValueAt function, which depend on the template type.
Definition at line 32 of file SymbolList.h.
|
inline |
Build a new void SymbolList object with the specified alphabet.
alpha | The alphabet to use. |
Definition at line 55 of file SymbolList.h.
|
inline |
Build a new SymbolList object with the specified alphabet. The content of the site is initialized from a vector of T objects.
list | The content of the site. |
alpha | The alphabet to use. |
Definition at line 65 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::setContent().
|
inline |
The generic copy constructor.
Definition at line 74 of file SymbolList.h.
|
inline |
The copy constructor.
Definition at line 82 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::CruxSymbolListInterface::size().
|
inlinevirtual |
Definition at line 117 of file SymbolList.h.
|
inlineoverridevirtual |
Add a character to the end of the list.
c | The character to add. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >.
Definition at line 152 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
Referenced by bpp::AbstractTemplateEventDrivenSymbolList< T >::addElement().
|
inlineoverridevirtual |
Add a character at a certain position in the list.
pos | The position where to insert the element. |
c | The character to add. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >.
Definition at line 157 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
|
inlineoverridevirtual |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 122 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::alphabet_.
Referenced by bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::hasGapOrStop(), bpp::CodonSiteTools::hasStop(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::CodonSiteTools::meanNumberOfSynonymousPositions(), bpp::CodonSiteTools::numberOfNonSynonymousSubstitutions(), bpp::CodonSiteTools::numberOfSubstitutions(), bpp::CodonSiteTools::piNonSynonymous(), bpp::CodonSiteTools::piSynonymous(), bpp::SequenceTools::reverseTranscript(), and bpp::SequenceTools::transcript().
|
overridepure virtualinherited |
Implements bpp::CruxSymbolListInterface.
Implemented in bpp::SiteInterface, bpp::SequenceInterface, bpp::TemplateEventDrivenCoreSymbolListInterface< T >, bpp::SequenceWithQuality, bpp::SequenceWithAnnotation, bpp::Sequence, bpp::ProbabilisticSymbolList, bpp::ProbabilisticSequence, bpp::EventDrivenIntSymbolList, bpp::IntSymbolList, bpp::ProbabilisticSiteInterface, bpp::ProbabilisticSequenceInterface, bpp::Site, and bpp::ProbabilisticSite.
|
inlineoverridevirtual |
Remove the element at position 'pos'.
pos | The position of the element to remove. |
Implements bpp::CruxSymbolListInterface.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateEventDrivenSymbolList< int >.
Definition at line 138 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
Referenced by bpp::AbstractTemplateEventDrivenSymbolList< T >::deleteElement().
|
inlineoverridevirtual |
Remove the elements at position 'pos'.
pos | The position of the first element to remove. |
len | The length of the region to remove. |
Implements bpp::CruxSymbolListInterface.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, and bpp::AbstractTemplateEventDrivenSymbolList< int >.
Definition at line 145 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
Referenced by bpp::AbstractTemplateEventDrivenSymbolList< T >::deleteElements().
|
inlineoverridevirtual |
Get the alphabet associated to the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 120 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::alphabet_.
Referenced by bpp::CompressedVectorSiteContainer::addSite(), bpp::SiteContainerTools::alignNW(), bpp::SequenceWithAnnotationTools::createMaskAnnotation(), bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SiteContainerTools::getAlignmentPositions(), bpp::SiteContainerTools::getSequencePositions(), bpp::CodonSiteTools::hasGapOrStop(), bpp::CodonSiteTools::hasStop(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::CodonSiteTools::meanNumberOfSynonymousPositions(), bpp::PhredPoly::nextSequence(), bpp::CodonSiteTools::numberOfNonSynonymousSubstitutions(), bpp::CodonSiteTools::numberOfSubstitutions(), bpp::CodonSiteTools::piNonSynonymous(), bpp::CodonSiteTools::piSynonymous(), bpp::SequenceTools::reverseTranscript(), bpp::CompressedVectorSiteContainer::setSite(), bpp::SequenceTools::transcript(), bpp::SiteContainerTools::translateAlignment(), and bpp::Pasta::writeSequence().
|
inlineoverridevirtual |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 131 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
Referenced by bpp::SequenceWithAnnotation::operator=().
|
inlineoverridevirtual |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 173 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
|
pure virtualinherited |
get value of a state at a position
position | position in the list |
state | state in the alphabet |
Implemented in bpp::Sequence, bpp::ProbabilisticSequence, bpp::ProbabilisticSymbolList, bpp::IntSymbolList, bpp::CoreSiteInterface, bpp::Site, and bpp::ProbabilisticSite.
Referenced by bpp::ProbabilisticSymbolList::ProbabilisticSymbolList().
|
inlineoverridevirtual |
checked access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 180 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
Referenced by bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), and bpp::CodonSiteTools::isFourFoldDegenerated().
|
pure virtualinherited |
get value of a state at a position
Short-cut for getStateValueAt.
position | position in the list |
state | state in the alphabet |
Implemented in bpp::ProbabilisticSymbolList, and bpp::IntSymbolList.
|
inline |
The assignment operator.
Definition at line 109 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::alphabet_, and bpp::AbstractTemplateSymbolList< T >::content_.
|
inline |
The generic assignment operator.
Definition at line 95 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::alphabet_, bpp::AbstractTemplateSymbolList< T >::content_, bpp::CruxSymbolListInterface::getAlphabet(), and bpp::CruxSymbolListInterface::size().
Referenced by bpp::IntSymbolList::operator=(), bpp::EventDrivenIntSymbolList::operator=(), bpp::Site::operator=(), and bpp::AbstractTemplateEventDrivenSymbolList< T >::operator=().
|
inlineoverridevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 187 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
|
inlineoverridevirtual |
Operator [] overloaded for quick access to a character in list.
pos | The position to retrieve. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Definition at line 189 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
|
inlineoverridevirtual |
Set the whole content of the list.
list | The new content of the list. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >, bpp::AbstractTemplateEventDrivenSymbolList< int >, bpp::SequenceWithAnnotation, bpp::Sequence, bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.
Definition at line 126 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
Referenced by bpp::AbstractTemplateSymbolList< T >::AbstractTemplateSymbolList(), bpp::IntSymbolList::setContent(), and bpp::AbstractTemplateEventDrivenSymbolList< T >::setContent().
|
inlineoverridevirtual |
Set the element at position 'pos' to character 'c'.
pos | The position of the character to set. |
c | The value of the element. |
Implements bpp::TemplateCoreSymbolListInterface< T >.
Reimplemented in bpp::AbstractTemplateEventDrivenSymbolList< T >.
Definition at line 165 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::AbstractTemplateSymbolList< T >::size().
Referenced by bpp::AbstractTemplateEventDrivenSymbolList< T >::setElement().
|
inlineoverridevirtual |
Randomly shuffle the content of the list, with linear complexity.
Implements bpp::CruxSymbolListInterface.
Definition at line 191 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_, and bpp::RandomTools::DEFAULT_GENERATOR.
|
inlineoverridevirtual |
Get the number of elements in the list.
Implements bpp::CruxSymbolListInterface.
Definition at line 124 of file SymbolList.h.
References bpp::AbstractTemplateSymbolList< T >::content_.
Referenced by bpp::AbstractTemplateSymbolList< T >::addElement(), bpp::CompressedVectorSiteContainer::addSite(), bpp::TemplateAlignedSequenceContainer< SequenceType, SiteType >::checkSize_(), bpp::SequenceWithAnnotationTools::createMaskAnnotation(), bpp::AbstractTemplateSymbolList< T >::deleteElement(), bpp::AbstractTemplateSymbolList< T >::deleteElements(), bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SiteContainerTools::getAlignmentPositions(), bpp::SequenceContainerTools::getCounts(), bpp::AbstractTemplateSymbolList< T >::getElement(), bpp::SequenceContainerTools::getFrequencies(), bpp::SiteContainerTools::getSequencePositions(), bpp::CompressedVectorSiteContainer::getSiteIndex_(), bpp::AbstractTemplateSymbolList< T >::getValue(), bpp::CodonAlphabet::getWord(), bpp::WordAlphabet::getWord(), bpp::CodonSiteTools::hasGapOrStop(), bpp::SimpleSequencePositionIterator::hasMorePositions(), bpp::CodonSiteTools::hasStop(), bpp::SequenceMask::init(), bpp::SequenceQuality::init(), bpp::CodonSiteTools::isFourFoldDegenerated(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::CodonSiteTools::meanNumberOfSynonymousPositions(), bpp::CodonSiteTools::numberOfNonSynonymousSubstitutions(), bpp::CodonSiteTools::numberOfSubstitutions(), bpp::CodonSiteTools::piNonSynonymous(), bpp::CodonSiteTools::piSynonymous(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::AbstractTemplateSymbolList< T >::setElement(), bpp::CompressedVectorSiteContainer::setSite(), bpp::SiteContainerTools::translateAlignment(), bpp::Fasta::writeSequence(), and bpp::Pasta::writeSequence().
|
inlineoverridevirtual |
Convert the list as a string.
This method is useful for dumping a list to a file or to the screen for display.
Implements bpp::CruxSymbolListInterface.
Reimplemented in bpp::Sequence, bpp::EventDrivenIntSymbolList, and bpp::IntSymbolList.
Definition at line 133 of file SymbolList.h.
|
private |
The Alphabet attribute must be initialized in constructor and then can never be changed.
To apply another alphabet to a list you'll have to create a new list.
Definition at line 41 of file SymbolList.h.
Referenced by bpp::AbstractTemplateSymbolList< T >::alphabet(), bpp::AbstractTemplateSymbolList< T >::getAlphabet(), and bpp::AbstractTemplateSymbolList< T >::operator=().
|
protected |
The list content.
Definition at line 47 of file SymbolList.h.
Referenced by bpp::AbstractTemplateSymbolList< T >::AbstractTemplateSymbolList(), bpp::AbstractTemplateSymbolList< T >::addElement(), bpp::AbstractTemplateSymbolList< T >::deleteElement(), bpp::AbstractTemplateSymbolList< T >::deleteElements(), bpp::AbstractTemplateSymbolList< T >::getContent(), bpp::AbstractTemplateSymbolList< T >::getElement(), bpp::AbstractTemplateSymbolList< T >::getValue(), bpp::AbstractTemplateSymbolList< T >::operator=(), bpp::AbstractTemplateSymbolList< T >::operator[](), bpp::AbstractTemplateSymbolList< T >::setContent(), bpp::AbstractTemplateSymbolList< T >::setElement(), bpp::AbstractTemplateSymbolList< T >::shuffle(), and bpp::AbstractTemplateSymbolList< T >::size().