bpp-seq  2.1.0
bpp::Sequence Class Reference

The sequence interface. More...

#include <Bpp/Seq/Sequence.h>

+ Inheritance diagram for bpp::Sequence:
+ Collaboration diagram for bpp::Sequence:

List of all members.

Public Member Functions

virtual ~Sequence ()
Sequenceclone () const =0
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.
Setting/getting the name of the sequence.
virtual const std::string & getName () const =0
 Get the name of this sequence.
virtual void setName (const std::string &name)=0
 Set the name of this sequence.
Setting/getting the comments associated to the sequence.
virtual const Comments & getComments () const =0
 Get the comments associated to this sequence.
virtual void setComments (const Comments &comments)=0
 Set the comments associated to this sequence.
Adjusting the size of the sequence.
virtual void setContent (const std::string &sequence)=0 throw (BadCharException)
 Set the whole content of the sequence.
virtual void setContent (const std::vector< int > &list)=0 throw (BadIntException)
 Set the whole content of the list.
virtual void setContent (const std::vector< std::string > &list)=0 throw (BadCharException)
 Set the whole content of the list.
virtual void setToSizeR (size_t newSize)=0
 Set up the size of a sequence from the right side.
virtual void setToSizeL (size_t newSize)=0
 Set up the size of a sequence from the left side.
virtual void append (const std::vector< int > &content)=0 throw (BadIntException)
 Append the specified content to the sequence.
virtual void append (const std::vector< std::string > &content)=0 throw (BadCharException)
 Append the specified content to the sequence.
virtual void append (const std::string &content)=0 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.

Detailed Description

The sequence interface.

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

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

See also:
Alphabet

Definition at line 74 of file Sequence.h.


Constructor & Destructor Documentation

virtual bpp::Sequence::~Sequence ( ) [inline, virtual]

Definition at line 78 of file Sequence.h.


Member Function Documentation

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.

virtual void bpp::Sequence::append ( const std::vector< int > &  content) throw (BadIntException) [pure virtual]

Append the specified content to the sequence.

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

Implemented in bpp::SequenceWithQuality, bpp::BasicSequence, and bpp::SequenceWithAnnotation.

Referenced by bpp::WordAlphabet::reverse().

virtual void bpp::Sequence::append ( const std::vector< std::string > &  content) throw (BadCharException) [pure virtual]

Append the specified content to the sequence.

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

Implemented in bpp::SequenceWithQuality, bpp::BasicSequence, and bpp::SequenceWithAnnotation.

virtual void bpp::Sequence::append ( const std::string &  content) throw (BadCharException) [pure virtual]

Append the specified content to the sequence.

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

Implemented in bpp::SequenceWithQuality, bpp::BasicSequence, and bpp::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().

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.

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

virtual const Comments& bpp::Sequence::getComments ( ) const [pure virtual]

Get the comments associated to this sequence.

Returns:
The comments of the sequence.

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

Referenced by bpp::AbstractSequenceContainer::getComments(), bpp::SequenceWithAnnotation::operator=(), and bpp::BasicSequence::operator=().

virtual const std::vector<int>& bpp::SymbolList::getContent ( ) const [pure virtual, inherited]
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().

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 void bpp::Sequence::setComments ( const Comments &  comments) [pure virtual]

Set the comments associated to this sequence.

Parameters:
commentsThe new comments of the sequence.

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

virtual void bpp::Sequence::setContent ( const std::string &  sequence) throw (BadCharException) [pure virtual]

Set the whole content of the sequence.

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

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

Referenced by bpp::SequenceTools::getSequenceWithoutGaps(), and bpp::SequenceTools::getSequenceWithoutStops().

virtual void bpp::Sequence::setContent ( const std::vector< int > &  list) throw (BadIntException) [pure 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::SymbolList.

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

virtual void bpp::Sequence::setContent ( const std::vector< std::string > &  list) throw (BadCharException) [pure 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::SymbolList.

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

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.

virtual void bpp::Sequence::setName ( const std::string &  name) [pure virtual]

Set the name of this sequence.

Parameters:
nameThe new name of the sequence.

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

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

virtual void bpp::Sequence::setToSizeL ( size_t  newSize) [pure 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.

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

virtual void bpp::Sequence::setToSizeR ( size_t  newSize) [pure 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.

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

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


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