Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AASequence Class Reference

Representation of a peptide/protein sequence. More...

#include <OpenMS/CHEMISTRY/AASequence.h>

Classes

class  ConstIterator
 ConstIterator for AASequence. More...
 
class  Iterator
 Iterator class for AASequence. More...
 

Public Member Functions

AASequenceoperator= (const AASequence &rhs)
 assignment operator More...
 
bool empty () const
 check if sequence is empty More...
 
Constructors and Destructors
 AASequence ()
 default constructor More...
 
 AASequence (const AASequence &rhs)
 copy constructor More...
 
virtual ~AASequence ()
 destructor More...
 
Accessors
String toString () const
 returns the peptide as string with modifications embedded in brackets More...
 
String toUnmodifiedString () const
 returns the peptide as string without any modifications More...
 
void setModification (Size index, const String &modification)
 set the modification of the residue at position index More...
 
void setNTerminalModification (const String &modification)
 sets the N-terminal modification More...
 
const StringgetNTerminalModification () const
 returns the Id of the N-term modification; an empty string is returned if none was set More...
 
void setCTerminalModification (const String &modification)
 sets the C-terminal modification More...
 
const StringgetCTerminalModification () const
 returns the Id of the C-term modification; an empty string is returned if none was set More...
 
const ResiduegetResidue (SignedSize index) const
 returns a pointer to the residue, which is at position index More...
 
const ResiduegetResidue (Size index) const
 returns a pointer to the residue, which is at position index More...
 
EmpiricalFormula getFormula (Residue::ResidueType type=Residue::Full, Int charge=0) const
 returns the formula of the peptide More...
 
double getAverageWeight (Residue::ResidueType type=Residue::Full, Int charge=0) const
 returns the average weight of the peptide More...
 
double getMonoWeight (Residue::ResidueType type=Residue::Full, Int charge=0) const
 returns the mono isotopic weight of the peptide More...
 
const Residueoperator[] (SignedSize index) const
 returns a pointer to the residue at given position More...
 
const Residueoperator[] (Size index) const
 returns a pointer to the residue at given position More...
 
AASequence operator+ (const AASequence &peptide) const
 adds the residues of the peptide More...
 
AASequenceoperator+= (const AASequence &)
 adds the residues of a peptide More...
 
AASequence operator+ (const Residue *residue) const
 adds the residues of the peptide More...
 
AASequenceoperator+= (const Residue *)
 adds the residues of a peptide More...
 
Size size () const
 returns the number of residues More...
 
AASequence getPrefix (Size index) const
 returns a peptide sequence of the first index residues More...
 
AASequence getSuffix (Size index) const
 returns a peptide sequence of the last index residues More...
 
AASequence getSubsequence (Size index, UInt number) const
 returns a peptide sequence of number residues, beginning at position index More...
 
void getAAFrequencies (Map< String, Size > &frequency_table) const
 compute frequency table of amino acids More...
 
Predicates
bool has (const Residue &residue) const
 returns true if the peptide contains the given residue More...
 
bool hasSubsequence (const AASequence &peptide) const
 
bool hasPrefix (const AASequence &peptide) const
 
bool hasSuffix (const AASequence &peptide) const
 
bool hasNTerminalModification () const
 predicate which is true if the peptide is N-term modified More...
 
bool hasCTerminalModification () const
 predicate which is true if the peptide is C-term modified More...
 
bool isModified () const
 returns true if any of the residues is modified More...
 
bool isModified (Size index) const
 returns true if the residue at the position is modified More...
 
bool operator== (const AASequence &rhs) const
 equality operator. Two sequences are equal iff all amino acids including PTMs are equal More...
 
bool operator< (const AASequence &rhs) const
 lesser than operator which compares the C-term mods, sequence including PTMS and N-term mods; can be used for maps More...
 
bool operator!= (const AASequence &rhs) const
 inequality operator. Complement of equality operator. More...
 
Iterators
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 

Static Public Member Functions

static AASequence fromString (const String &s, bool permissive=true)
 create AASequence object by parsing an OpenMS string More...
 
static AASequence fromString (const char *s, bool permissive=true)
 create AASequence object by parsing a C string (character array) More...
 

Static Protected Member Functions

static String::ConstIterator parseModRoundBrackets_ (const String::ConstIterator str_it, const String &str, AASequence &aas)
 
