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

A class to represent a protein sequence. More...

#include <ProteinSequence.hpp>

Inheritance diagram for MDAT::ProteinSequence:
MDAT::Sequence

Public Member Functions

Constructors & Destructors
 ProteinSequence (const std::string &seq_name, const std::string &seq, const std::string &comment_="", size_t seq_id=0)
 
 ProteinSequence (const std::string &seq_name, const std::string &comment_, unsigned int seq_length, size_t seq_id=0)
 
 ProteinSequence (const Sequence &seq)
 
virtual ~ProteinSequence ()
 
Domain related methods
void add_domain (const Domain &dom)
 Append a domain to the existing set. More...
 
DomainArchitecturedom_archi ()
 Returns the DomainArchitecture of the sequence. More...
 
const DomainArchitecturedom_archi () const
 
Domaindomain (size_t index)
 Returns a domain at a specific position. More...
 
size_t n_domains () const
 The number of domains of the sequence. More...
 
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 class to represent a protein sequence.

Beside the normal information it allows to store domain information.

Constructor & Destructor Documentation

MDAT::ProteinSequence::ProteinSequence ( const std::string &  seq_name,
const std::string &  seq,
const std::string &  comment_ = "",
size_t  seq_id = 0 
)

Full initialization.

MDAT::ProteinSequence::ProteinSequence ( const std::string &  seq_name,
const std::string &  comment_,
unsigned int  seq_length,
size_t  seq_id = 0 
)

Reserves the necessary space

MDAT::ProteinSequence::ProteinSequence ( const Sequence seq)

Copy constructor

Member Function Documentation

void MDAT::ProteinSequence::add_domain ( const Domain dom)
inline

Append a domain to the existing set.

Parameters
domThe domain to append.
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.
DomainArchitecture& MDAT::ProteinSequence::dom_archi ( )
inline

Returns the DomainArchitecture of the sequence.

Returns
The architecture.
const DomainArchitecture& MDAT::ProteinSequence::dom_archi ( ) const
inline

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

Domain& MDAT::ProteinSequence::domain ( size_t  index)
inline

Returns a domain at a specific position.

Parameters
indexThe index.
Returns
The domain.
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.
size_t MDAT::ProteinSequence::n_domains ( ) const
inline

The number of domains of the sequence.

Returns
The number of domains.
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.