bpp-seq  2.2.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) throw (BadCharException)
 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) throw (BadCharException)
 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) throw (BadCharException)
 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) throw (BadCharException)
 General purpose constructor, can be used with any alphabet. More...
 
 BasicSequence (const std::string &name, const std::vector< int > &sequence, const Alphabet *alpha) throw (BadIntException)
 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) throw (BadIntException)
 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 std::string toString () const =0
 Convert the list as a string. More...
 
virtual const AlphabetgetAlphabet () const
 Get the alphabet associated to the list. More...
 
virtual size_t size () const
 Get the number of elements in the list. More...
 
virtual const std::vector< int > & getContent () const
 Get the whole content of the list as a vector of int. More...
 
virtual std::string toString () const
 Convert the list as a string. More...
 
virtual void addElement (const std::string &c) throw (BadCharException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void addElement (int v) throw (BadIntException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'c'. More...
 
virtual void setElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'v'. More...
 
virtual void deleteElement (size_t pos) throw (IndexOutOfBoundsException)
 Delete the element at position 'pos'. More...
 
virtual void deleteElements (size_t pos, size_t len) throw (IndexOutOfBoundsException)
 Delete the elements at position 'pos'. More...
 
virtual std::string getChar (size_t pos) const throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as a character. More...
 
virtual int getValue (size_t pos) const throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as an int. More...
 
virtual const int & operator[] (size_t i) const
 Operator [] overloaded for quick access to a character in list. More...
 
virtual int & operator[] (size_t i)
 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
 
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...
 
Setting/getting the comments associated to the sequence.
const CommentsgetComments () const
 Get the comments associated to this sequence. More...
 
void setComments (const Comments &comments)
 Set the comments associated to this sequence. More...
 
Adjusting the size of the sequence.
virtual void setContent (const std::string &sequence) throw (BadCharException)
 Set the whole content of the sequence. More...
 
void setContent (const std::vector< int > &list) throw (BadIntException)
 Set the whole content of the list. More...
 
void setContent (const std::vector< std::string > &list) throw (BadCharException)
 Set the whole content of the list. More...
 
virtual void setToSizeR (size_t newSize)
 Set up the size of a sequence from the right side. More...
 
virtual void setToSizeL (size_t newSize)
 Set up the size of a sequence from the left side. More...
 
virtual void append (const std::vector< int > &content) throw (BadIntException)
 Append the specified content to the sequence. More...
 
virtual void append (const std::vector< std::string > &content) throw (BadCharException)
 Append the specified content to the sequence. More...
 
virtual void append (const std::string &content) throw (BadCharException)
 Append the specified content to the sequence. More...
 
Acting on the content of the list.
virtual const std::vector< int > & getContent () const =0
 Get the whole content of the list as a vector of int. More...
 
Edition methods.
virtual void addElement (const std::string &c)=0 throw (BadCharException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void addElement (int v)=0 throw (BadIntException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'c'. More...
 
virtual void setElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'v'. More...
 
virtual void deleteElement (size_t pos)=0 throw (IndexOutOfBoundsException)
 Delete the element at position 'pos'. More...
 
virtual void deleteElements (size_t pos, size_t len)=0 throw (IndexOutOfBoundsException)
 Delete the elements at position 'pos'. More...
 
virtual std::string getChar (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as a character. More...
 
virtual int getValue (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as an int. 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 int & operator[] (size_t i) const =0
 Operator [] overloaded for quick access to a character in list. More...
 
virtual int & operator[] (size_t i)=0
 Operator [] overloaded for quick access to a character in list. More...
 
virtual void shuffle ()=0
 Randomly shuffle the content of the list, with linear complexity. More...
 

Protected Attributes

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

Private Attributes

std::string name_
 The sequence name. More...
 
Comments comments_
 The sequence comments. 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 207 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 56 of file Sequence.cpp.

Referenced by clone().

◆ BasicSequence() [2/9]

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

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 62 of file Sequence.cpp.

◆ BasicSequence() [3/9]

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

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 72 of file Sequence.cpp.

◆ BasicSequence() [4/9]

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

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 82 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 
)
throw (BadCharException
)

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 89 of file Sequence.cpp.

◆ BasicSequence() [6/9]

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

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 96 of file Sequence.cpp.

◆ BasicSequence() [7/9]

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

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 103 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 112 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 118 of file Sequence.cpp.

◆ ~BasicSequence()

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

Definition at line 333 of file Sequence.h.

Member Function Documentation

◆ addElement() [1/8]

virtual void bpp::SymbolList::addElement ( const std::string &  c)
throw (BadCharException
)
pure virtualinherited

Add a character to the end of the list.

Parameters
cThe character to add, given as a string.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::getPutativeHaplotypes(), bpp::AbstractReverseTransliterator::reverse(), and bpp::AbstractTransliterator::translate().

◆ addElement() [2/8]

virtual void bpp::SymbolList::addElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
pure 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.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ addElement() [3/8]

virtual void bpp::SymbolList::addElement ( int  v)
throw (BadIntException
)
pure virtualinherited

Add a character to the end of the list.

Parameters
vThe character to add, given as an int.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ addElement() [4/8]

virtual void bpp::SymbolList::addElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
pure virtualinherited

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
vThe character to add, given as an int.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ addElement() [5/8]

void BasicSymbolList::addElement ( const std::string &  c)
throw (BadCharException
)
virtualinherited

Add a character to the end of the list.

Parameters
cThe character to add, given as a string.

Implements bpp::SymbolList.

Definition at line 121 of file SymbolList.cpp.

Referenced by bpp::NucleicAcidsReplication::reverse(), and bpp::NucleicAcidsReplication::translate().

◆ addElement() [6/8]

void BasicSymbolList::addElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
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::SymbolList.

Definition at line 128 of file SymbolList.cpp.

◆ addElement() [7/8]

void BasicSymbolList::addElement ( int  v)
throw (BadIntException
)
virtualinherited

Add a character to the end of the list.

Parameters
vThe character to add, given as an int.

Implements bpp::SymbolList.

Definition at line 181 of file SymbolList.cpp.

◆ addElement() [8/8]

void BasicSymbolList::addElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
virtualinherited

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
vThe character to add, given as an int.

Implements bpp::SymbolList.

Definition at line 190 of file SymbolList.cpp.

◆ append() [1/3]

void BasicSequence::append ( const std::vector< int > &  content)
throw (BadIntException
)
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 193 of file Sequence.cpp.

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

◆ append() [2/3]

void BasicSequence::append ( const std::vector< std::string > &  content)
throw (BadCharException
)
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 204 of file Sequence.cpp.

◆ append() [3/3]

void BasicSequence::append ( const std::string &  content)
throw (BadCharException
)
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 216 of file Sequence.cpp.

References bpp::StringSequenceTools::codeSequence().

◆ clone()

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

Implements bpp::Sequence.

Definition at line 342 of file Sequence.h.

References BasicSequence().

◆ deleteElement() [1/2]

virtual void bpp::SymbolList::deleteElement ( size_t  pos)
throw (IndexOutOfBoundsException
)
pure virtualinherited

Delete the element at position 'pos'.

Parameters
posThe position of the element to delete.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::getCDS(), bpp::SequenceTools::removeGaps(), and bpp::VectorSiteContainer::removeSequence().

◆ deleteElement() [2/2]

void BasicSymbolList::deleteElement ( size_t  pos)
throw (IndexOutOfBoundsException
)
virtualinherited

Delete the element at position 'pos'.

Parameters
posThe position of the element to delete.

Implements bpp::SymbolList.

Definition at line 163 of file SymbolList.cpp.

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

◆ deleteElements() [1/2]

virtual void bpp::SymbolList::deleteElements ( size_t  pos,
size_t  len 
)
throw (IndexOutOfBoundsException
)
pure virtualinherited

Delete the elements at position 'pos'.

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

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ deleteElements() [2/2]

void BasicSymbolList::deleteElements ( size_t  pos,
size_t  len 
)
throw (IndexOutOfBoundsException
)
virtualinherited

Delete the elements at position 'pos'.

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

Implements bpp::SymbolList.

Definition at line 172 of file SymbolList.cpp.

◆ getAlphabet() [1/2]

◆ getAlphabet() [2/2]

virtual const Alphabet* bpp::BasicSymbolList::getAlphabet ( ) const
inlinevirtualinherited

◆ getChar() [1/2]

virtual std::string bpp::SymbolList::getChar ( size_t  pos) const
throw (IndexOutOfBoundsException
)
pure virtualinherited

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

Parameters
posThe position of the character to retrieve.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SiteContainerTools::resolveDottedAlignment().

◆ getChar() [2/2]

string BasicSymbolList::getChar ( size_t  pos) const
throw (IndexOutOfBoundsException
)
virtualinherited

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

Parameters
posThe position of the character to retrieve.

Implements bpp::SymbolList.

Definition at line 145 of file SymbolList.cpp.

Referenced by bpp::SiteContainerTools::resolveDottedAlignment().

◆ getComments()

const Comments& bpp::BasicSequence::getComments ( ) const
inlinevirtual

Get the comments associated to this sequence.

Returns
The comments of the sequence.

Implements bpp::Sequence.

Definition at line 379 of file Sequence.h.

References comments_.

Referenced by operator=().

◆ getContent() [1/2]

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

◆ getContent() [2/2]

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

Get the whole content of the list as a vector of int.

Returns
A reference to the content of the list.

Implements bpp::SymbolList.

Definition at line 352 of file SymbolList.h.

References bpp::BasicSymbolList::content_.

Referenced by bpp::Site::operator=(), and bpp::BasicSymbolList::operator=().

◆ getName()

const std::string& bpp::BasicSequence::getName ( ) const
inlinevirtual

Get the name of this sequence.

Returns
This sequence name.

Implements bpp::Sequence.

Definition at line 357 of file Sequence.h.

References name_.

Referenced by operator=().

◆ getValue() [1/2]

virtual int bpp::SymbolList::getValue ( size_t  pos) const
throw (IndexOutOfBoundsException
)
pure virtualinherited

Get the element at position 'pos' as an int.

Parameters
posThe position of the character to retrieve.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

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

◆ getValue() [2/2]

int BasicSymbolList::getValue ( size_t  pos) const
throw (IndexOutOfBoundsException
)
virtualinherited

Get the element at position 'pos' as an int.

Parameters
posThe position of the character to retrieve.

Implements bpp::SymbolList.

Definition at line 212 of file SymbolList.cpp.

Referenced by bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::isFourFoldDegenerated(), and bpp::CodonSiteTools::numberOfSubsitutions().

◆ operator=() [1/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 126 of file Sequence.cpp.

References comments_, bpp::Sequence::getComments(), bpp::Sequence::getName(), name_, and bpp::BasicSymbolList::operator=().

◆ operator=() [2/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 134 of file Sequence.cpp.

References comments_, getComments(), getName(), name_, and bpp::BasicSymbolList::operator=().

◆ operator[]() [1/4]

virtual const int& bpp::SymbolList::operator[] ( size_t  i) const
pure virtualinherited

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ operator[]() [2/4]

virtual int& bpp::SymbolList::operator[] ( size_t  i)
pure virtualinherited

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ operator[]() [3/4]

virtual const int& bpp::BasicSymbolList::operator[] ( size_t  i) const
inlinevirtualinherited

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implements bpp::SymbolList.

Definition at line 380 of file SymbolList.h.

References bpp::BasicSymbolList::content_.

◆ operator[]() [4/4]

virtual int& bpp::BasicSymbolList::operator[] ( size_t  i)
inlinevirtualinherited

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implements bpp::SymbolList.

Definition at line 382 of file SymbolList.h.

References bpp::BasicSymbolList::content_.

◆ setComments()

void bpp::BasicSequence::setComments ( const Comments comments)
inlinevirtual

Set the comments associated to this sequence.

Parameters
commentsThe new comments of the sequence.

Implements bpp::Sequence.

Definition at line 386 of file Sequence.h.

References comments_.

◆ setContent() [1/3]

void BasicSequence::setContent ( const std::string &  sequence)
throw (BadCharException
)
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 144 of file Sequence.cpp.

References bpp::StringSequenceTools::codeSequence().

◆ setContent() [2/3]

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

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.

Implements bpp::Sequence.

Definition at line 404 of file Sequence.h.

References bpp::BasicSymbolList::setContent().

◆ setContent() [3/3]

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

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.

Implements bpp::Sequence.

Definition at line 408 of file Sequence.h.

References bpp::BasicSymbolList::setContent().

◆ setElement() [1/4]

virtual void bpp::SymbolList::setElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
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::EdSymbolList, and bpp::BasicSymbolList.

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

◆ setElement() [2/4]

virtual void bpp::SymbolList::setElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
pure virtualinherited

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

Parameters
posThe position of the character to set.
vThe value of the element, given as an int.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ setElement() [3/4]

void BasicSymbolList::setElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
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.

Implements bpp::SymbolList.

Definition at line 136 of file SymbolList.cpp.

◆ setElement() [4/4]

void BasicSymbolList::setElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
virtualinherited

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

Parameters
posThe position of the character to set.
vThe value of the element, given as an int.

Implements bpp::SymbolList.

Definition at line 201 of file SymbolList.cpp.

◆ setName()

void bpp::BasicSequence::setName ( const std::string &  name)
inlinevirtual

Set the name of this sequence.

Parameters
nameThe new name of the sequence.

Implements bpp::Sequence.

Definition at line 364 of file Sequence.h.

References name_.

◆ 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::Sequence.

Definition at line 172 of file Sequence.cpp.

References bpp::BasicSymbolList::content_, bpp::BasicSymbolList::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::Sequence.

Definition at line 153 of file Sequence.cpp.

References bpp::BasicSymbolList::content_, bpp::BasicSymbolList::getAlphabet(), and bpp::Alphabet::getGapCharacterCode().

◆ shuffle() [1/2]

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

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

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ shuffle() [2/2]

virtual void bpp::BasicSymbolList::shuffle ( )
inlinevirtualinherited

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

Implements bpp::SymbolList.

Definition at line 384 of file SymbolList.h.

References bpp::BasicSymbolList::content_.

◆ size() [1/2]

◆ size() [2/2]

◆ toString() [1/2]

virtual std::string bpp::SymbolList::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::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::AbstractSequenceContainer::toString().

◆ toString() [2/2]

string BasicSymbolList::toString ( ) const
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.

Implements bpp::SymbolList.

Definition at line 114 of file SymbolList.cpp.

References bpp::BasicSymbolList::alphabet_, bpp::BasicSymbolList::content_, and bpp::StringSequenceTools::decodeSequence().

Member Data Documentation

◆ comments_

Comments bpp::BasicSequence::comments_
private

The sequence comments.

Definition at line 221 of file Sequence.h.

Referenced by getComments(), operator=(), and setComments().

◆ content_

◆ name_

std::string bpp::BasicSequence::name_
private

The sequence name.

Definition at line 216 of file Sequence.h.

Referenced by getName(), operator=(), and setName().


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