bpp-seq3  3.0.0
bpp::BasicSequence Class Referenceabstract

A basic implementation of the Sequence interface. More...

#include <Bpp/Seq/Sequence.h>

+ Inheritance diagram for bpp::BasicSequence:
+ Collaboration diagram for bpp::BasicSequence:

Public Member Functions

 BasicSequence (const Alphabet *alpha)
 Empty constructor: build a void Sequence with just an Alphabet. More...
 
 BasicSequence (const std::string &name, const std::string &sequence, const Alphabet *alpha)
 Direct constructor: build a Sequence object from a std::string You can use it safely for RNA, DNA and protein sequences. More...
 
 BasicSequence (const std::string &name, const std::string &sequence, const Comments &comments, const Alphabet *alpha)
 Direct constructor: build a Sequence object from a std::string. More...
 
 BasicSequence (const std::string &name, const std::vector< std::string > &sequence, const Alphabet *alpha)
 General purpose constructor, can be used with any alphabet. More...
 
 BasicSequence (const std::string &name, const std::vector< std::string > &sequence, const Comments &comments, const Alphabet *alpha)
 General purpose constructor, can be used with any alphabet. More...
 
 BasicSequence (const std::string &name, const std::vector< int > &sequence, const Alphabet *alpha)
 General purpose constructor, can be used with any alphabet. More...
 
 BasicSequence (const std::string &name, const std::vector< int > &sequence, const Comments &comments, const Alphabet *alpha)
 General purpose constructor, can be used with any alphabet. More...
 
 BasicSequence (const Sequence &s)
 The Sequence generic copy constructor. This does not perform a hard copy of the alphabet object. More...
 
 BasicSequence (const BasicSequence &s)
 The Sequence copy constructor. This does not perform a hard copy of the alphabet object. More...
 
BasicSequenceoperator= (const Sequence &s)
 The Sequence generic assignment operator. This does not perform a hard copy of the alphabet object. More...
 
BasicSequenceoperator= (const BasicSequence &s)
 The Sequence assignment operator. This does not perform a hard copy of the alphabet object. More...
 
virtual ~BasicSequence ()
 
virtual const AlphabetgetAlphabet () 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 double getStateValueAt (size_t siteIndex, int state) const
 
virtual double operator() (size_t siteIndex, int state) const
 
virtual const CommentsgetComments () const =0
 Get the comments. More...
 
virtual void setComments (const Comments &comments)=0
 Set the comments. More...
 
virtual void addElement (const std::string &c)
 
virtual void addElement (size_t pos, const std::string &c)
 Add a character at a certain position in the list. More...
 
void addElement (const int &v)
 Add a character to the end of the list. More...
 
void addElement (size_t pos, const int &v)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const std::string &c)
 
void setElement (size_t pos, const int &v)
 Set the element at position 'pos' to character 'c'. More...
 
virtual double getStateValueAt (size_t siteIndex, int state) const
 
virtual double operator() (size_t siteIndex, int state) const
 
const AlphabetgetAlphabet () const
 Get the alphabet associated to the list. More...
 
size_t size () const
 Get the number of elements in the list. More...
 
virtual const std::vector< int > & getContent () const
 
void deleteElement (size_t pos)
 Remove the element at position 'pos'. More...
 
void deleteElements (size_t pos, size_t len)
 Remove the elements at position 'pos'. More...
 
virtual const int & getElement (size_t pos) const
 Get the element at position 'pos' as a character. More...
 
virtual const int & getValue (size_t pos) const
 checked access to a character in list. More...
 
virtual const int & operator[] (size_t pos) const
 Operator [] overloaded for quick access to a character in list. More...
 
virtual int & operator[] (size_t pos)
 Operator [] overloaded for quick access to a character in list. More...
 
virtual void shuffle ()
 Randomly shuffle the content of the list, with linear complexity. More...
 
The Clonable interface
BasicSequenceclone () const
 
Adjusting the size of the sequence.
void setContent (const std::string &sequence)
 Set the whole content of the sequence. More...
 
void setContent (const std::vector< std::string > &list)
 
void setContent (const std::vector< int > &list)
 
std::string toString () const
 Convert the list as a string. More...
 
std::string getChar (size_t pos) const
 Get the element at position 'pos' as a character. More...
 
void setToSizeR (size_t newSize)
 Set up the size of a sequence from the right side. More...
 
void setToSizeL (size_t newSize)
 Set up the size of a sequence from the left side. More...
 
void append (const Sequence &seq)
 Append the content of the sequence. More...
 
void append (const std::vector< int > &content)
 Append the specified content to the sequence. More...
 
void append (const std::vector< std::string > &content)
 Append the specified content to the sequence. More...
 
void append (const std::string &content)
 Append the specified content to the sequence. More...
 
void clearComments ()
 Clear the comments. 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 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 modifiy 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...
 
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 modifiy 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...
 
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...
 
Setting/getting the name of the sequence.
const std::string & getName () const
 Get the name of this sequence. More...
 
void setName (const std::string &name)
 Set the name of this sequence. More...
 
const CommentsgetComments () const
 Get the comments. More...
 
void setComments (const Comments &comments)
 Set the comments. More...
 

Protected Attributes

Comments comments_
 
std::vector< int > content_
 The list content. More...
 

Private Attributes

std::string name_
 The sequence name. More...
 
const Alphabetalphabet_
 The Alphabet attribute must be initialized in constructor and then can never be changed. More...
 

Detailed Description

A basic implementation of 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, which is passed to the sequence constructor by a pointer.

For programming convenience, the states are stored as integers, but the translation toward and from a char description is easily performed with the Alphabet classes.

Sequence objets also contain a name attribute and potentially several comment lines.

See also
Alphabet

Definition at line 151 of file Sequence.h.

Constructor & Destructor Documentation

◆ BasicSequence() [1/9]

BasicSequence::BasicSequence ( const Alphabet alpha)

Empty constructor: build a void Sequence with just an Alphabet.

You can use it safely for all type of Alphabet in order to build an empty Sequence i.e. without name nor sequence data.

Parameters
alphaA pointer toward the Alphabet to be used with this Sequence.

Definition at line 57 of file Sequence.cpp.

Referenced by clone().

◆ BasicSequence() [2/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::string &  sequence,
const Alphabet alpha 
)

Direct constructor: build a Sequence object from a std::string You can use it safely for RNA, DNA and protein sequences.

It can be used with codon sequences too, the std::string will be cut into parts of size 3. But for more complicated alphabets, you should use one complete constructors.

Parameters
nameThe sequence name.
sequenceThe whole sequence to be parsed as a std::string.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 63 of file Sequence.cpp.

References setContent().

◆ BasicSequence() [3/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::string &  sequence,
const Comments comments,
const Alphabet alpha 
)

Direct constructor: build a Sequence object from a std::string.

You can use it safely for RNA, DNA and protein sequences.

It can be used with codon sequences too, the std::string will be cut into tokens of size 3. But for more complicated alphabets, you should use one complete constructors.

Parameters
nameThe sequence name.
sequenceThe whole sequence to be parsed as a std::string.
commentsComments to add to the sequence.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 76 of file Sequence.cpp.

References setContent().

◆ BasicSequence() [4/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::vector< std::string > &  sequence,
const Alphabet alpha 
)

General purpose constructor, can be used with any alphabet.

You should note that the sequence is stored as a std::vector of int. Hence each std::string in the std::vector will be translated using the alphabet object.

Parameters
nameThe sequence name.
sequenceThe sequence content.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 90 of file Sequence.cpp.

◆ BasicSequence() [5/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::vector< std::string > &  sequence,
const Comments comments,
const Alphabet alpha 
)

General purpose constructor, can be used with any alphabet.

You should note that the sequence is stored as a std::vector of int. Hence each std::string in the std::vector will be translated using the alphabet object.

Parameters
nameThe sequence name.
sequenceThe sequence content.
commentsComments to add to the sequence.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 100 of file Sequence.cpp.

◆ BasicSequence() [6/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::vector< int > &  sequence,
const Alphabet alpha 
)

General purpose constructor, can be used with any alphabet.

Parameters
nameThe sequence name.
sequenceThe sequence content.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 111 of file Sequence.cpp.

◆ BasicSequence() [7/9]

BasicSequence::BasicSequence ( const std::string &  name,
const std::vector< int > &  sequence,
const Comments comments,
const Alphabet alpha 
)

General purpose constructor, can be used with any alphabet.

Parameters
nameThe sequence name.
sequenceThe sequence content.
commentsComments to add to the sequence.
alphaA pointer toward the alphabet to be used with this sequence.

Definition at line 121 of file Sequence.cpp.

◆ BasicSequence() [8/9]

BasicSequence::BasicSequence ( const Sequence s)

The Sequence generic copy constructor. This does not perform a hard copy of the alphabet object.

Definition at line 134 of file Sequence.cpp.

◆ BasicSequence() [9/9]

BasicSequence::BasicSequence ( const BasicSequence s)

The Sequence copy constructor. This does not perform a hard copy of the alphabet object.

Definition at line 140 of file Sequence.cpp.

◆ ~BasicSequence()

virtual bpp::BasicSequence::~BasicSequence ( )
inlinevirtual

Definition at line 265 of file Sequence.h.

Member Function Documentation

◆ addElement() [1/6]

void bpp::SymbolList< int >::addElement ( const T &  c)
inlineinherited

Add a character to the end of the list.

Parameters
cThe character to add.

Definition at line 199 of file SymbolList.h.

◆ addElement() [2/6]

void BasicIntSymbolList::addElement ( const std::string &  c)
virtualinherited

◆ addElement() [3/6]

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

◆ addElement() [4/6]

void bpp::SymbolList< int >::addElement ( size_t  pos,
const T &  c 
)
inlineinherited

Add a character at a certain position in the list.

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

Definition at line 204 of file SymbolList.h.

◆ addElement() [5/6]

void BasicIntSymbolList::addElement ( size_t  pos,
const std::string &  c 
)
virtualinherited

Add a character at a certain position in the list.

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

Implements bpp::IntSymbolList.

Definition at line 142 of file IntSymbolList.cpp.

References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::SymbolList< int >::size().

◆ addElement() [6/6]

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

Add a character at a certain position in the list.

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

Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.

◆ append() [1/4]

void BasicSequence::append ( const Sequence seq)
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.

Implements bpp::Sequence.

Definition at line 217 of file Sequence.cpp.

References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), bpp::CruxSymbolList::getAlphabet(), bpp::Alphabet::getAlphabetType(), and bpp::CruxSymbolList::size().

Referenced by append(), and bpp::SequenceContainerTools::merge().

◆ append() [2/4]

void BasicSequence::append ( const std::string &  content)
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.

Implements bpp::Sequence.

Definition at line 259 of file Sequence.cpp.

References append(), bpp::StringSequenceTools::codeSequence(), and bpp::SymbolList< int >::getAlphabet().

◆ append() [3/4]

void BasicSequence::append ( const std::vector< int > &  content)
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.

Implements bpp::Sequence.

Definition at line 228 of file Sequence.cpp.

References bpp::SymbolList< int >::content_, and bpp::SymbolList< int >::getAlphabet().

◆ append() [4/4]

void BasicSequence::append ( const std::vector< std::string > &  content)
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.

Implements bpp::Sequence.

Definition at line 243 of file Sequence.cpp.

References bpp::SymbolList< int >::content_, and bpp::SymbolList< int >::getAlphabet().

◆ clearComments()

void bpp::BasicSequence::clearComments ( )
inlinevirtual

Clear the comments.

Implements bpp::CoreSequence.

Definition at line 318 of file Sequence.h.

References bpp::Commentable::clearComments().

◆ clone()

BasicSequence* bpp::BasicSequence::clone ( ) const
inlinevirtual

Implements bpp::AbstractCoreSequence.

Definition at line 273 of file Sequence.h.

References BasicSequence().

◆ deleteElement() [1/2]

void bpp::SymbolList< int >::deleteElement ( size_t  pos)
inlinevirtualinherited

Remove the element at position 'pos'.

