|
bpp-seq
2.1.0
|
The sequence interface. More...
#include <Bpp/Seq/Sequence.h>
Inheritance diagram for bpp::Sequence:
Collaboration diagram for bpp::Sequence:Public Member Functions | |
| virtual | ~Sequence () |
| Sequence * | clone () const =0 |
| virtual const Alphabet * | getAlphabet () 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. | |
| |
| 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. | |
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.
Definition at line 74 of file Sequence.h.
| virtual bpp::Sequence::~Sequence | ( | ) | [inline, virtual] |
Definition at line 78 of file Sequence.h.
| virtual void bpp::SymbolList::addElement | ( | const std::string & | c | ) | throw (BadCharException) [pure virtual, inherited] |
Add a character to the end of the list.
| c | The 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.
| pos | The postion where to insert the element. |
| c | The 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.
| v | The 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.
| pos | The postion where to insert the element. |
| v | The 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.
| content | The content to append to the sequence. |
| BadIntException | If 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.
| content | The content to append to the sequence. |
| BadCharException | If 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.
| content | The content to append to the sequence. |
| BadCharException | If the content does not match the current alphabet. |
Implemented in bpp::SequenceWithQuality, bpp::BasicSequence, and bpp::SequenceWithAnnotation.
| Sequence* bpp::Sequence::clone | ( | ) | const [pure virtual] |
Implements bpp::SymbolList.
Implemented in bpp::SequenceWithQuality, bpp::BasicSequence, and bpp::SequenceWithAnnotation.
Referenced by bpp::SequenceTools::getInvert(), and bpp::SequenceTools::getSequenceWithoutGaps().
| virtual void bpp::SymbolList::deleteElement | ( | size_t | pos | ) | throw (IndexOutOfBoundsException) [pure virtual, inherited] |
Delete the element at position 'pos'.
| pos | The 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'.
| pos | The position of the first element to delete. |
| len | The length of the region to delete. |
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
| virtual const Alphabet* bpp::SymbolList::getAlphabet | ( | ) | const [pure virtual, inherited] |
Get the alphabet associated to the list.
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
Referenced by bpp::SymbolListTools::changeGapsToUnknownCharacters(), bpp::SymbolListTools::changeUnresolvedCharactersToGaps(), bpp::SequenceTools::findFirstOf(), bpp::SequenceTools::getCDS(), bpp::SymbolListTools::getCounts(), bpp::SequenceTools::getNumberOfCompleteSites(), bpp::SequenceTools::getNumberOfSites(), bpp::SequenceTools::getNumberOfUnresolvedSites(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::SequenceTools::getSequenceWithoutGaps(), bpp::SequenceTools::invertComplement(), bpp::BasicSymbolList::operator=(), bpp::EdSymbolList::operator=(), and bpp::SequenceTools::removeGaps().
| virtual std::string bpp::SymbolList::getChar | ( | size_t | pos | ) | const throw (IndexOutOfBoundsException) [pure virtual, inherited] |
Get the element at position 'pos' as a character.
| pos | The 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.
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] |
Get the whole content of the list as a vector of int.
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
Referenced by bpp::SequenceWithQualityTools::complement(), bpp::AbstractSequenceContainer::getContent(), bpp::SymbolListTools::getCounts(), bpp::BasicSymbolList::operator=(), bpp::EdSymbolList::operator=(), bpp::SequenceWithQualityTools::reverseTranscript(), and bpp::SequenceWithQualityTools::transcript().
| virtual const std::string& bpp::Sequence::getName | ( | ) | const [pure virtual] |
Get the name of this sequence.
Implemented in bpp::BasicSequence, and bpp::SequenceWithAnnotation.
Referenced by bpp::MapSequenceContainer::addSequence(), bpp::AbstractSequenceContainer::getName(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::SequenceWithAnnotation::operator=(), bpp::BasicSequence::operator=(), and bpp::Clustal::writeAlignment().
| virtual int bpp::SymbolList::getValue | ( | size_t | pos | ) | const throw (IndexOutOfBoundsException) [pure virtual, inherited] |
Get the element at position 'pos' as an int.
| pos | The 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.
| i | The position to retrieve. |
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.
| i | The position to retrieve. |
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
| virtual void bpp::Sequence::setComments | ( | const Comments & | comments | ) | [pure virtual] |
Set the comments associated to this sequence.
| comments | The 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.
| sequence | The new content of the sequence. |
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.
| list | The new content of the list. |
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.
| list | The new content of the list. |
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'.
| pos | The position of the character to set. |
| c | The 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'.
| pos | The position of the character to set. |
| v | The 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.
| name | The 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.
| newSize | The 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.
| newSize | The 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 size_t bpp::SymbolList::size | ( | ) | const [pure virtual, inherited] |
Get the number of elements in the list.
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
Referenced by bpp::SymbolListTools::changeGapsToUnknownCharacters(), bpp::SymbolListTools::changeUnresolvedCharactersToGaps(), bpp::SequenceTools::findFirstOf(), bpp::SiteContainerTools::getAlignmentPositions(), bpp::SequenceTools::getCDS(), bpp::GeneticCode::getCodingSequence(), bpp::SymbolListTools::getCounts(), bpp::SymbolListTools::getFrequencies(), bpp::SequenceTools::getNumberOfCompleteSites(), bpp::SequenceTools::getNumberOfSites(), bpp::SequenceTools::getNumberOfUnresolvedSites(), bpp::SequenceTools::getPutativeHaplotypes(), bpp::SiteContainerTools::getSequencePositions(), bpp::SequenceTools::getSequenceWithoutGaps(), bpp::SequenceMask::init(), bpp::SequenceQuality::init(), bpp::SequenceTools::invert(), bpp::SequenceTools::invertComplement(), bpp::SequenceTools::removeGaps(), bpp::SiteContainerTools::resolveDottedAlignment(), bpp::SequenceContainerTools::sequencesHaveTheSameLength(), and bpp::SequenceWalker::SequenceWalker().
| 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.
Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.
Referenced by bpp::AbstractSequenceContainer::toString().