-
Notifications
You must be signed in to change notification settings - Fork 2
/
pout_parser.cpp
124 lines (120 loc) · 5.42 KB
/
pout_parser.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* Copyright 2014 Henric Zazzi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This sample parser implementation was generated by CodeSynthesis XSD,
// an XML Schema to C++ data binding compiler. You may use it in your
// programs without any restrictions.
//
//------------------------------------------------------------------------------
#include <iostream>
#include "pout_parser.h"
//------------------------------------------------------------------------------
namespace poutXML {
void probability_t_pimpl::_characters(const ::xml_schema::ro_string &s) {
probability_t=s;
}
//------------------------------------------------------------------------------
void peptide_pimpl::pre(probability_t_pimpl *probability_p) {
this->probability_p=probability_p;
}
//------------------------------------------------------------------------------
void peptide_pimpl::q_value() {
pq_value=probability_p->probability_t;
}
//------------------------------------------------------------------------------
void peptide_pimpl::pep() {
ppep=probability_p->probability_t;
}
//------------------------------------------------------------------------------
void peptide_pimpl::decoy(bool decoy) {
pdecoy=decoy;
}
//------------------------------------------------------------------------------
void psm_ids_pimpl::pre(PercolatorOutI *percolator,peptide_pimpl *peptide_p) {
this->percolator=percolator;
this->peptide_p=peptide_p;
this->peptide_p->pq_value="";
this->peptide_p->ppep="";
}
//------------------------------------------------------------------------------
void psm_ids_pimpl::post_psm_ids() {
peptide_p->pq_value="";
peptide_p->ppep="";
}
//------------------------------------------------------------------------------
void psm_ids_pimpl::psm_id(const ::std::string &psm_id) {
string psmid,psmidfile;
if (!percolator->checkDecoy(peptide_p->pdecoy))
return;
psmid=percolator->convertPSMID(psm_id);
if (psmid.length()==0)
THROW_ERROR_VALUE(PRINT_TEXT::WRONG_FORMAT_PSM,psm_id);
psmidfile=percolator->convertPSMIDFileName(psm_id);
if (psmidfile.length()==0 && percolator->multiplemzidfiles)
THROW_ERROR(PRINT_TEXT::NO_UNIQUE_MZID_FILE);
if (psmidfile.length()>0) {
cout <<"-";
if (!percolator->multiplemzidfiles)
THROW_ERROR(PRINT_TEXT::MULTIPLE_MZID_FILES);
if (!percolator->addFilenames(psmidfile,true))
THROW_ERROR("");
}
if (peptide_p->ppep.length()>0)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::PEPTIDE_PEP)]=peptide_p->ppep;
if (peptide_p->pq_value.length()>0)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::PEPTIDE_Q_VALUE)]=peptide_p->pq_value;
}
//------------------------------------------------------------------------------
void psm_pimpl::pre(PercolatorOutI *percolator,probability_t_pimpl *probability_p) {
this->percolator=percolator;
this->probability_p=probability_p;
}
//------------------------------------------------------------------------------
void psm_pimpl::svm_score(double svm_score) {
if (psm_decoy)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::SVM_SCORE)]=global::to_string(svm_score);
}
//------------------------------------------------------------------------------
void psm_pimpl::q_value() {
if (psm_decoy)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::Q_VALUE)]=probability_p->probability_t;
}
//------------------------------------------------------------------------------
void psm_pimpl::pep() {
if (psm_decoy)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::PEP)]=probability_p->probability_t;
}
//------------------------------------------------------------------------------
void psm_pimpl::p_value() {
if (psm_decoy)
percolator->pout_values[PercolatorOutFeatures(psmidfile,psmid,PERCOLATOR_PARAM::P_VALUE)]=probability_p->probability_t;
}
//------------------------------------------------------------------------------
void psm_pimpl::psm_id(const ::std::string &psm_id) {
psmid=percolator->convertPSMID(psm_id);
if (psmid.length()==0)
THROW_ERROR_VALUE(PRINT_TEXT::WRONG_FORMAT_PSM,psm_id);
psmidfile=percolator->convertPSMIDFileName(psm_id);
if (psmidfile.length()==0 && percolator->multiplemzidfiles)
THROW_ERROR(PRINT_TEXT::NO_UNIQUE_MZID_FILE);
if (psmidfile.length()>0) {
if (!percolator->multiplemzidfiles)
THROW_ERROR(PRINT_TEXT::MULTIPLE_MZID_FILES);
if (!percolator->addFilenames(psmidfile,true))
THROW_ERROR("");
}
}
//------------------------------------------------------------------------------
void psm_pimpl::decoy(bool decoy) {
psm_decoy=percolator->checkDecoy(decoy);
}
//------------------------------------------------------------------------------
}