Utilitary methods working on raw string objects.
More...
#include <Bpp/Seq/StringSequenceTools.h>
|
static std::string | subseq (const std::string &sequence, size_t begin, size_t end) throw (Exception) |
| Get a subsequence. More...
|
|
static std::string | setToSizeR (const std::string &sequence, size_t size) |
| Set up the size of a sequence from the right side. More...
|
|
static std::string | setToSizeL (const std::string &sequence, size_t size) |
| Set up the size of a sequence from the left side. More...
|
|
static std::string | deleteChar (const std::string &sequence, char chars) |
| Delete all occurence of a character in the sequence. More...
|
|
static std::string | deleteChar (const std::string &sequence, std::string chars) |
| Delete all occurence of several characters in the sequence. More...
|
|
static std::string * | reverse (const std::string &sequence) |
| Reverse the sequence. More...
|
|
static std::string * | complement (const std::string &sequence) |
| Get the complement of a sequence. More...
|
|
static double | getGCcontent (const std::string &sequence, size_t pos, size_t window) throw (BadIntegerException, Exception) |
| Calculate the local GC content of a sequence. More...
|
|
static std::vector< int > | codeSequence (const std::string &sequence, const Alphabet *alphabet) throw (BadCharException) |
| Convert a string sequence to a vector of int. More...
|
|
static std::string | decodeSequence (const std::vector< int > &sequence, const Alphabet *alphabet) throw (BadIntException) |
| Convert a sequence to its string representation. More...
|
|
static Alphabet * | getAlphabetFromSequence (const std::string &sequence) throw (EmptySequenceException, SequenceException, AlphabetException) |
| Parse a sequence and try to guess the correct alphabet to use. More...
|
|
Utilitary methods working on raw string objects.
Sequences may be stored as strings, but this approach is not as powerful as using true sequence objects. Consider using the Sequence and SequenceTools classes for more methods.
Some of the methods implemented here are internally used by the Sequence object.
- See also
- Sequence, Site, SequenceTools, SiteTools
Definition at line 66 of file StringSequenceTools.h.
◆ StringSequenceTools()
bpp::StringSequenceTools::StringSequenceTools |
( |
| ) |
|
|
inline |
◆ ~StringSequenceTools()
bpp::StringSequenceTools::~StringSequenceTools |
( |
| ) |
|
|
inline |
◆ codeSequence()
vector< int > StringSequenceTools::codeSequence |
( |
const std::string & |
sequence, |
|
|
const Alphabet * |
alphabet |
|
) |
| |
throw | ( | BadCharException |
| ) | | |
|
static |
◆ complement()
string * StringSequenceTools::complement |
( |
const std::string & |
sequence | ) |
|
|
static |
◆ decodeSequence()
string StringSequenceTools::decodeSequence |
( |
const std::vector< int > & |
sequence, |
|
|
const Alphabet * |
alphabet |
|
) |
| |
throw | ( | BadIntException |
| ) | | |
|
static |
◆ deleteChar() [1/2]
string StringSequenceTools::deleteChar |
( |
const std::string & |
sequence, |
|
|
char |
chars |
|
) |
| |
|
static |
Delete all occurence of a character in the sequence.
- Parameters
-
sequence | The sequence to parse. |
chars | The character to remove. |
- Returns
- The sequence with all specified characters removed.
Definition at line 92 of file StringSequenceTools.cpp.
◆ deleteChar() [2/2]
string StringSequenceTools::deleteChar |
( |
const std::string & |
sequence, |
|
|
std::string |
chars |
|
) |
| |
|
static |
Delete all occurence of several characters in the sequence.
- Parameters
-
sequence | The sequence to parse. |
chars | The characters to remove. |
- Returns
- The sequence with all specified characters removed.
Definition at line 109 of file StringSequenceTools.cpp.
◆ getAlphabetFromSequence()
◆ getGCcontent()
double StringSequenceTools::getGCcontent |
( |
const std::string & |
sequence, |
|
|
size_t |
pos, |
|
|
size_t |
window |
|
) |
| |
throw | ( | BadIntegerException, |
| | Exception |
| ) | | |
|
static |
Calculate the local GC content of a sequence.
GC contents are calculated using a window of specified size around the given position. Note : Calculus for last nucleotides (sequence's size - window size) will return the last possible rate calculated.
- Parameters
-
sequence | The sequence to analyse. |
pos | The position where to compute the GC content. |
window | The size of the window to use. |
- Returns
- The GC content as a ratio (# of GC / window).
- Exceptions
-
BadIntException | If the sequence is not of type DNA or RNA. |
Exception | Error in calculus (if the sequence contain gaps for instance). |
Definition at line 194 of file StringSequenceTools.cpp.
◆ reverse()
string * StringSequenceTools::reverse |
( |
const std::string & |
sequence | ) |
|
|
static |
Reverse the sequence.
- Parameters
-
sequence | The sequence to reverse. |
- Returns
- The reversed sequence.
Definition at line 130 of file StringSequenceTools.cpp.
◆ setToSizeL()
string StringSequenceTools::setToSizeL |
( |
const std::string & |
sequence, |
|
|
size_t |
size |
|
) |
| |
|
static |
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
-
sequence | The input sequence. |
size | The new size of the sequence. |
Definition at line 85 of file StringSequenceTools.cpp.
◆ setToSizeR()
string StringSequenceTools::setToSizeR |
( |
const std::string & |
sequence, |
|
|
size_t |
size |
|
) |
| |
|
static |
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
-
sequence | The input sequence. |
size | The new size of the sequence. |
Definition at line 80 of file StringSequenceTools.cpp.
◆ subseq()
string StringSequenceTools::subseq |
( |
const std::string & |
sequence, |
|
|
size_t |
begin, |
|
|
size_t |
end |
|
) |
| |
throw | ( | Exception |
| ) | | |
|
static |
Get a subsequence.
- Parameters
-
sequence | The input sequence. |
begin | The begining position (included). |
end | The ending position (included). |
- Returns
- A string with the subsequence.
- Exceptions
-
Exception | If position does not not match the interval [0, length]. |
Definition at line 61 of file StringSequenceTools.cpp.
The documentation for this class was generated from the following files: