ProteoWizard
Peptide.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2006 Louis Warschaw Prostate Cancer Center
8// Cedars Sinai Medical Center, Los Angeles, California 90048
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21//
22
23
24#ifndef _PEPTIDE_HPP_
25#define _PEPTIDE_HPP_
26
27
30#include <boost/shared_ptr.hpp>
31
32
33namespace pwiz {
34namespace proteome {
35
36class ModificationMap;
37class Fragmentation;
38
39/// settings to enable parsing of inline modifications in peptide sequences
40enum PWIZ_API_DECL ModificationParsing
41{
42 ModificationParsing_Off, /// any non-AA characters will cause an exception
43 ModificationParsing_ByFormula, /// oxidized P in peptide: PEP(O)TIDE
44 ModificationParsing_ByMass, /// PEP(15.94)TIDE or PEP(15.94,15.99)TIDE
45 ModificationParsing_Auto /// either by formula or by mass
46};
47
48/// the delimiter expected to signify an inline modification
49enum PWIZ_API_DECL ModificationDelimiter
50{
53 ModificationDelimiter_Braces /// '{' and '}'
54};
55
56#define MODIFICATION_PARSING_ARGUMENTS \
57 ModificationParsing mp = ModificationParsing_Off, \
58 ModificationDelimiter md = ModificationDelimiter_Parentheses
59
60/// represents a peptide or polypeptide (a sequence of amino acids)
62{
63 public:
64
65 Peptide(const std::string& sequence = "", MODIFICATION_PARSING_ARGUMENTS);
67 Peptide(std::string::const_iterator begin, std::string::const_iterator end, MODIFICATION_PARSING_ARGUMENTS);
68 Peptide(const char* begin, const char* end, MODIFICATION_PARSING_ARGUMENTS);
71 virtual ~Peptide();
72
73 /// returns the sequence of amino acids making up the peptide
74 const std::string& sequence() const;
75
76 /// if modified = false: returns the composition formula of sequence()+water
77 /// if modified = true: returns the composition formula of sequence()+modifications()+water
78 /// throws an exception if modified = true and any modification has only mass information
79 chemistry::Formula formula(bool modified = false) const;
80
81 /// if charge = 0: returns neutral mass
82 /// if charge > 0: returns charged m/z
83 /// if modified = false: returns the monoisotopic mass of sequence()+water
84 /// if modified = true: returns the monoisotopic mass of sequence()+modifications()+water
85 double monoisotopicMass(int charge = 0, bool modified = true) const;
86
87 /// if charge = 0: returns neutral mass
88 /// if charge > 0: returns charged m/z
89 /// if modified = false: returns the molecular weight of sequence()+water
90 /// if modified = true: returns the molecular weight of sequence()+modifications()+water
91 double molecularWeight(int charge = 0, bool modified = true) const;
92
93 /// the map of sequence offsets (0-based) to modifications;
94 /// modifications can be added or removed from the peptide with this map
96
97 /// the map of sequence offsets (0-based) to modifications
99
100 /// returns a fragmentation model for the peptide;
101 /// fragment masses can calculated as mono/avg and as modified/unmodified
102 Fragmentation fragmentation(bool monoisotopic = true, bool modified = true) const;
103
104 /// returns true iff peptide sequences and modifications are equal
105 bool operator==(const Peptide& rhs) const;
106
107 /// returns true iff this peptide has a lesser sequence length, sequence,
108 /// modifications length, or modifications
109 bool operator<(const Peptide& rhs) const;
110
111 private:
112 friend class ModificationMap; // allow ModificationMap to befriend Peptide::Impl
113 friend class Fragmentation;
114 class Impl;
115 boost::shared_ptr<Impl> impl_;
116};
117
118
119/// provides fragment ion masses for a peptide
121{
122 public:
123
124 Fragmentation(const Peptide& peptide,
125 bool monoisotopic,
126 bool modified);
129
130 /// returns the a ion of length <length>;
131 /// example: a(1) returns the a1 ion
132 /// if <charge> = 0: returns neutral mass
133 /// if <charge> > 0: returns charged m/z
134 double a(size_t length, size_t charge = 0) const;
135
136 /// returns the b ion of length <length>
137 /// example: b(1) returns the b1 ion
138 /// if <charge> = 0: returns neutral mass
139 /// if <charge> > 0: returns charged m/z
140 double b(size_t length, size_t charge = 0) const;
141
142 /// returns the c ion of length <length>
143 /// example: c(1) returns the c1 ion
144 /// if <charge> = 0: returns neutral mass
145 /// if <charge> > 0: returns charged m/z
146 double c(size_t length, size_t charge = 0) const;
147
148 /// returns the x ion of length <length>
149 /// example: x(1) returns the x1 ion
150 /// if <charge> = 0: returns neutral mass
151 /// if <charge> > 0: returns charged m/z
152 double x(size_t length, size_t charge = 0) const;
153
154 /// returns the y ion of length <length>
155 /// example: y(1) returns the y1 ion
156 /// if <charge> = 0: returns neutral mass
157 /// if <charge> > 0: returns charged m/z
158 double y(size_t length, size_t charge = 0) const;
159
160 /// returns the z ion of length <length>
161 /// example: z(1) returns the z1 ion
162 /// if <charge> = 0: returns neutral mass
163 /// if <charge> > 0: returns charged m/z
164 double z(size_t length, size_t charge = 0) const;
165
166 /// returns the z radical ion of length <length>
167 /// example: zRadical(1) returns the z1* ion
168 /// if <charge> = 0: returns neutral mass
169 /// if <charge> > 0: returns charged m/z
170 double zRadical(size_t length, size_t charge = 0) const;
171
172 private:
173 class Impl;
174 boost::shared_ptr<Impl> impl_;
175};
176
177
178} // namespace proteome
179} // namespace pwiz
180
181
182// include here for user convenience
183#include "Modification.hpp"
184
185
186#endif // _PEPTIDE_HPP_
187
#define PWIZ_API_DECL
Definition Export.hpp:32
#define MODIFICATION_PARSING_ARGUMENTS
Definition Peptide.hpp:56
ModificationDelimiter_Parentheses
Definition Peptide.hpp:51
ModificationParsing_ByMass
oxidized P in peptide: PEP(O)TIDE
Definition Peptide.hpp:44
ModificationParsing_ByFormula
any non-AA characters will cause an exception
Definition Peptide.hpp:43
ModificationParsing_Off
Definition Peptide.hpp:42
ModificationDelimiter_Brackets
'(' and ')'
Definition Peptide.hpp:52
class to represent a chemical formula
provides fragment ion masses for a peptide
Definition Peptide.hpp:121
double x(size_t length, size_t charge=0) const
returns the x ion of length <length> example: x(1) returns the x1 ion if <charge> = 0: returns neutra...
double c(size_t length, size_t charge=0) const
returns the c ion of length <length> example: c(1) returns the c1 ion if <charge> = 0: returns neutra...
double z(size_t length, size_t charge=0) const
returns the z ion of length <length> example: z(1) returns the z1 ion if <charge> = 0: returns neutra...
Fragmentation(const Fragmentation &)
double b(size_t length, size_t charge=0) const
returns the b ion of length <length> example: b(1) returns the b1 ion if <charge> = 0: returns neutra...
double a(size_t length, size_t charge=0) const
returns the a ion of length <length>; example: a(1) returns the a1 ion if <charge> = 0: returns neutr...
double zRadical(size_t length, size_t charge=0) const
returns the z radical ion of length <length> example: zRadical(1) returns the z1* ion if <charge> = 0...
double y(size_t length, size_t charge=0) const
returns the y ion of length <length> example: y(1) returns the y1 ion if <charge> = 0: returns neutra...
boost::shared_ptr< Impl > impl_
Definition Peptide.hpp:174
Fragmentation(const Peptide &peptide, bool monoisotopic, bool modified)
maps peptide/protein sequence indexes (0-based) to a modification list
represents a peptide or polypeptide (a sequence of amino acids)
Definition Peptide.hpp:62
bool operator<(const Peptide &rhs) const
returns true iff this peptide has a lesser sequence length, sequence, modifications length,...
Peptide(const std::string &sequence="", MODIFICATION_PARSING_ARGUMENTS)
const std::string & sequence() const
returns the sequence of amino acids making up the peptide
Peptide & operator=(const Peptide &)
bool operator==(const Peptide &rhs) const
returns true iff peptide sequences and modifications are equal
Peptide(std::string::const_iterator begin, std::string::const_iterator end, MODIFICATION_PARSING_ARGUMENTS)
chemistry::Formula formula(bool modified=false) const
if modified = false: returns the composition formula of sequence()+water if modified = true: returns ...
double molecularWeight(int charge=0, bool modified=true) const
if charge = 0: returns neutral mass if charge > 0: returns charged m/z if modified = false: returns t...
double monoisotopicMass(int charge=0, bool modified=true) const
if charge = 0: returns neutral mass if charge > 0: returns charged m/z if modified = false: returns t...
const ModificationMap & modifications() const
the map of sequence offsets (0-based) to modifications
Fragmentation fragmentation(bool monoisotopic=true, bool modified=true) const
returns a fragmentation model for the peptide; fragment masses can calculated as mono/avg and as modi...
boost::shared_ptr< Impl > impl_
Definition Peptide.hpp:115
Peptide(const char *begin, const char *end, MODIFICATION_PARSING_ARGUMENTS)
Peptide(const char *sequence, MODIFICATION_PARSING_ARGUMENTS)
ModificationMap & modifications()
the map of sequence offsets (0-based) to modifications; modifications can be added or removed from th...
Peptide(const Peptide &)