static String::ConstIterator parseModSquareBrackets_ (const String::ConstIterator str_it, const String &str, AASequence &aas)
 
static void parseString_ (const String &peptide, AASequence &aas, bool permissive=true)
 

Protected Attributes

std::vector< const Residue * > peptide_
 
const ResidueModificationn_term_mod_
 
const ResidueModificationc_term_mod_
 

Friends

Stream operators
std::ostream & operator<< (std::ostream &os, const AASequence &peptide)
 writes a peptide to an output stream More...
 
std::istream & operator>> (std::istream &is, const AASequence &peptide)
 reads a peptide from an input stream More...
 

Detailed Description

Representation of a peptide/protein sequence.

This class represents amino acid sequences in OpenMS. An AASequence instance primarily contains a sequence of residues. The residues are represented as instances of Residue. Each amino acid has only one instance, which is accessible using the ResidueDB instance (singleton).

To create an AASequence instance for a specific amino acid sequence, use the AASequence::fromString function. For example, AASequence::fromString("DFPIANGER") produces an instance of AASequence for the peptide "DFPIANGER".

A critical property of amino acid sequences is that they can be modified. Which means that one or more amino acids are chemically modified, e.g. oxidized. This is represented via Residue instances which carry a ResidueModification object. This is also handled in the ResidueDB.

Modifications are specified using a unique string identifier present in the ModificationsDB in brackets after the modified amino acid or by providing the mass of the residue in square brackets. For example AASequence::fromString("DFPIAM(Oxidation)GER") creates an instance of the peptide "DFPIAMGER" with an oxidized methionine (AASequence::fromString("DFPIAM[+16]GER") and AASequence::fromString("DFPIAM[147]GER") are equivalent). N-terminal modifications are specified by writing the modification as prefix to the sequence. C-terminal modifications are specified by writing the modification as suffix. C-terminal modifications are distinguished from modifications of the last amino acid by considering the specificity of the modification as stored in ModificationsDB.

Note there is a subtle difference between AASequence::fromString("DFPIAM[+16]GER") and AASequence::fromString("DFPIAM[+15.9949]GER") – while the former will try to find the first modification matching to a mass difference of 16 +/- 0.5, the latter will try to find the closest matching modification to the exact mass. This usually gives the intended results.

Arbitrary/unknown amino acids (usually due to an unknown modification) can be specified using tags preceded by X: "X[weight]". This indicates a new amino acid ("X") with the specified weight, e.g. "RX[148.5]T"". Note that this tag does not alter the amino acids to the left (R) or right (T). Rather, X represents an amino acid on its own. Be careful when converting AASequence to an EmpiricalFormula using getFormula(), as tags will not be considered in this case (there exists no formula for them). However, they have an influence on getMonoWeight() and getAverageWeight()!

Constructor & Destructor Documentation

default constructor

AASequence ( const AASequence rhs)

copy constructor

virtual ~AASequence ( )
virtual

destructor

Member Function Documentation

Iterator begin ( )
inline
ConstIterator begin ( ) const
inline
bool empty ( ) const

check if sequence is empty

Iterator end ( )
inline
ConstIterator end ( ) const
inline
static AASequence fromString ( const String s,
bool  permissive = true 
)
static

create AASequence object by parsing an OpenMS string

Parameters
sInput string
permissiveIf set, skip spaces and replace stop codon symbols ("*", "#", "+") by "X" (unknown amino acid) during parsing
Exceptions
Exception::ParseErrorif an invalid string representation of an AA sequence is passed

Referenced by FoundProteinFunctor::addHit(), MetaProSIPDecomposition::calculateIsotopePatternsFor13CRange(), MetaProSIPDecomposition::calculateIsotopePatternsFor15NRange(), MetaProSIPDecomposition::getNumberOfLabelingElements(), SimpleSearchEngine::main_(), TOPPMetaProSIP::main_(), and TOPPViewBase::showSpectrumGenerationDialog().

static AASequence fromString ( const char *  s,
bool  permissive = true 
)
static

create AASequence object by parsing a C string (character array)

Parameters
sInput string
permissiveIf set, skip spaces and replace stop codon symbols ("*", "#", "+") by "X" (unknown amino acid) during parsing
Exceptions
Exception::ParseErrorif an invalid string representation of an AA sequence is passed
void getAAFrequencies ( Map< String, Size > &  frequency_table) const

