MDA
|
A generic class to represent a plain sequence. More...
#include <Sequence.hpp>
Public Member Functions | |
Constructors & Destructors | |
Sequence (const std::string &seq_name, const std::string &seq, const std::string &comment_="", size_t seq_id=0) | |
A simple sequence constuctor. More... | |
Sequence (const std::string &seq_name, const std::string &comment_, unsigned int seq_length, size_t seq_id=0) | |
A sequence constructor which allows the reservation of memory. More... | |
Sequence (const Sequence &seq) | |
The copy constructor. More... | |
virtual | ~Sequence () |
Destructor. | |
Basic methods | |
const std::string & | name () const |
Returns the name of the sequence. More... | |
void | name (const std::string &na) |
const std::string & | sequence () const |
Returns the sequence as a string. More... | |
void | sequence (const std::string &seq) |
Sets the sequence. More... | |
const std::string & | comment () const |
Returns the comment of a string. More... | |
void | comment (const std::string &com) |
Sets the comment. More... | |
size_t | size () const |
The length of the sequence. More... | |
size_t | length () const |
The length of the sequence. More... | |
size_t | ungapped_size () const |
The size of the sequence without gaps. More... | |
size_t | id () const |
Returns the sequence id of the sequence. More... | |
void | id (size_t val) |
Sets the id of the sequence. More... | |
Manipulation methods | |
template<class T > | |
void | append (const T &seq) |
Appends a string to the sequence. | |
void | append (const Sequence &seq) |
Appends a string to the sequence. | |
void | append (char c) |
Appends a char to the sequence. | |
void | resize (unsigned int new_length) |
Resizes the sequence. More... | |
void | to_upper () |
Turns all charachters of the sequence to uppercase. | |
void | to_lower () |
Turns all characters of the sequence to lowercase. | |
void | reverse () |
Reverses the order of characters in the sequence. | |
void | insert_gaps (const std::vector< std::pair< unsigned int, unsigned int > > vec) |
Inserts gaps into the sequence. More... | |
void | insert_gaps (const std::string &edit_string) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename SequenceType > | |
SequenceType | substr (const SequenceType &seq, size_t start, size_t length) |
returns a new Sequence that is a substring of an existing one. More... | |
template<typename SequenceType > | |
SequenceType | substr_no_renaming (const SequenceType &seq, size_t start, size_t length) |
returns a new Sequence that is a substring of an existing one. More... | |
template<typename SequenceType > | |
SequenceType * | substr_end (const SequenceType &seq, size_t start, size_t end) |
returns a new Sequence that is a substring of an existing one. More... | |
template<typename SequenceType > | |
void | reverse_complement (SequenceType &seq) |
Computes the reverse complement of a DNA sequence. More... | |
template<typename SequenceTypeIn , typename SequenceTypeOut > | |
SequenceTypeOut | dna2prot (const SequenceTypeIn &seq) |
Turns a DNA sequence into a ProteinSequence. More... | |
Operators | |
char & | operator[] (unsigned int index) |
Access operator. More... | |
const char & | operator[] (unsigned int index) const |
Sequence & | operator= (const Sequence &other) |
bool | operator== (const Sequence &a, const Sequence &b) |
Comparison operators. More... | |
bool | operator!= (const Sequence &a, const Sequence &b) |
Comparison operators. More... | |
bool | operator< (const Sequence &a, const Sequence &b) |
Lesser operator. More... | |
bool | operator> (const Sequence &a, const Sequence &b) |
Greater operator. More... | |
bool | operator<= (const Sequence &a, const Sequence &b) |
Lesser or equal operator. More... | |
bool | operator>= (const Sequence &a, const Sequence &b) |
Greater or equal operator. More... | |
std::ostream & | operator<< (std::ostream &out, const Sequence &seq) |
A generic class to represent a plain sequence.
MDAT::Sequence::Sequence | ( | const std::string & | seq_name, |
const std::string & | seq, | ||
const std::string & | comment_ = "" , |
||
size_t | seq_id = 0 |
||
) |
A simple sequence constuctor.
seq_name | The sequence name. |
comment_ | A sequence comment. |
seq | The sequence. |
seq_id | The sequence id to give to the sequence. |
MDAT::Sequence::Sequence | ( | const std::string & | seq_name, |
const std::string & | comment_, | ||
unsigned int | seq_length, | ||
size_t | seq_id = 0 |
||
) |
A sequence constructor which allows the reservation of memory.
The memory for the actual sequence will be reserved but the actual sequence can be larger without causing problems.
seq_name | The sequence name. |
comment_ | A sequence comment. |
seq_length | The sequence size for which memory should be reserved. |
seq_id | The sequence id to give to the sequence. |
MDAT::Sequence::Sequence | ( | const Sequence & | seq | ) |
The copy constructor.
seq | The sequence of wich a copy should be made. |
|
inline |
Returns the comment of a string.
|
inline |
Sets the comment.
com | The comment. |
|
inline |
Returns the sequence id of the sequence.
It represents the order in which the sequences were read.
|
inline |
Sets the id of the sequence.
val | The new value. |
void MDAT::Sequence::insert_gaps | ( | const std::vector< std::pair< unsigned int, unsigned int > > | vec | ) |
Inserts gaps into the sequence.
vec | A vector of pairs. The first value of a pair gives the position of the gap, the second one the length of it. |
|
inline |
The length of the sequence.
|
inline |
Returns the name of the sequence.
|
inline |
Access operator.
index | The index of to access. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Resizes the sequence.
new_length | The new_length. |
|
inline |
Returns the sequence as a string.
|
inline |
Sets the sequence.
seq | The sequence |
|
inline |
The length of the sequence.
size_t MDAT::Sequence::ungapped_size | ( | ) | const |
The size of the sequence without gaps.
|
related |
Turns a DNA sequence into a ProteinSequence.
SequenceTypeIn | The type of the sequence input |
SequenceTypeOut | The outputType of the sequence |
seq | The sequence to translate. |
Comparison operators.
a | The first sequence. |
b | The second sequence. |
Lesser operator.
a | The first sequence. |
b | The second sequence. |
Lesser or equal operator.
a | The first sequence. |
b | The second sequence. |
Comparison operators.
a | The first sequence. |
b | The second sequence. |
Greater operator.
a | The first sequence. |
b | The second sequence. |
Greater or equal operator.
a | The first sequence. |
b | The second sequence. |
|
related |
Computes the reverse complement of a DNA sequence.
seq | The sequence to change. |
|
related |
returns a new Sequence that is a substring of an existing one.
seq | The sequence to produce the new one from. |
start | The start position of the substring. |
length | The lengths of the substr. |
|
related |
returns a new Sequence that is a substring of an existing one.
seq | The sequence to produce the new one from. |
start | The start position of the substring. |
end | The last position of the substring in sequence. |
|
related |
returns a new Sequence that is a substring of an existing one.
seq | The sequence to produce the new one from. |
start | The start position of the substring. |
length | The lengths of the substr. |