Parameters
posThe position of the element to remove.

Implements bpp::CruxSymbolList.

Reimplemented in bpp::EdSymbolList< int >.

Definition at line 185 of file SymbolList.h.

◆ deleteElement() [2/2]

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

◆ deleteElements() [1/2]

void bpp::SymbolList< int >::deleteElements ( size_t  pos,
size_t  len 
)
inlinevirtualinherited

Remove the elements at position 'pos'.

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

Implements bpp::CruxSymbolList.

Reimplemented in bpp::EdSymbolList< int >.

Definition at line 192 of file SymbolList.h.

◆ deleteElements() [2/2]

virtual void bpp::CruxSymbolList::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::EdSymbolList< T >, bpp::EdSymbolList< int >, bpp::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

Referenced by bpp::AlignedSequenceContainer::deleteSites().

◆ getAlphabet() [1/2]

const Alphabet* bpp::SymbolList< int >::getAlphabet ( ) const
inlinevirtualinherited

Get the alphabet associated to the list.

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

Implements bpp::CruxSymbolList.

Definition at line 169 of file SymbolList.h.

◆ getAlphabet() [2/2]

virtual const Alphabet* bpp::CruxSymbolList::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::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

Referenced by bpp::VectorProbabilisticSequenceContainer::addSequence(), bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::VectorSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), bpp::CompressedVectorSiteContainer::addSite(), bpp::AlignedSequenceContainer::addSite(), bpp::VectorSiteContainer::addSite(), bpp::SiteContainerTools::alignNW(), append(), 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::SequenceWithAnnotationTools::createMaskAnnotation(), bpp::SequenceTools::findFirstOf(), bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SequenceTools::getCDS(), bpp::GeneticCode::getCodingSequence(), bpp::SequenceTools::getComplement(), bpp::SymbolListTools::getCounts(), bpp::SymbolListTools::getGCContent(), bpp::SequenceTools::getNumberOfCompleteSites(), 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::CodonSiteTools::hasGapOrStop(), bpp::CodonSiteTools::hasStop(), bpp::SymbolListTools::hasUnknown(), bpp::SymbolListTools::hasUnresolved(), bpp::SequenceTools::invertComplement(), bpp::SymbolListTools::isComplete(), bpp::SymbolListTools::isConstant(), bpp::SymbolListTools::isGapOnly(), bpp::SymbolListTools::isGapOrUnresolvedOnly(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::SymbolListTools::jointEntropy(), bpp::CodonSiteTools::meanNumberOfSynonymousPositions(), bpp::SymbolListTools::mutualInformation(), bpp::Pasta::nextSequence(), bpp::PhredPoly::nextSequence(), bpp::SymbolListTools::numberOfGaps(), bpp::CodonSiteTools::numberOfNonSynonymousSubstitutions(), bpp::CodonSiteTools::numberOfSubstitutions(), bpp::SymbolListTools::numberOfUnresolved(), bpp::SymbolList< T >::operator=(), bpp::BasicProbabilisticSymbolList::operator=(), bpp::CodonSiteTools::piNonSynonymous(), bpp::CodonSiteTools::piSynonymous(), bpp::SequenceTools::removeGaps(), bpp::SequenceTools::removeStops(), bpp::SequenceTools::replaceStopsWithGaps(), bpp::WordAlphabet::reverse(), bpp::NucleicAcidsReplication::reverse(), bpp::AbstractReverseTransliterator::reverse(), bpp::SequenceTools::reverseTranscript(), bpp::SequenceTools::RNYslice(), bpp::VectorProbabilisticSiteContainer::setSequence(), bpp::VectorProbabilisticSequenceContainer::setSequence(), bpp::VectorSiteContainer::setSequence(), bpp::VectorSequenceContainer::setSequence(), bpp::AlignedSequenceContainer::setSite(), bpp::CompressedVectorSiteContainer::setSite(), bpp::VectorSiteContainer::setSite(), bpp::SequenceTools::subseq(), bpp::SequenceTools::subtractHaplotype(), bpp::SequenceTools::transcript(), bpp::NucleicAcidsReplication::translate(), bpp::AbstractTransliterator::translate(), bpp::WordAlphabet::translate(), bpp::SiteContainerTools::translateAlignment(), bpp::SymbolListTools::variabilityShannon(), and bpp::Pasta::writeSequence().

◆ getChar()

std::string bpp::BasicSequence::getChar ( size_t  pos) const
inlinevirtual

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

Parameters
posThe position of the character to retrieve.

Reimplemented from bpp::BasicIntSymbolList.

Definition at line 301 of file Sequence.h.

References bpp::BasicIntSymbolList::getChar().

◆ getComments() [1/2]

const Comments& bpp::AbstractCoreSequence::getComments ( ) const
inlinevirtualinherited

Get the comments.

Returns
The comments.

Implements bpp::CoreSequence.

Reimplemented in bpp::SequenceWithQuality, and bpp::SequenceWithAnnotation.

Definition at line 235 of file CoreSequence.h.

References bpp::Commentable::getComments().

◆ getComments() [2/2]

◆ getContent() [1/2]

virtual const std::vector<int >& bpp::SymbolList< int >::getContent ( ) const
inlinevirtualinherited

Implements bpp::CoreSymbolList< T >.

Definition at line 178 of file SymbolList.h.

◆ getContent() [2/2]

◆ getElement() [1/2]

virtual const int & bpp::SymbolList< int >::getElement ( size_t  pos) const
inlinevirtualinherited

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

Parameters
posThe position of the character to retrieve.

Implements bpp::CoreSymbolList< T >.

Definition at line 220 of file SymbolList.h.

◆ getElement() [2/2]

template<class T >
virtual const T& bpp::CoreSymbolList< 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::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

◆ getName() [1/2]

const std::string& bpp::AbstractCoreSequence::getName ( ) const
inlinevirtualinherited

Get the name of this sequence.

Returns
This sequence name.

Implements bpp::CoreSequence.

Reimplemented in bpp::SequenceWithAnnotation.

Definition at line 231 of file CoreSequence.h.

References bpp::AbstractCoreSequence::name_.

Referenced by bpp::SequenceWithAnnotation::getName().

◆ getName() [2/2]

virtual const std::string& bpp::CoreSequence::getName ( ) const
pure virtualinherited

Get the name of this sequence.

Returns
This sequence name.

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

Referenced by bpp::VectorProbabilisticSequenceContainer::addSequence(), bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::VectorSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), bpp::SequenceTools::combineSequences(), bpp::SequenceTools::concatenate(), bpp::AllelicAlphabet::convertFromStateAlphabet(), bpp::SequenceWithAnnotationTools::createMaskAnnotation(), bpp::VectorSequenceContainer::deleteSequenceByName(), bpp::AbstractProbabilisticSequenceContainer::getName(), bpp::AbstractSequenceContainer::getName(), bpp::VectorProbabilisticSequenceContainer::getName(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::VectorSequenceContainer::getSequenceByName(), bpp::AbstractCoreSequence::operator=(), bpp::SequenceWithAnnotation::operator=(), bpp::VectorSequenceContainer::removeSequenceByName(), bpp::CodonAlphabet::reverse(), bpp::WordAlphabet::reverse(), bpp::NucleicAcidsReplication::reverse(), bpp::AbstractReverseTransliterator::reverse(), bpp::SequenceTools::RNYslice(), bpp::VectorProbabilisticSiteContainer::setSequence(), bpp::VectorProbabilisticSequenceContainer::setSequence(), bpp::VectorSiteContainer::setSequence(), bpp::VectorSequenceContainer::setSequence(), bpp::SequenceTools::subseq(), bpp::SequenceTools::subtractHaplotype(), bpp::NucleicAcidsReplication::translate(), bpp::AbstractTransliterator::translate(), bpp::CodonAlphabet::translate(), bpp::WordAlphabet::translate(), bpp::Clustal::writeAlignment(), bpp::Pasta::writeSequence(), and bpp::Fasta::writeSequence().

◆ getStateValueAt() [1/2]

◆ getStateValueAt() [2/2]

virtual double bpp::BasicIntSymbolList::getStateValueAt ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

◆ getValue() [1/2]

virtual const int & bpp::SymbolList< int >::getValue ( size_t  pos) const
inlinevirtualinherited

checked access to a character in list.

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

Implements bpp::CoreSymbolList< T >.

Definition at line 227 of file SymbolList.h.

◆ getValue() [2/2]

◆ operator()() [1/2]

virtual double bpp::CruxSymbolList::operator() ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

◆ operator()() [2/2]

virtual double bpp::BasicIntSymbolList::operator() ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

◆ operator=() [1/2]

BasicSequence & BasicSequence::operator= ( const BasicSequence s)

The Sequence assignment operator. This does not perform a hard copy of the alphabet object.

Returns
A ref toward the assigned Sequence.

Definition at line 156 of file Sequence.cpp.

References bpp::AbstractCoreSequence::operator=(), and bpp::BasicIntSymbolList::operator=().

◆ operator=() [2/2]

BasicSequence & BasicSequence::operator= ( const Sequence s)

The Sequence generic assignment operator. This does not perform a hard copy of the alphabet object.

Returns
A ref toward the assigned Sequence.

Definition at line 149 of file Sequence.cpp.

References bpp::CoreSymbolList< T >::getContent(), bpp::AbstractCoreSequence::operator=(), and setContent().

◆ operator[]() [1/4]

virtual int & bpp::SymbolList< int >::operator[] ( size_t  pos)
inlinevirtualinherited

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

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

Implements bpp::CoreSymbolList< T >.

Definition at line 236 of file SymbolList.h.

◆ operator[]() [2/4]

virtual const int & bpp::SymbolList< int >::operator[] ( size_t  pos) const
inlinevirtualinherited

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

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

Implements bpp::CoreSymbolList< T >.

Definition at line 234 of file SymbolList.h.

◆ operator[]() [3/4]

template<class T >
virtual const T& bpp::CoreSymbolList< 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::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

◆ operator[]() [4/4]

template<class T >
virtual T& bpp::CoreSymbolList< 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::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

◆ setComments() [1/2]

void bpp::AbstractCoreSequence::setComments ( const Comments comments)
inlinevirtualinherited

Set the comments.

Parameters
commentsThe new comments.

Implements bpp::CoreSequence.

Reimplemented in bpp::SequenceWithQuality, and bpp::SequenceWithAnnotation.

Definition at line 240 of file CoreSequence.h.

References bpp::Commentable::setComments().

Referenced by bpp::AllelicAlphabet::convertFromStateAlphabet().

◆ setComments() [2/2]

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

◆ setContent() [1/4]

void BasicSequence::setContent ( const std::string &  sequence)
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 internaly stored.

Implements bpp::Sequence.

Definition at line 165 of file Sequence.cpp.

References bpp::StringSequenceTools::codeSequence(), bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::TextTools::removeWhiteSpaces().

Referenced by BasicSequence(), and operator=().

◆ setContent() [2/4]

void bpp::BasicSequence::setContent ( const std::vector< int > &  list)
inlinevirtual

Reimplemented from bpp::BasicIntSymbolList.

Definition at line 291 of file Sequence.h.

References bpp::BasicIntSymbolList::setContent().

◆ setContent() [3/4]

void bpp::BasicSequence::setContent ( const std::vector< std::string > &  list)
inlinevirtual

Reimplemented from bpp::BasicIntSymbolList.

Definition at line 286 of file Sequence.h.

References bpp::BasicIntSymbolList::setContent().

◆ setContent() [4/4]

template<class T >
virtual void bpp::CoreSymbolList< 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 internaly stored.

Implemented in bpp::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.

Referenced by bpp::Pasta::nextSequence().

◆ setElement() [1/3]

void bpp::SymbolList< int >::setElement ( size_t  pos,
const T &  c 
)
inlineinherited

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

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

Definition at line 212 of file SymbolList.h.

◆ setElement() [2/3]

void BasicIntSymbolList::setElement ( size_t  pos,
const std::string &  c 
)
virtualinherited

◆ setElement() [3/3]

template<class T >
virtual void bpp::CoreSymbolList< 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::EdSymbolList< T >, bpp::SymbolList< T >, and bpp::BasicProbabilisticSymbolList.

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

◆ setName() [1/2]

void bpp::AbstractCoreSequence::setName ( const std::string &  name)
inlinevirtualinherited

Set the name of this sequence.

Parameters
nameThe new name of the sequence.

Implements bpp::CoreSequence.

Reimplemented in bpp::SequenceWithAnnotation.

Definition at line 233 of file CoreSequence.h.

References bpp::AbstractCoreSequence::name_.

Referenced by bpp::AllelicAlphabet::convertFromStateAlphabet(), and bpp::SequenceWithAnnotation::setName().

◆ setName() [2/2]

◆ setToSizeL()

void BasicSequence::setToSizeL ( size_t  newSize)
virtual

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.

Implements bpp::CoreSequence.

Definition at line 195 of file Sequence.cpp.

References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::Alphabet::getGapCharacterCode().

◆ setToSizeR()

void BasicSequence::setToSizeR ( size_t  newSize)
virtual

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.

Implements bpp::CoreSequence.

Definition at line 174 of file Sequence.cpp.

References bpp::SymbolList< int >::content_, bpp::SymbolList< int >::getAlphabet(), and bpp::Alphabet::getGapCharacterCode().

◆ shuffle() [1/2]

virtual void bpp::SymbolList< int >::shuffle ( )
inlinevirtualinherited

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

Implements bpp::CruxSymbolList.

Definition at line 238 of file SymbolList.h.

◆ shuffle() [2/2]

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

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

Implemented in bpp::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

◆ size() [1/2]

size_t bpp::SymbolList< int >::size ( ) const
inlinevirtualinherited

Get the number of elements in the list.

Returns
The number of sites in the list.

Implements bpp::CruxSymbolList.

Definition at line 171 of file SymbolList.h.

◆ size() [2/2]

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

Get the number of elements in the list.

Returns
The number of sites in the list.

Implemented in bpp::SymbolList< T >, bpp::SymbolList< int >, and bpp::BasicProbabilisticSymbolList.

Referenced by bpp::VectorProbabilisticSiteContainer::addSequence(), bpp::AlignedSequenceContainer::addSequence(), bpp::VectorSiteContainer::addSequence(), bpp::CompressedVectorSiteContainer::addSite(), bpp::AlignedSequenceContainer::addSite(), bpp::VectorSiteContainer::addSite(), bpp::AlignedSequenceContainer::AlignedSequenceContainer(), append(), bpp::SequenceWithAnnotation::append(), bpp::SequenceTools::areSequencesIdentical(), bpp::SymbolListTools::areSymbolListsIdentical(), bpp::SequenceTools::bowkerTest(), bpp::SymbolListTools::changeGapsToUnknownCharacters(), bpp::SymbolListTools::changeUnresolvedCharactersToGaps(), bpp::AlignedSequenceContainer::checkSize_(), bpp::SequenceTools::combineSequences(), bpp::SequenceTools::complement(), bpp::SiteContainerTools::computeSimilarity(), bpp::SequenceTools::concatenate(), bpp::SequenceWithAnnotationTools::createMaskAnnotation(), bpp::SequenceTools::findFirstOf(), bpp::CodonSiteTools::fixedDifferences(), bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::SiteContainerTools::getAlignmentPositions(), bpp::SequenceTools::getCDS(), bpp::GeneticCode::getCodingSequence(), bpp::SequenceContainerTools::getCodonPosition(), bpp::SymbolListTools::getCounts(), bpp::SequenceContainerTools::getCounts(), bpp::SymbolListTools::getFrequencies(), bpp::SequenceContainerTools::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::SiteContainerTools::getSequencePositions(), bpp::SequenceTools::getSequenceWithCompleteSites(), bpp::SequenceTools::getSequenceWithoutGaps(), bpp::SequenceTools::getSequenceWithoutStops(), bpp::CompressedVectorSiteContainer::getSiteIndex_(), bpp::VectorProbabilisticSequenceContainer::getStateValueAt(), bpp::VectorSequenceContainer::getStateValueAt(), bpp::CodonAlphabet::getWord(), bpp::WordAlphabet::getWord(), bpp::SymbolListTools::hasGap(), bpp::CodonSiteTools::hasGapOrStop(), bpp::SimpleSequencePositionIterator::hasMorePositions(), bpp::SymbolListTools::hasSingleton(), bpp::CodonSiteTools::hasStop(), bpp::SymbolListTools::hasUnknown(), bpp::SymbolListTools::hasUnresolved(), bpp::SymbolListTools::heterozygosity(), bpp::SequenceMask::init(), bpp::SequenceQuality::init(), bpp::SequenceTools::invert(), bpp::SequenceTools::invertComplement(), bpp::SymbolListTools::isComplete(), bpp::SymbolListTools::isConstant(), bpp::SymbolListTools::isDoubleton(), bpp::CodonSiteTools::isFourFoldDegenerated(), bpp::SymbolListTools::isGapOnly(), bpp::SymbolListTools::isGapOrUnresolvedOnly(), bpp::CodonSiteTools::isMonoSitePolymorphic(), bpp::SymbolListTools::isParsimonyInformativeSite(), bpp::CodonSiteTools::isSynonymousPolymorphic(), bpp::SymbolListTools::isTriplet(), bpp::SymbolListTools::jointEntropy(), bpp::CodonSiteTools::meanNumberOfSynonymousPositions(), bpp::SymbolListTools::mutualInformation(), bpp::SymbolListTools::numberOfGaps(), bpp::CodonSiteTools::numberOfNonSynonymousSubstitutions(), bpp::CodonSiteTools::numberOfSubstitutions(), bpp::SymbolListTools::numberOfUnresolved(), bpp::SymbolList< T >::operator=(), operator==(), bpp::CodonSiteTools::piNonSynonymous(), bpp::CodonSiteTools::piSynonymous(), bpp::SequenceTools::removeGaps(), bpp::SequenceTools::removeStops(), bpp::SequenceTools::replaceStopsWithGaps(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::CodonAlphabet::reverse(), bpp::WordAlphabet::reverse(), bpp::NucleicAcidsReplication::reverse(), bpp::AbstractReverseTransliterator::reverse(), bpp::SequenceTools::RNYslice(), bpp::SequenceContainerTools::sequencesHaveTheSameLength(), bpp::SequenceWalker::SequenceWalker(), bpp::VectorProbabilisticSiteContainer::setSequence(), bpp::VectorSiteContainer::setSequence(), bpp::AlignedSequenceContainer::setSequence(), bpp::AlignedSequenceContainer::setSite(), bpp::CompressedVectorSiteContainer::setSite(), bpp::VectorSiteContainer::setSite(), bpp::SequenceTools::subseq(), bpp::SequenceTools::subtractHaplotype(), bpp::SymbolList< T >::SymbolList(), bpp::NucleicAcidsReplication::translate(), bpp::AbstractTransliterator::translate(), bpp::CodonAlphabet::translate(), bpp::WordAlphabet::translate(), bpp::SiteContainerTools::translateAlignment(), bpp::SymbolListTools::variabilityFactorial(), bpp::SymbolListTools::variabilityShannon(), bpp::Phylip::writeInterleaved(), bpp::Fasta::writeSequence(), bpp::Pasta::writeSequence(), and bpp::Phylip::writeSequential().

◆ toString()

std::string bpp::BasicSequence::toString ( ) const
inlinevirtual

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.

Reimplemented from bpp::BasicIntSymbolList.

Definition at line 296 of file Sequence.h.

References bpp::BasicIntSymbolList::toString().

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::SymbolList< int >::alphabet_
privateinherited

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 79 of file SymbolList.h.

◆ comments_

Comments bpp::Commentable::comments_
protectedinherited

◆ content_

std::vector<int > bpp::SymbolList< int >::content_
protectedinherited

The list content.

Definition at line 85 of file SymbolList.h.

◆ name_

std::string bpp::AbstractCoreSequence::name_
privateinherited

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