ProteoWizard
Pep2MzIdentTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4// Original author: Robert Burke <robert.burke@proteowizard.org>
5//
6// Copyright 2009 Spielberg Family Center for Applied Proteomics
7// University of Southern California, Los Angeles, California 90033
8//
9// Licensed under the Apache License, Version 2.0 (the "License");
10// you may not use this file except in compliance with the License.
11// You may obtain a copy of the License at
12//
13// http://www.apache.org/licenses/LICENSE-2.0
14//
15// Unless required by applicable law or agreed to in writing, software
16// distributed under the License is distributed on an "AS IS" BASIS,
17// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18// See the License for the specific language governing permissions and
19// limitations under the License.
20//
21
22#include "Pep2MzIdent.hpp"
23#include "Serializer_mzid.hpp"
24#include <iostream>
25#include <string>
26
27using namespace pwiz;
28using namespace pwiz::identdata;
29using namespace pwiz::data::pepxml;
30
31ostream* os_ = NULL;
32
33const char* samplePepXML =
34 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
35 "<msms_pipeline_analysis>\n"
36 "<msms_run_summary>\n"
37 "<spectrum_query start_scan=\"1\" end_scan=\"2\" precursor_neutral_mass=\"1.0\" assumed_charge=\"1\" retention_time_sec=\"2.0\">\n"
38 "<search_result>\n"
39 "<search_hit peptide=\"BUCKLEMYSHOE\">\n"
40 "<analysis_result analysis=\"peptideprophet\">\n"
41 "<peptideprophet_result probability=\"0.900\" all_ntt_prob=\"(0,0,0.900)\">\n"
42 "<search_score_summary>\n"
43 "</search_score_summary>\n"
44 "</peptideprophet_result>\n"
45 "</analysis_result>\n"
46 "</search_hit>\n"
47 "</search_result>\n"
48 "</spectrum_query>\n"
49 "<spectrum_query start_scan=\"3\" end_scan=\"4\" precursor_neutral_mass=\"3.0\" assumed_charge=\"1\" retention_time_sec=\"4.0\">\n"
50 "<search_result>\n"
51 "<search_hit peptide=\"SHUTTHEDOOR\">\n"
52 "<analysis_result analysis=\"peptideprophet\">\n"
53 "<peptideprophet_result probability=\"0.900\" all_ntt_prob=\"(0,0,0.900)\">\n"
54 "<search_score_summary>\n"
55 "</search_score_summary>\n"
56 "</peptideprophet_result>\n"
57 "</analysis_result>\n"
58 "</search_hit>\n"
59 "</search_result>\n"
60 "</spectrum_query>\n"
61 "<spectrum_query start_scan=\"5\" end_scan=\"6\" precursor_neutral_mass=\"5.0\" assumed_charge=\"1\" retention_time_sec=\"6.0\">\n"
62 "<search_result>\n"
63 "<search_hit peptide=\"PICKUPSTICKS\">\n"
64 "<analysis_result analysis=\"peptideprophet\">\n"
65 "<peptideprophet_result probability=\"0.900\" all_ntt_prob=\"(0,0,0.900)\">\n"
66 "<search_score_summary>\n"
67 "</search_score_summary>\n"
68 "</peptideprophet_result>\n"
69 "</analysis_result>\n"
70 "</search_hit>\n"
71 "</search_result>\n"
72 "</spectrum_query>\n"
73 "<spectrum_query start_scan=\"7\" end_scan=\"8\" precursor_neutral_mass=\"7.0\" assumed_charge=\"1\" retention_time_sec=\"8.0\">\n"
74 "<search_result>\n"
75 "<search_hit peptide=\"LAYTHEMSTRAIGHT\">\n"
76 "<analysis_result analysis=\"peptideprophet\">\n"
77 "<peptideprophet_result probability=\"0.900\" all_ntt_prob=\"(0,0,0.900)\">\n"
78 "<search_score_summary>\n"
79 "</search_score_summary>\n"
80 "</peptideprophet_result>\n"
81 "</analysis_result>\n"
82 "</search_hit>\n"
83 "</search_result>\n"
84 "</spectrum_query>\n"
85 "</msms_run_summary>\n"
86 "</msms_pipeline_analysis>\n";
87
88
89void test()
90{
91 istringstream iss(samplePepXML);
93 mspa.read(iss);
94
95 Pep2MzIdent translator(mspa);
96 IdentDataPtr result(translator.translate());
97
98 Serializer_mzIdentML serializer;
99 ostringstream oss;
100 serializer.write(oss, *result);
101
102 if (os_)
103 *os_ << oss.str() << endl;
104
105}
106
107int main(int argc, char** argv)
108{
109 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
110
111 cout << "\ntesting Pep2MzIdent ... \n" << endl;
112 test();
113 return 0;
114}
int main(int argc, char **argv)
const char * samplePepXML
ostream * os_
void test()
Translates data from a MinimumPepXML object into a IdentData object tree when a translation is known.
IdentDataPtr translate()
Translates all known tags in the pepXML object tree into the IdentData object tree.
MZIDData <-> mzIdentML stream serialization.
void write(std::ostream &os, const IdentData &mzid, const pwiz::util::IterationListenerRegistry *=0) const
write MZIDData object to ostream as mzIdentML
boost::shared_ptr< IdentData > IdentDataPtr