compute frequency table of amino acids

double getAverageWeight ( Residue::ResidueType  type = Residue::Full,
Int  charge = 0 
) const

returns the average weight of the peptide

const String& getCTerminalModification ( ) const

returns the Id of the C-term modification; an empty string is returned if none was set

EmpiricalFormula getFormula ( Residue::ResidueType  type = Residue::Full,
Int  charge = 0 
) const
double getMonoWeight ( Residue::ResidueType  type = Residue::Full,
Int  charge = 0 
) const

returns the mono isotopic weight of the peptide

Referenced by SimpleSearchEngine::main_(), TOPPMetaProSIP::main_(), and TOPPViewBase::showSpectrumGenerationDialog().

const String& getNTerminalModification ( ) const

returns the Id of the N-term modification; an empty string is returned if none was set

AASequence getPrefix ( Size  index) const

returns a peptide sequence of the first index residues

const Residue& getResidue ( SignedSize  index) const

returns a pointer to the residue, which is at position index

const Residue& getResidue ( Size  index) const

returns a pointer to the residue, which is at position index

AASequence getSubsequence ( Size  index,
UInt  number 
) const

returns a peptide sequence of number residues, beginning at position index

AASequence getSuffix ( Size  index) const

returns a peptide sequence of the last index residues

bool has ( const Residue residue) const

returns true if the peptide contains the given residue

bool hasCTerminalModification ( ) const

predicate which is true if the peptide is C-term modified

bool hasNTerminalModification ( ) const

predicate which is true if the peptide is N-term modified

bool hasPrefix ( const AASequence peptide) const

returns true if the peptide has the given prefix n-term mod is also checked (c-term as well, if prefix is of same length)

bool hasSubsequence ( const AASequence peptide) const

returns true if the peptide contains the given peptide

Note
c-term and n-term mods are ignored
bool hasSuffix ( const AASequence peptide) const

returns true if the peptide has the given suffix c-term mod is also checked (n-term as well, if suffix is of same length)

bool isModified ( ) const

returns true if any of the residues is modified

bool isModified ( Size  index) const

returns true if the residue at the position is modified

bool operator!= ( const AASequence rhs) const

inequality operator. Complement of equality operator.

AASequence operator+ ( const AASequence peptide) const

adds the residues of the peptide

AASequence operator+ ( const Residue residue) const

adds the residues of the peptide

AASequence& operator+= ( const AASequence )

adds the residues of a peptide

AASequence& operator+= ( const Residue )

adds the residues of a peptide

bool operator< ( const AASequence rhs) const

lesser than operator which compares the C-term mods, sequence including PTMS and N-term mods; can be used for maps

AASequence& operator= ( const AASequence rhs)

assignment operator

bool operator== ( const AASequence rhs) const

equality operator. Two sequences are equal iff all amino acids including PTMs are equal

const Residue& operator[] ( SignedSize  index) const

returns a pointer to the residue at given position

const Residue& operator[] ( Size  index) const

returns a pointer to the residue at given position

static String::ConstIterator parseModRoundBrackets_ ( const String::ConstIterator  str_it,
const String str,
AASequence aas 
)
staticprotected
static String::ConstIterator parseModSquareBrackets_ ( const String::ConstIterator  str_it,
const String str,
AASequence aas 
)
staticprotected
static void parseString_ ( const String peptide,
AASequence aas,
bool  permissive = true 
)
staticprotected
void setCTerminalModification ( const String modification)

sets the C-terminal modification

void setModification ( Size  index,
const String modification 
)

set the modification of the residue at position index

void setNTerminalModification ( const String modification)

sets the N-terminal modification

Size size ( ) const
String toString ( ) const

returns the peptide as string with modifications embedded in brackets

Referenced by MetaProSIPReporting::createPeptideCentricCSVReport(), and TOPPMetaProSIP::main_().

String toUnmodifiedString ( ) const

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const AASequence peptide 
)
friend

writes a peptide to an output stream

std::istream& operator>> ( std::istream &  is,
const AASequence peptide 
)
friend

reads a peptide from an input stream

Member Data Documentation

const ResidueModification* c_term_mod_
protected
const ResidueModification* n_term_mod_
protected
std::vector<const Residue*> peptide_
protected

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Aug 25 2015 05:53:57 using doxygen 1.8.9.1