MDA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | Related Functions | List of all members
MDAT::DNASequence Class Reference

A special class for DNA sequences. More...

#include <DNASequence.hpp>

Inheritance diagram for MDAT::DNASequence:
MDAT::Sequence

Public Member Functions

 DNASequence (const std::string &seq_name, const std::string &comment_, const std::string &seq, size_t seq_id=0)
 
 DNASequence (const std::string &seq_name, const std::string &comment_, unsigned int seq_length=0, size_t seq_id=0)
 
 DNASequence (const Sequence &seq)
 
Operators
char & operator[] (unsigned int index)
 Access operator. More...
 
const char & operator[] (unsigned int index) const
 
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...
 

Detailed Description

A special class for DNA sequences.

Member Function Documentation

const std::string& MDAT::Sequence::comment ( ) const
inlineinherited

Returns the comment of a string.

Returns
The comment.
void MDAT::Sequence::comment ( const std::string &  com)
inlineinherited

Sets the comment.

Parameters
comThe comment.
size_t MDAT::Sequence::id ( ) const
inlineinherited

Returns the sequence id of the sequence.

It represents the order in which the sequences were read.

Returns
The id of the sequence.
void MDAT::Sequence::id ( size_t  val)
inlineinherited

Sets the id of the sequence.

Parameters
valThe new value.
void MDAT::Sequence::insert_gaps ( const std::vector< std::pair< unsigned int, unsigned int > >  vec)
inherited

Inserts gaps into the sequence.

Parameters
vecA vector of pairs. The first value of a pair gives the position of the gap, the second one the length of it.
size_t MDAT::Sequence::length ( ) const
inlineinherited

The length of the sequence.

Returns
Length of the sequence.
const std::string& MDAT::Sequence::name ( ) const
inlineinherited

Returns the name of the sequence.

Returns
The name.
char& MDAT::Sequence::operator[] ( unsigned int  index)
inlineinherited

Access operator.

Parameters
indexThe index of to access.
const char& MDAT::Sequence::operator[] ( unsigned int  index) const
inlineinherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void MDAT::Sequence::resize ( unsigned int  new_length)
inlineinherited

Resizes the sequence.

Parameters
new_lengthThe new_length.
const std::string& MDAT::Sequence::sequence ( ) const
inlineinherited

Returns the sequence as a string.

Returns
The sequence.
void MDAT::Sequence::sequence ( const std::string &  seq)
inlineinherited

Sets the sequence.

Parameters
seqThe sequence
size_t MDAT::Sequence::size ( ) const
inlineinherited

The length of the sequence.

Returns
Length of the sequence.
size_t MDAT::Sequence::ungapped_size ( ) const
inherited

The size of the sequence without gaps.

Returns
The size of the ungapped sequence.

Friends And Related Function Documentation

template<typename SequenceTypeIn , typename SequenceTypeOut >
SequenceTypeOut dna2prot ( const SequenceTypeIn &  seq)
related

Turns a DNA sequence into a ProteinSequence.

Template Parameters
SequenceTypeInThe type of the sequence input
SequenceTypeOutThe outputType of the sequence
Parameters
seqThe sequence to translate.
Returns
The new Sequence.
template<typename SequenceType >
void reverse_complement ( SequenceType &  seq)
related

Computes the reverse complement of a DNA sequence.

Parameters
seqThe sequence to change.
template<typename SequenceType >
SequenceType substr ( const SequenceType &  seq,
size_t  start,
size_t  length 
)
related

returns a new Sequence that is a substring of an existing one.

Parameters
seqThe sequence to produce the new one from.
startThe start position of the substring.
lengthThe lengths of the substr.
Returns
The new sequence.
template<typename SequenceType >
SequenceType * substr_end ( const SequenceType &  seq,
size_t  start,
size_t  end 
)
related

returns a new Sequence that is a substring of an existing one.

Parameters
seqThe sequence to produce the new one from.
startThe start position of the substring.
endThe last position of the substring in sequence.
Returns
The new sequence.
template<typename SequenceType >
SequenceType substr_no_renaming ( const SequenceType &  seq,
size_t  start,
size_t  length 
)
related

returns a new Sequence that is a substring of an existing one.

Parameters
seqThe sequence to produce the new one from.
startThe start position of the substring.
lengthThe lengths of the substr.
Returns
The new sequence.