ProteoWizard
Macros | Functions | Variables
IdentDataTest.cpp File Reference
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/data/common/Unimod.hpp"
#include "IdentData.hpp"
#include "Serializer_mzid.hpp"
#include "examples.hpp"
#include "Diff.hpp"
#include "TextWriter.hpp"

Go to the source code of this file.

Macros

#define PWIZ_SOURCE
 

Functions

void testDigestedPeptides ()
 
void testSnapModifications ()
 
void testConversion ()
 
void testCleavageAgent ()
 
int main (int argc, char **argv)
 

Variables

ostream * os_
 

Macro Definition Documentation

◆ PWIZ_SOURCE

#define PWIZ_SOURCE

Definition at line 24 of file IdentDataTest.cpp.

Function Documentation

◆ testDigestedPeptides()

void testDigestedPeptides ( )

Definition at line 46 of file IdentDataTest.cpp.

47{
48 using namespace pwiz::proteome;
49
50 IdentData mzid;
52
53 SpectrumIdentificationProtocolPtr sip = mzid.analysisProtocolCollection.spectrumIdentificationProtocol[0];
54 SpectrumIdentificationListPtr sil = mzid.dataCollection.analysisData.spectrumIdentificationList[0];
55
56 SpectrumIdentificationResultPtr result2 = sil->spectrumIdentificationResult[1];
57
58 // test with multiple simultaneous enzymes (Lys-C/P and Arg-C)
59 {
60 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
61
62 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
63
64 // both termini are specific now, one cut from each enzyme
65 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
66 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
67 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
68 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
69 unit_assert_operator_equal(2, result2_rank1_digestedPeptides[0].specificTermini());
70 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
71 unit_assert(result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
72 }
73
74 // test with multiple independent enzymes (Lys-C/P and Arg-C)
75 sip->enzymes.independent = true;
76 {
77 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
78
79 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
80
81 // reassign the original prefix residue
82 result2_rank1->peptideEvidencePtr[0]->pre = 'K';
83
84 // there are two semi-specific peptides, one cut by Lys-C and the other cut by Arg-C;
85 // only the first one will be returned because they have the same "best specificity"
86
87 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
88 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
89 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
90 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
91 unit_assert_operator_equal(1, result2_rank1_digestedPeptides[0].specificTermini());
92 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
93 unit_assert(!result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
94 }
95
96 // change from multiple enzymes to trypsin/p and test again
97 sip->enzymes.enzymes.clear();
98 EnzymePtr trypsin(new Enzyme);
99 trypsin->id = "ENZ_1";
100 trypsin->cTermGain = "OH";
101 trypsin->nTermGain = "H";
102 trypsin->missedCleavages = 2;
103 trypsin->minDistance = 1;
104 trypsin->terminalSpecificity = proteome::Digestion::FullySpecific;
105 trypsin->siteRegexp = "(?<=[KR])";
106 trypsin->enzymeName.set(MS_Trypsin_P);
107 sip->enzymes.enzymes.push_back(trypsin);
108
109 {
110 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
111 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
112 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
113 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
114 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
115 unit_assert_operator_equal(423, result2_rank1_digestedPeptides[0].offset());
116 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
117 unit_assert_operator_equal(2, result2_rank1_digestedPeptides[0].specificTermini());
118 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
119 unit_assert(result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
120 unit_assert_operator_equal("K", result2_rank1_digestedPeptides[0].NTerminusPrefix());
121 unit_assert_operator_equal("A", result2_rank1_digestedPeptides[0].CTerminusSuffix());
122
123 // result 2 rank 2: K.RNSTIPT.K
124 SpectrumIdentificationItemPtr result2_rank2 = result2->spectrumIdentificationItem[1];
125 vector<DigestedPeptide> result2_rank2_digestedPeptides = digestedPeptides(*sip, *result2_rank2);
126 unit_assert_operator_equal(2, result2_rank2_digestedPeptides.size());
127
128 // both PeptideEvidences have the same values
129 for (int i=0; i < 2; ++i)
130 {
131 unit_assert(digestedPeptide(*sip, *result2_rank2->peptideEvidencePtr[i]) == result2_rank2_digestedPeptides[i]);
132 unit_assert_operator_equal(415, result2_rank2_digestedPeptides[i].offset());
133 unit_assert_operator_equal(1, result2_rank2_digestedPeptides[i].missedCleavages());
134 unit_assert_operator_equal(1, result2_rank2_digestedPeptides[i].specificTermini());
135 unit_assert(result2_rank2_digestedPeptides[i].NTerminusIsSpecific());
136 unit_assert(!result2_rank2_digestedPeptides[i].CTerminusIsSpecific());
137 unit_assert_operator_equal("K", result2_rank2_digestedPeptides[i].NTerminusPrefix());
138 unit_assert_operator_equal("K", result2_rank2_digestedPeptides[i].CTerminusSuffix());
139 }
140 }
141
142 // change enzyme from trypsin to Lys-C and test again
143 sip->enzymes.enzymes[0]->enzymeName.clear();
144 sip->enzymes.enzymes[0]->siteRegexp = "(?<=K)";
145
146 {
147 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
148 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
149 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
150 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
151 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
152 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
153 unit_assert_operator_equal(1, result2_rank1_digestedPeptides[0].specificTermini());
154 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
155 unit_assert(!result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
156
157 // result 2 rank 2: K.RNSTIPT.K
158 SpectrumIdentificationItemPtr result2_rank2 = result2->spectrumIdentificationItem[1];
159 vector<DigestedPeptide> result2_rank2_digestedPeptides = digestedPeptides(*sip, *result2_rank2);
160 unit_assert_operator_equal(2, result2_rank2_digestedPeptides.size());
161
162 // both PeptideEvidences have the same values
163 for (int i=0; i < 2; ++i)
164 {
165 unit_assert(digestedPeptide(*sip, *result2_rank2->peptideEvidencePtr[i]) == result2_rank2_digestedPeptides[i]);
166 unit_assert_operator_equal(0, result2_rank2_digestedPeptides[i].missedCleavages());
167 unit_assert_operator_equal(1, result2_rank2_digestedPeptides[i].specificTermini());
168 unit_assert(result2_rank2_digestedPeptides[i].NTerminusIsSpecific());
169 unit_assert(!result2_rank2_digestedPeptides[i].CTerminusIsSpecific());
170 }
171 }
172
173 // change enzyme from Lys-C to unspecific cleavage and test again
174 sip->enzymes.enzymes[0]->enzymeName.set(MS_unspecific_cleavage);
175 sip->enzymes.enzymes[0]->siteRegexp.clear();
176
177 {
178 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
179 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
180 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
181 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
182 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
183 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
184 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].specificTermini());
185 unit_assert(!result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
186 unit_assert(!result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
187
188 // result 2 rank 2: K.RNSTIPT.K
189 SpectrumIdentificationItemPtr result2_rank2 = result2->spectrumIdentificationItem[1];
190 vector<DigestedPeptide> result2_rank2_digestedPeptides = digestedPeptides(*sip, *result2_rank2);
191 unit_assert_operator_equal(2, result2_rank2_digestedPeptides.size());
192
193 // both PeptideEvidences have the same values
194 for (int i=0; i < 2; ++i)
195 {
196 unit_assert(digestedPeptide(*sip, *result2_rank2->peptideEvidencePtr[i]) == result2_rank2_digestedPeptides[i]);
197 unit_assert_operator_equal(0, result2_rank2_digestedPeptides[i].missedCleavages());
198 unit_assert_operator_equal(0, result2_rank2_digestedPeptides[i].specificTermini());
199 unit_assert(!result2_rank2_digestedPeptides[i].NTerminusIsSpecific());
200 unit_assert(!result2_rank2_digestedPeptides[i].CTerminusIsSpecific());
201 }
202 }
203
204 // change enzyme from unspecific cleavage to no cleavage and test again
205 sip->enzymes.enzymes[0]->enzymeName.clear();
206 sip->enzymes.enzymes[0]->enzymeName.set(MS_no_cleavage);
207
208 {
209 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
210 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
211 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
212 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
213 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
214 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
215 unit_assert_operator_equal(2, result2_rank1_digestedPeptides[0].specificTermini());
216 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
217 unit_assert(result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
218
219 // result 2 rank 2: K.RNSTIPT.K
220 SpectrumIdentificationItemPtr result2_rank2 = result2->spectrumIdentificationItem[1];
221 vector<DigestedPeptide> result2_rank2_digestedPeptides = digestedPeptides(*sip, *result2_rank2);
222 unit_assert_operator_equal(2, result2_rank2_digestedPeptides.size());
223
224 // both PeptideEvidences have the same values
225 for (int i=0; i < 2; ++i)
226 {
227 unit_assert(digestedPeptide(*sip, *result2_rank2->peptideEvidencePtr[i]) == result2_rank2_digestedPeptides[i]);
228 unit_assert_operator_equal(0, result2_rank2_digestedPeptides[i].missedCleavages());
229 unit_assert_operator_equal(2, result2_rank2_digestedPeptides[i].specificTermini());
230 unit_assert(result2_rank2_digestedPeptides[i].NTerminusIsSpecific());
231 unit_assert(result2_rank2_digestedPeptides[i].CTerminusIsSpecific());
232 }
233 }
234
235 // change enzyme from no cleavage to Lys-N and test again
236 sip->enzymes.enzymes[0]->enzymeName.clear();
237 sip->enzymes.enzymes[0]->siteRegexp = "(?=K)";
238
239 {
240 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
241 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
242 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
243 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
244 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
245 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
246 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].specificTermini());
247 unit_assert(!result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
248 unit_assert(!result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
249
250 // result 2 rank 2: K.RNSTIPT.K
251 SpectrumIdentificationItemPtr result2_rank2 = result2->spectrumIdentificationItem[1];
252 vector<DigestedPeptide> result2_rank2_digestedPeptides = digestedPeptides(*sip, *result2_rank2);
253 unit_assert_operator_equal(2, result2_rank2_digestedPeptides.size());
254
255 // both PeptideEvidences have the same values
256 for (int i=0; i < 2; ++i)
257 {
258 unit_assert(digestedPeptide(*sip, *result2_rank2->peptideEvidencePtr[i]) == result2_rank2_digestedPeptides[i]);
259 unit_assert_operator_equal(0, result2_rank2_digestedPeptides[i].missedCleavages());
260 unit_assert_operator_equal(1, result2_rank2_digestedPeptides[i].specificTermini());
261 unit_assert(!result2_rank2_digestedPeptides[i].NTerminusIsSpecific());
262 unit_assert(result2_rank2_digestedPeptides[i].CTerminusIsSpecific());
263 }
264 }
265
266 {
267 // result 2 rank 1: K.QTQTFTTYSDNQPGVLIQVYEGER.A
268
269 SpectrumIdentificationItemPtr result2_rank1 = result2->spectrumIdentificationItem[0];
270
271 // move it to the C terminus
272 result2_rank1->peptideEvidencePtr[0]->start = 618;
273 result2_rank1->peptideEvidencePtr[0]->post = '-';
274
275 vector<DigestedPeptide> result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
276 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
277 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
278 unit_assert_operator_equal(617, result2_rank1_digestedPeptides[0].offset());
279 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
280 unit_assert_operator_equal(1, result2_rank1_digestedPeptides[0].specificTermini());
281 unit_assert(!result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
282 unit_assert(result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
283 unit_assert_operator_equal("K", result2_rank1_digestedPeptides[0].NTerminusPrefix());
284 unit_assert_operator_equal("-", result2_rank1_digestedPeptides[0].CTerminusSuffix());
285
286 // move it to the N terminus
287 result2_rank1->peptideEvidencePtr[0]->start = 1;
288 result2_rank1->peptideEvidencePtr[0]->pre = '-';
289 result2_rank1->peptideEvidencePtr[0]->post = 'A';
290
291 result2_rank1_digestedPeptides = digestedPeptides(*sip, *result2_rank1);
292 unit_assert_operator_equal(1, result2_rank1_digestedPeptides.size());
293 unit_assert(digestedPeptide(*sip, *result2_rank1->peptideEvidencePtr[0]) == result2_rank1_digestedPeptides[0]);
294 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].offset());
295 unit_assert_operator_equal(0, result2_rank1_digestedPeptides[0].missedCleavages());
296 unit_assert_operator_equal(1, result2_rank1_digestedPeptides[0].specificTermini());
297 unit_assert(result2_rank1_digestedPeptides[0].NTerminusIsSpecific());
298 unit_assert(!result2_rank1_digestedPeptides[0].CTerminusIsSpecific());
299 unit_assert_operator_equal("-", result2_rank1_digestedPeptides[0].NTerminusPrefix());
300 unit_assert_operator_equal("A", result2_rank1_digestedPeptides[0].CTerminusSuffix());
301 }
302}
MS_Trypsin_P
Trypsin/P: Cleavage agent Trypsin/P.
Definition cv.hpp:4350
MS_no_cleavage
no cleavage: No cleavage.
Definition cv.hpp:6288
MS_unspecific_cleavage
unspecific cleavage: Unspecific cleavage.
Definition cv.hpp:6291
PWIZ_API_DECL void initializeBasicSpectrumIdentification(IdentData &mzid)
PWIZ_API_DECL proteome::DigestedPeptide digestedPeptide(const SpectrumIdentificationProtocol &sip, const PeptideEvidence &peptideEvidence)
given a protocol and a PeptideEvidence instance, returns the PeptideEvidence as a DigestedPeptide ins...
PWIZ_API_DECL std::vector< proteome::DigestedPeptide > digestedPeptides(const SpectrumIdentificationProtocol &sip, const SpectrumIdentificationItem &sii)
given a protocol and a SpectrumIdentificationItem, builds a set of DigestedPeptides
std::vector< SpectrumIdentificationListPtr > spectrumIdentificationList
std::vector< SpectrumIdentificationProtocolPtr > spectrumIdentificationProtocol
Implementation of EnzymeType from the mzIdentML schema.
Implementation of the MzIdentMLType from the mzIdentML schema.
DataCollection dataCollection
AnalysisProtocolCollection analysisProtocolCollection
#define unit_assert(x)
Definition unit.hpp:85
#define unit_assert_operator_equal(expected, actual)
Definition unit.hpp:92

References pwiz::identdata::DataCollection::analysisData, pwiz::identdata::IdentData::analysisProtocolCollection, pwiz::identdata::IdentData::dataCollection, pwiz::identdata::digestedPeptide(), pwiz::identdata::digestedPeptides(), pwiz::identdata::examples::initializeBasicSpectrumIdentification(), MS_no_cleavage, MS_Trypsin_P, MS_unspecific_cleavage, pwiz::identdata::AnalysisData::spectrumIdentificationList, pwiz::identdata::AnalysisProtocolCollection::spectrumIdentificationProtocol, unit_assert, and unit_assert_operator_equal.

Referenced by main().

◆ testSnapModifications()

void testSnapModifications ( )

Definition at line 304 of file IdentDataTest.cpp.

305{
306 IdentData mzid, mzid2;
309
310 BOOST_FOREACH(SpectrumIdentificationProtocolPtr& sip, mzid2.analysisProtocolCollection.spectrumIdentificationProtocol)
311 BOOST_FOREACH(SearchModificationPtr& mod, sip->modificationParams)
312 mod->cvParams.clear();
313
314 BOOST_FOREACH(PeptidePtr& pep, mzid2.sequenceCollection.peptides)
315 BOOST_FOREACH(ModificationPtr& mod, pep->modification)
316 mod->cvParams.clear();
317
318 Diff<IdentData, DiffConfig> diff(mzid, mzid2);
320
321 BOOST_FOREACH(SpectrumIdentificationPtr& si, mzid2.analysisCollection.spectrumIdentification)
323
324 diff(mzid, mzid2);
325 if (diff && os_) *os_ << "diff:\n" << diff_string<TextWriter>(diff) << endl;
327}
void diff(const string &filename1, const string &filename2)
ostream * os_
std::string diff_string(const diff_type &diff)
Definition diff_std.hpp:177
PWIZ_API_DECL void snapModificationsToUnimod(const SpectrumIdentification &si)
sets Unimod CV terms (if possible) for all SearchModifications and Modification elements
PWIZ_API_DECL proteome::Modification modification(const Modification &mod)
creates a proteome::Modification from an identdata::Modification
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition diff_std.hpp:143

References pwiz::identdata::IdentData::analysisCollection, pwiz::identdata::IdentData::analysisProtocolCollection, diff(), pwiz::identdata::examples::initializeBasicSpectrumIdentification(), os_, pwiz::identdata::SequenceCollection::peptides, pwiz::identdata::IdentData::sequenceCollection, pwiz::identdata::snapModificationsToUnimod(), pwiz::identdata::AnalysisCollection::spectrumIdentification, pwiz::identdata::AnalysisProtocolCollection::spectrumIdentificationProtocol, and unit_assert.

Referenced by main().

◆ testConversion()

void testConversion ( )

Definition at line 329 of file IdentDataTest.cpp.

330{
332
333 IdentData mzid;
335
336 // PEP_2: TAIGIDLGT[80]TYSC[57]VGVFQHGK
338 unit_assert_operator_equal("TAIGIDLGTTYSCVGVFQHGK", pep2.sequence());
342 pep2.modifications().find(8)->second.monoisotopicDeltaMass());
345 pep2.modifications().find(12)->second.monoisotopicDeltaMass());
346
347 // PEP_5: RNS[80]TIPT[-1]
349 unit_assert_operator_equal("RNSTIPT", pep5.sequence());
353 pep5.modifications().find(2)->second.monoisotopicDeltaMass());
356 pep5.modifications().find(ModificationMap::CTerminus())->second.monoisotopicDeltaMass());
357
358 // test an isotope labelled peptide with a UNIMOD cvParam but no supported formula
359 Modification* nMod = new Modification();
360 Modification* cMod = new Modification();
361 nMod->location = 0;
362 cMod->location = 11; cMod->residues.push_back('K');
363 nMod->monoisotopicMassDelta = cMod->monoisotopicMassDelta = 229.1629;
364 nMod->avgMassDelta = cMod->avgMassDelta = 229.2634;
365 nMod->set(UNIMOD_TMT6plex);
366 cMod->set(UNIMOD_TMT6plex);
367
368 Peptide tmtPeptide;
369 tmtPeptide.peptideSequence = "ELVISLIVESK";
370 tmtPeptide.modification.push_back(ModificationPtr(nMod));
371 tmtPeptide.modification.push_back(ModificationPtr(cMod));
372
373 proteome::Peptide tmtProteomePeptide = peptide(tmtPeptide);
374 unit_assert_operator_equal("ELVISLIVESK", tmtProteomePeptide.sequence());
375 unit_assert_operator_equal(2, tmtProteomePeptide.modifications().size());
377 unit_assert_equal(229.1629, tmtProteomePeptide.modifications().find(ModificationMap::NTerminus())->second.monoisotopicDeltaMass(), 1e-4);
378 unit_assert_operator_equal(1, tmtProteomePeptide.modifications().count(10));
379 unit_assert_equal(229.1629, tmtProteomePeptide.modifications().find(10)->second.monoisotopicDeltaMass(), 1e-4);
380}
maps peptide/protein sequence indexes (0-based) to a modification list
virtual iterator find(const key_type &x)
Searches the map for a pair with the key value x and returns an iterator to that pair if it is found....
represents a peptide or polypeptide (a sequence of amino acids)
Definition Peptide.hpp:62
const std::string & sequence() const
returns the sequence of amino acids making up the peptide
ModificationMap & modifications()
the map of sequence offsets (0-based) to modifications; modifications can be added or removed from th...
virtual size_type size() const
Returns the number of elements in the map.
virtual size_type count(const key_type &x) const
Returns a 1 if a value with the key x exists in the map. Otherwise returns a 0.
UNIMOD_Amidated
Amidated: Amidation.
Definition cv.hpp:9375
UNIMOD_Phospho
Phospho: Phosphorylation.
Definition cv.hpp:9417
UNIMOD_Carbamidomethyl
Carbamidomethyl: Iodoacetamide derivative.
Definition cv.hpp:9381
UNIMOD_TMT6plex
TMT6plex: Sixplex Tandem Mass TagĀ®.
Definition cv.hpp:10872
PWIZ_API_DECL const Modification & modification(CVID cvid)
find a modification by CVID
PWIZ_API_DECL proteome::Peptide peptide(const Peptide &peptide)
creates a proteome::Peptide from an identdata::Peptide
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
SequenceCollection sequenceCollection
Implementation of ModificationType from the mzIdentML schema.
std::vector< char > residues
Implementation of PeptideType from the mzIdentML schema.
std::vector< ModificationPtr > modification
std::vector< PeptidePtr > peptides
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99

References pwiz::identdata::Modification::avgMassDelta, pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::count(), pwiz::proteome::ModificationMap::CTerminus(), pwiz::proteome::ModificationMap::find(), pwiz::identdata::examples::initializeBasicSpectrumIdentification(), pwiz::identdata::Modification::location, pwiz::data::unimod::modification(), pwiz::identdata::Peptide::modification, pwiz::proteome::Peptide::modifications(), pwiz::identdata::Modification::monoisotopicMassDelta, pwiz::proteome::ModificationMap::NTerminus(), pwiz::identdata::peptide(), pwiz::identdata::SequenceCollection::peptides, pwiz::identdata::Peptide::peptideSequence, pwiz::identdata::Modification::residues, pwiz::proteome::Peptide::sequence(), pwiz::identdata::IdentData::sequenceCollection, pwiz::data::ParamContainer::set(), pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::size(), UNIMOD_Amidated, UNIMOD_Carbamidomethyl, UNIMOD_Phospho, UNIMOD_TMT6plex, unit_assert_equal, and unit_assert_operator_equal.

Referenced by main().

◆ testCleavageAgent()

void testCleavageAgent ( )

Definition at line 382 of file IdentDataTest.cpp.

383{
384 {
385 Enzyme ez;
388 }
389
390 {
391 Enzyme ez;
392 ez.enzymeName.userParams.push_back(UserParam("trypsin/p"));
394 }
395
396 {
397 Enzyme ez;
398 ez.name = "trypsin/p";
400 }
401
402 {
403 Enzyme ez;
404 ez.siteRegexp = "(?<=[KR])(?!P)";
406 }
407}
MS_Trypsin
Trypsin: Enzyme trypsin.
Definition cv.hpp:4179
PWIZ_API_DECL CVID cleavageAgent(const Enzyme &ez)
returns a cleavage agent CVID for an identdata::Enzyme
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Uncontrolled user parameters (essentially allowing free text). Before using these,...
ParamContainer enzymeName

References pwiz::identdata::cleavageAgent(), pwiz::identdata::Enzyme::enzymeName, MS_Trypsin, MS_Trypsin_P, pwiz::identdata::Identifiable::name, pwiz::data::ParamContainer::set(), pwiz::identdata::Enzyme::siteRegexp, unit_assert_operator_equal, and pwiz::data::ParamContainer::userParams.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 410 of file IdentDataTest.cpp.

411{
412 TEST_PROLOG(argc, argv)
413
414 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
415 if (os_) *os_ << "MzIdentMLTest\n";
416
417 try
418 {
423 }
424 catch (exception& e)
425 {
426 TEST_FAILED(e.what())
427 }
428 catch (...)
429 {
430 TEST_FAILED("Caught unknown exception.")
431 }
432
434}
void testSnapModifications()
void testCleavageAgent()
void testDigestedPeptides()
void testConversion()
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175

References os_, TEST_EPILOG, TEST_FAILED, TEST_PROLOG, testCleavageAgent(), testConversion(), testDigestedPeptides(), and testSnapModifications().

Variable Documentation

◆ os_

ostream* os_

Definition at line 43 of file IdentDataTest.cpp.

Referenced by main(), and testSnapModifications().