bpp-seq  2.1.0
bpp::SequenceWithAnnotation Class Reference

An implementation of the Sequence interface that supports annotation. More...

#include <Bpp/Seq/SequenceWithAnnotation.h>

+ Inheritance diagram for bpp::SequenceWithAnnotation:
+ Collaboration diagram for bpp::SequenceWithAnnotation:

List of all members.

Public Member Functions

 SequenceWithAnnotation (const Alphabet *alpha)
 Empty constructor: build a void Sequence with just an Alphabet.
 SequenceWithAnnotation (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.
 SequenceWithAnnotation (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.
 SequenceWithAnnotation (const std::string &name, const std::vector< std::string > &sequence, const Alphabet *alpha) throw (BadCharException)
 General purpose constructor, can be used with any alphabet.
 SequenceWithAnnotation (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.
 SequenceWithAnnotation (const std::string &name, const std::vector< int > &sequence, const Alphabet *alpha) throw (BadIntException)
 General purpose constructor, can be used with any alphabet.
 SequenceWithAnnotation (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.
 SequenceWithAnnotation (const Sequence &s)
 The Sequence generic copy constructor. This does not perform a hard copy of the alphabet object.
 SequenceWithAnnotation (const SequenceWithAnnotation &s)
 The Sequence copy constructor. This does not perform a hard copy of the alphabet object.
SequenceWithAnnotationoperator= (const Sequence &s)
 The Sequence generic assignment operator. This does not perform a hard copy of the alphabet object.
SequenceWithAnnotationoperator= (const SequenceWithAnnotation &s)
 The Sequence assignment operator. This does not perform a hard copy of the alphabet object.
virtual ~SequenceWithAnnotation ()
virtual void addAnnotation (SequenceAnnotation *anno) throw (Exception)
 Add a new annotation to the sequence.
virtual bool hasAnnotation (const std::string &type) const
virtual const SequenceAnnotationgetAnnotation (const std::string &type) const
virtual SequenceAnnotationgetAnnotation (const std::string &type)
virtual std::vector< std::string > getAnnotationTypes () const
virtual void merge (const SequenceWithAnnotation &swa) throw (AlphabetMismatchException, Exception)
 Merge a sequence with the current one.
virtual const AlphabetgetAlphabet () const =0
 Get the alphabet associated to the list.
virtual size_t size () const =0
 Get the number of elements in the list.
virtual std::string toString () const =0
 Convert the list as a string.
virtual const AlphabetgetAlphabet () const
 Get the alphabet associated to the list.
virtual size_t size () const
 Get the number of elements in the list.
virtual const std::vector< int > & getContent () const
 Get the whole content of the list as a vector of int.
virtual std::string toString () const
 Convert the list as a string.
virtual void addElement (const std::string &c) throw (BadCharException)
 Add a character to the end of the list.
virtual void addElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException)
 Add a character at a certain position in the list.
virtual void addElement (int v) throw (BadIntException)
 Add a character to the end of the list.
virtual void addElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException)
 Add a character at a certain position in the list.
virtual void setElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'c'.
virtual void setElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'v'.
virtual void deleteElement (size_t pos) throw (IndexOutOfBoundsException)
 Delete the element at position 'pos'.
virtual void deleteElements (size_t pos, size_t len) throw (IndexOutOfBoundsException)
 Delete the elements at position 'pos'.
virtual std::string getChar (size_t pos) const throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as a character.
virtual int getValue (size_t pos) const throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as an int.
virtual const int & operator[] (size_t i) const
 Operator [] overloaded for quick access to a character in list.
virtual int & operator[] (size_t i)
 Operator [] overloaded for quick access to a character in list.
virtual void shuffle ()
 Randomly shuffle the content of the list, with linear complexity.
The Clonable interface
SequenceWithAnnotationclone () const
Setting/getting the name of the sequence.
const std::string & getName () const
 Get the name of this sequence.
void setName (const std::string &name)
 Set the name of this sequence.
Setting/getting the comments associated to the sequence.
const Comments & getComments () const
 Get the comments associated to this sequence.
void setComments (const Comments &comments)
 Set the comments associated to this sequence.
Adjusting the size of the sequence.
virtual void setContent (const std::string &sequence) throw (BadCharException)
 Set the whole content of the sequence.
void setContent (const std::vector< int > &list) throw (BadIntException)
 Set the whole content of the list.
void setContent (const std::vector< std::string > &list) throw (BadCharException)
 Set the whole content of the list.
virtual void setToSizeR (size_t newSize)
 Set up the size of a sequence from the right side.
virtual void setToSizeL (size_t newSize)
 Set up the size of a sequence from the left side.
void append (const std::vector< int > &content) throw (BadIntException)
 Append the specified content to the sequence.
void append (const std::vector< std::string > &content) throw (BadCharException)
 Append the specified content to the sequence.
void append (const std::string &content) throw (BadCharException)
 Append the specified content to the sequence.
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.
Edition methods.
virtual void addElement (const std::string &c)=0 throw (BadCharException)
 Add a character to the end of the list.
virtual void addElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Add a character at a certain position in the list.
virtual void addElement (int v)=0 throw (BadIntException)
 Add a character to the end of the list.
virtual void addElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Add a character at a certain position in the list.
virtual void setElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'c'.
virtual void setElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'v'.
virtual void deleteElement (size_t pos)=0 throw (IndexOutOfBoundsException)
 Delete the element at position 'pos'.
virtual void deleteElements (size_t pos, size_t len)=0 throw (IndexOutOfBoundsException)
 Delete the elements at position 'pos'.
virtual std::string getChar (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as a character.
virtual int getValue (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as an int.
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.
virtual int & operator[] (size_t i)=0
 Operator [] overloaded for quick access to a character in list.
virtual void shuffle ()=0
 Randomly shuffle the content of the list, with linear complexity.

Protected Member Functions

void propagateEvents (bool yn)
bool propagateEvents () const

Protected Attributes

std::vector< int > content_
 The list content.
std::vector< SymbolListListener * > listeners_
 Contains the listeners.

Private Attributes

std::string name_
 The sequence name.
Comments comments_
 The sequence comments.

Events handling

virtual size_t getNumberOfListeners () const
virtual const SymbolListListenergetListener (size_t i) const
virtual SymbolListListenergetListener (size_t i)
virtual void addSymbolListListener (SymbolListListener *listener)
virtual void removeSymbolListListener (SymbolListListener *listener)
virtual void beforeSequenceChanged (const SymbolListEditionEvent &event)
virtual void afterSequenceChanged (const SymbolListEditionEvent &event)
virtual void beforeSequenceInserted (const SymbolListInsertionEvent &event)
virtual void afterSequenceInserted (const SymbolListInsertionEvent &event)
virtual void beforeSequenceDeleted (const SymbolListDeletionEvent &event)
virtual void afterSequenceDeleted (const SymbolListDeletionEvent &event)
virtual void beforeSequenceSubstituted (const SymbolListSubstitutionEvent &event)
virtual void afterSequenceSubstituted (const SymbolListSubstitutionEvent &event)
void fireBeforeSequenceChanged (const SymbolListEditionEvent &event)
void fireAfterSequenceChanged (const SymbolListEditionEvent &event)
void fireBeforeSequenceInserted (const SymbolListInsertionEvent &event)
void fireAfterSequenceInserted (const SymbolListInsertionEvent &event)
void fireBeforeSequenceDeleted (const SymbolListDeletionEvent &event)
void fireAfterSequenceDeleted (const SymbolListDeletionEvent &event)
void fireBeforeSequenceSubstituted (const SymbolListSubstitutionEvent &event)
void fireAfterSequenceSubstituted (const SymbolListSubstitutionEvent &event)

Detailed Description

An implementation of the Sequence interface that supports annotation.

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.

The gestion of sequence content is identical to the BasicSequence object, but edition events are properly fired. Listener are therefore properly handled.

See also:
BasicSequence

Definition at line 118 of file SequenceWithAnnotation.h.


Constructor & Destructor Documentation

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 55 of file SequenceWithAnnotation.cpp.

Referenced by clone().

SequenceWithAnnotation::SequenceWithAnnotation ( 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 61 of file SequenceWithAnnotation.cpp.

SequenceWithAnnotation::SequenceWithAnnotation ( 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 71 of file SequenceWithAnnotation.cpp.

SequenceWithAnnotation::SequenceWithAnnotation ( 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 81 of file SequenceWithAnnotation.cpp.

SequenceWithAnnotation::SequenceWithAnnotation ( 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 88 of file SequenceWithAnnotation.cpp.

SequenceWithAnnotation::SequenceWithAnnotation ( 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 95 of file SequenceWithAnnotation.cpp.

SequenceWithAnnotation::SequenceWithAnnotation ( 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 102 of file SequenceWithAnnotation.cpp.

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

Definition at line 111 of file SequenceWithAnnotation.cpp.

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

Definition at line 117 of file SequenceWithAnnotation.cpp.

Definition at line 244 of file SequenceWithAnnotation.h.


Member Function Documentation

virtual void bpp::SequenceWithAnnotation::addAnnotation ( SequenceAnnotation anno) throw (Exception) [inline, virtual]

Add a new annotation to the sequence.

Parameters:
annoThe annotation object to be added. Unless the annotation is shared, the annotation object will be owned by the sequence object, and will be copied and deleted when needed.
Exceptions:
ExceptionIf the annotation is not valid for this sequence.
See also:
SequenceWithAnnotation::isValidWith

Definition at line 380 of file SequenceWithAnnotation.h.

References bpp::EdSymbolList::addSymbolListListener().

Referenced by bpp::SequenceWithAnnotationTools::createMaskAnnotation(), and bpp::SequenceWithQuality::SequenceWithQuality().

virtual void bpp::SymbolList::addElement ( const std::string &  c) throw (BadCharException) [pure virtual, inherited]

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().

virtual void bpp::SymbolList::addElement ( size_t  pos,
const std::string &  c 
) throw (BadCharException, IndexOutOfBoundsException) [pure virtual, inherited]

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.

virtual void bpp::SymbolList::addElement ( int  v) throw (BadIntException) [pure virtual, inherited]

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.

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

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.

void EdSymbolList::addElement ( const std::string &  c) throw (BadCharException) [virtual, inherited]

Add a character to the end of the list.

Parameters:
cThe character to add, given as a string.

Implements bpp::SymbolList.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 321 of file SymbolList.cpp.

void EdSymbolList::addElement ( size_t  pos,
const std::string &  c 
) throw (BadCharException, IndexOutOfBoundsException) [virtual, inherited]

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.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 331 of file SymbolList.cpp.

void EdSymbolList::addElement ( int  v) throw (BadIntException) [virtual, inherited]

Add a character to the end of the list.

Parameters:
vThe character to add, given as an int.

Implements bpp::SymbolList.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 394 of file SymbolList.cpp.

void EdSymbolList::addElement ( size_t  pos,
int  v 
) throw (BadIntException, IndexOutOfBoundsException) [virtual, inherited]

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.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 406 of file SymbolList.cpp.

virtual void bpp::EdSymbolList::addSymbolListListener ( SymbolListListener listener) [inline, virtual, inherited]

Definition at line 657 of file SymbolList.h.

References bpp::EdSymbolList::listeners_.

Referenced by addAnnotation().

virtual void bpp::EdSymbolList::afterSequenceChanged ( const SymbolListEditionEvent event) [inline, protected, virtual, inherited]

Definition at line 670 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireAfterSequenceChanged().

virtual void bpp::EdSymbolList::afterSequenceDeleted ( const SymbolListDeletionEvent event) [inline, protected, virtual, inherited]

Definition at line 674 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireAfterSequenceDeleted().

virtual void bpp::EdSymbolList::afterSequenceInserted ( const SymbolListInsertionEvent event) [inline, protected, virtual, inherited]

Definition at line 672 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireAfterSequenceInserted().

virtual void bpp::EdSymbolList::afterSequenceSubstituted ( const SymbolListSubstitutionEvent event) [inline, protected, virtual, inherited]

Definition at line 676 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireAfterSequenceSubstituted().

void SequenceWithAnnotation::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.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 206 of file SequenceWithAnnotation.cpp.

void SequenceWithAnnotation::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.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 221 of file SequenceWithAnnotation.cpp.

void SequenceWithAnnotation::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.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 237 of file SequenceWithAnnotation.cpp.

References bpp::StringSequenceTools::codeSequence().

virtual void bpp::EdSymbolList::beforeSequenceChanged ( const SymbolListEditionEvent event) [inline, protected, virtual, inherited]

Definition at line 669 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireBeforeSequenceChanged().

virtual void bpp::EdSymbolList::beforeSequenceDeleted ( const SymbolListDeletionEvent event) [inline, protected, virtual, inherited]

Definition at line 673 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireBeforeSequenceDeleted().

virtual void bpp::EdSymbolList::beforeSequenceInserted ( const SymbolListInsertionEvent event) [inline, protected, virtual, inherited]

Definition at line 671 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireBeforeSequenceInserted().

virtual void bpp::EdSymbolList::beforeSequenceSubstituted ( const SymbolListSubstitutionEvent event) [inline, protected, virtual, inherited]

Definition at line 675 of file SymbolList.h.

Referenced by bpp::EdSymbolList::fireBeforeSequenceSubstituted().

Implements bpp::Sequence.

Reimplemented in bpp::SequenceWithQuality.

Definition at line 253 of file SequenceWithAnnotation.h.

References SequenceWithAnnotation().

virtual void bpp::SymbolList::deleteElement ( size_t  pos) throw (IndexOutOfBoundsException) [pure virtual, inherited]

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().

void EdSymbolList::deleteElement ( size_t  pos) throw (IndexOutOfBoundsException) [virtual, inherited]

Delete the element at position 'pos'.

Parameters:
posThe position of the element to delete.

Implements bpp::SymbolList.

Definition at line 369 of file SymbolList.cpp.

virtual void bpp::SymbolList::deleteElements ( size_t  pos,
size_t  len 
) throw (IndexOutOfBoundsException) [pure virtual, inherited]

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.

void EdSymbolList::deleteElements ( size_t  pos,
size_t  len 
) throw (IndexOutOfBoundsException) [virtual, inherited]

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 381 of file SymbolList.cpp.

virtual const Alphabet* bpp::EdSymbolList::getAlphabet ( ) const [inline, virtual, inherited]

Get the alphabet associated to the list.

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

Implements bpp::SymbolList.

Definition at line 599 of file SymbolList.h.

References bpp::EdSymbolList::alphabet_.

Referenced by bpp::SequenceWithQuality::append(), bpp::EdSymbolList::operator=(), bpp::SequenceWithQualityTools::removeGaps(), setToSizeL(), and setToSizeR().

vector< string > SequenceWithAnnotation::getAnnotationTypes ( ) const [virtual]
Returns:
The list of annotation types contained in this sequence.

Definition at line 244 of file SequenceWithAnnotation.cpp.

References bpp::EdSymbolList::getListener(), bpp::EdSymbolList::getNumberOfListeners(), and bpp::SequenceAnnotation::getType().

virtual std::string bpp::SymbolList::getChar ( size_t  pos) const throw (IndexOutOfBoundsException) [pure virtual, inherited]

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().

string EdSymbolList::getChar ( size_t  pos) const throw (IndexOutOfBoundsException) [virtual, inherited]

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

Parameters:
posThe position of the character to retrieve.

Implements bpp::SymbolList.

Definition at line 354 of file SymbolList.cpp.

const Comments& bpp::SequenceWithAnnotation::getComments ( ) const [inline, virtual]

Get the comments associated to this sequence.

Returns:
The comments of the sequence.

Implements bpp::Sequence.

Definition at line 290 of file SequenceWithAnnotation.h.

References comments_.

Referenced by operator=().

virtual const std::vector<int>& bpp::SymbolList::getContent ( ) const [pure virtual, inherited]
virtual const std::vector<int>& bpp::EdSymbolList::getContent ( ) const [inline, virtual, inherited]

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

References bpp::EdSymbolList::content_.

Referenced by bpp::SequenceWithQualityTools::invert(), and bpp::EdSymbolList::operator=().

virtual const SymbolListListener& bpp::EdSymbolList::getListener ( size_t  i) const [inline, virtual, inherited]

Definition at line 647 of file SymbolList.h.

References bpp::EdSymbolList::listeners_.

Referenced by getAnnotation(), getAnnotationTypes(), and hasAnnotation().

virtual SymbolListListener& bpp::EdSymbolList::getListener ( size_t  i) [inline, virtual, inherited]

Definition at line 652 of file SymbolList.h.

References bpp::EdSymbolList::listeners_.

const std::string& bpp::SequenceWithAnnotation::getName ( ) const [inline, virtual]

Get the name of this sequence.

Returns:
This sequence name.

Implements bpp::Sequence.

Definition at line 268 of file SequenceWithAnnotation.h.

References name_.

Referenced by operator=().

virtual size_t bpp::EdSymbolList::getNumberOfListeners ( ) const [inline, virtual, inherited]

Definition at line 645 of file SymbolList.h.

References bpp::EdSymbolList::listeners_.

Referenced by getAnnotation(), getAnnotationTypes(), and hasAnnotation().

virtual int bpp::SymbolList::getValue ( size_t  pos) const throw (IndexOutOfBoundsException) [pure virtual, inherited]

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().

int EdSymbolList::getValue ( size_t  pos) const throw (IndexOutOfBoundsException) [virtual, inherited]

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

Parameters:
posThe position of the character to retrieve.

Implements bpp::SymbolList.

Definition at line 434 of file SymbolList.cpp.

virtual bool bpp::SequenceWithAnnotation::hasAnnotation ( const std::string &  type) const [inline, virtual]

Merge a sequence with the current one.

Sequences must have the same name and alphabets. Only first sequence's commentaries are kept. Annotations that could not be merged will not be added in the concatenated sequence. See the documentation of each annotation class for more details.

Parameters:
swaThe sequence to merge with.
Exceptions:
AlphabetMismatchExceptionIf the two alphabets do not match.
ExceptionIf the sequence names do not match.

Definition at line 257 of file SequenceWithAnnotation.cpp.

References bpp::SequenceAnnotation::clone(), bpp::SequenceAnnotation::init(), and bpp::SequenceAnnotation::merge().

SequenceWithAnnotation & SequenceWithAnnotation::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 125 of file SequenceWithAnnotation.cpp.

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

Referenced by operator=().

SequenceWithAnnotation & SequenceWithAnnotation::operator= ( const SequenceWithAnnotation 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 133 of file SequenceWithAnnotation.cpp.

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

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

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.

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

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.

virtual const int& bpp::EdSymbolList::operator[] ( size_t  i) const [inline, virtual, inherited]

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

References bpp::EdSymbolList::content_.

virtual int& bpp::EdSymbolList::operator[] ( size_t  i) [inline, virtual, inherited]

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

References bpp::EdSymbolList::content_.

void bpp::EdSymbolList::propagateEvents ( bool  yn) [inline, protected, inherited]

Definition at line 736 of file SymbolList.h.

References bpp::EdSymbolList::propagateEvents_.

bool bpp::EdSymbolList::propagateEvents ( ) const [inline, protected, inherited]

Definition at line 737 of file SymbolList.h.

References bpp::EdSymbolList::propagateEvents_.

virtual void bpp::EdSymbolList::removeSymbolListListener ( SymbolListListener listener) [inline, virtual, inherited]
void bpp::SequenceWithAnnotation::setComments ( const Comments &  comments) [inline, virtual]

Set the comments associated to this sequence.

Parameters:
commentsThe new comments of the sequence.

Implements bpp::Sequence.

Definition at line 297 of file SequenceWithAnnotation.h.

References comments_.

void SequenceWithAnnotation::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 143 of file SequenceWithAnnotation.cpp.

References bpp::StringSequenceTools::codeSequence(), and bpp::TextTools::removeWhiteSpaces().

Referenced by bpp::SequenceWithQualityTools::removeGaps(), and setContent().

void bpp::SequenceWithAnnotation::setContent ( const std::vector< int > &  list) throw (BadIntException) [inline, 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 internaly stored.

Implements bpp::Sequence.

Definition at line 315 of file SequenceWithAnnotation.h.

References setContent().

void bpp::SequenceWithAnnotation::setContent ( const std::vector< std::string > &  list) throw (BadCharException) [inline, 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 internaly stored.

Implements bpp::Sequence.

Definition at line 319 of file SequenceWithAnnotation.h.

References setContent().

virtual void bpp::SymbolList::setElement ( size_t  pos,
const std::string &  c 
) throw (BadCharException, IndexOutOfBoundsException) [pure virtual, inherited]

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().

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

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.

void EdSymbolList::setElement ( size_t  pos,
const std::string &  c 
) throw (BadCharException, IndexOutOfBoundsException) [virtual, inherited]

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 342 of file SymbolList.cpp.

void EdSymbolList::setElement ( size_t  pos,
int  v 
) throw (BadIntException, IndexOutOfBoundsException) [virtual, inherited]

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 420 of file SymbolList.cpp.

void bpp::SequenceWithAnnotation::setName ( const std::string &  name) [inline, virtual]

Set the name of this sequence.

Parameters:
nameThe new name of the sequence.

Implements bpp::Sequence.

Definition at line 275 of file SequenceWithAnnotation.h.

References name_.

void SequenceWithAnnotation::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 180 of file SequenceWithAnnotation.cpp.

References bpp::EdSymbolList::content_, bpp::EdSymbolList::fireAfterSequenceDeleted(), bpp::EdSymbolList::fireAfterSequenceInserted(), bpp::EdSymbolList::fireBeforeSequenceDeleted(), bpp::EdSymbolList::fireBeforeSequenceInserted(), bpp::EdSymbolList::getAlphabet(), and bpp::Alphabet::getGapCharacterCode().

void SequenceWithAnnotation::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 155 of file SequenceWithAnnotation.cpp.

References bpp::EdSymbolList::content_, bpp::EdSymbolList::fireAfterSequenceDeleted(), bpp::EdSymbolList::fireAfterSequenceInserted(), bpp::EdSymbolList::fireBeforeSequenceDeleted(), bpp::EdSymbolList::fireBeforeSequenceInserted(), bpp::EdSymbolList::getAlphabet(), and bpp::Alphabet::getGapCharacterCode().

virtual void bpp::SymbolList::shuffle ( ) [pure virtual, inherited]

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

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

virtual void bpp::EdSymbolList::shuffle ( ) [inline, virtual, inherited]

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

Implements bpp::SymbolList.

Definition at line 635 of file SymbolList.h.

References bpp::EdSymbolList::content_.

virtual size_t bpp::EdSymbolList::size ( ) const [inline, virtual, inherited]

Get the number of elements in the list.

Returns:
The number of sites in the list.

Implements bpp::SymbolList.

Definition at line 601 of file SymbolList.h.

References bpp::EdSymbolList::content_.

Referenced by bpp::SequenceWithQuality::addElement(), bpp::SequenceMask::isValidWith(), bpp::SequenceQuality::isValidWith(), and bpp::SequenceWithQualityTools::removeGaps().

virtual std::string bpp::SymbolList::toString ( ) const [pure virtual, inherited]

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().

string EdSymbolList::toString ( ) const [virtual, inherited]

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 314 of file SymbolList.cpp.

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


Member Data Documentation

The sequence comments.

Definition at line 132 of file SequenceWithAnnotation.h.

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

std::string bpp::SequenceWithAnnotation::name_ [private]

The sequence name.

Definition at line 127 of file SequenceWithAnnotation.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends