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) |
| 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 occurrence of a character in the sequence. More...
|
|
static std::string | deleteChar (const std::string &sequence, std::string chars) |
| Delete all occurrence 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) |
| Calculate the local GC content of a sequence. More...
|
|
static std::vector< int > | codeSequence (const std::string &sequence, std::shared_ptr< const Alphabet > &alphabet) |
| Convert a string sequence to a vector of int. More...
|
|
static std::string | decodeSequence (const std::vector< int > &sequence, std::shared_ptr< const Alphabet > &alphabet) |
| Convert a sequence to its string representation. More...
|
|
static std::shared_ptr< const Alphabet > | getAlphabetFromSequence (const std::string &sequence) |
| 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, SymbolListTools
Definition at line 31 of file StringSequenceTools.h.
◆ StringSequenceTools()
bpp::StringSequenceTools::StringSequenceTools |
( |
| ) |
|
|
inline |
◆ ~StringSequenceTools()
bpp::StringSequenceTools::~StringSequenceTools |
( |
| ) |
|
|
inline |
◆ codeSequence()
vector< int > StringSequenceTools::codeSequence |
( |
const std::string & |
sequence, |
|
|
std::shared_ptr< const Alphabet > & |
alphabet |
|
) |
| |
|
static |
◆ complement()
string * StringSequenceTools::complement |
( |
const std::string & |
sequence | ) |
|
|
static |
◆ decodeSequence()
string StringSequenceTools::decodeSequence |
( |
const std::vector< int > & |
sequence, |
|
|
std::shared_ptr< const Alphabet > & |
alphabet |
|
) |
| |
|
static |
◆ deleteChar() [1/2]
string StringSequenceTools::deleteChar |
( |
const std::string & |
sequence, |
|
|
char |
chars |
|
) |
| |
|
static |
Delete all occurrence 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 57 of file StringSequenceTools.cpp.
◆ deleteChar() [2/2]
string StringSequenceTools::deleteChar |
( |
const std::string & |
sequence, |
|
|
std::string |
chars |
|
) |
| |
|
static |
Delete all occurrence 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 74 of file StringSequenceTools.cpp.
◆ getAlphabetFromSequence()
std::shared_ptr< const Alphabet > StringSequenceTools::getAlphabetFromSequence |
( |
const std::string & |
sequence | ) |
|
|
static |
◆ getGCcontent()
double StringSequenceTools::getGCcontent |
( |
const std::string & |
sequence, |
|
|
size_t |
pos, |
|
|
size_t |
window |
|
) |
| |
|
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
-
Definition at line 159 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 95 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 50 of file StringSequenceTools.cpp.
References bpp::TextTools::resizeLeft().
◆ 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 45 of file StringSequenceTools.cpp.
References bpp::TextTools::resizeRight().
◆ subseq()
string StringSequenceTools::subseq |
( |
const std::string & |
sequence, |
|
|
size_t |
begin, |
|
|
size_t |
end |
|
) |
| |
|
static |
Get a subsequence.
- Parameters
-
sequence | The input sequence. |
begin | The beginning 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 26 of file StringSequenceTools.cpp.
The documentation for this class was generated from the following files: