libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
xtandempresetreader.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/tandemwrapper/xtandempresetreader.cpp
3
* \date 06/02/2020
4
* \author Olivier Langella
5
* \brief read tandem preset file to get centroid parameters and number of
6
* threads
7
*/
8
9
/*******************************************************************************
10
* Copyright (c) 2020 Olivier Langella <Olivier.Langella@u-psud.fr>.
11
*
12
* This file is part of PAPPSOms-tools.
13
*
14
* PAPPSOms-tools is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation, either version 3 of the License, or
17
* (at your option) any later version.
18
*
19
* PAPPSOms-tools is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
26
*
27
******************************************************************************/
28
29
#include "
xtandempresetreader.h
"
30
#include "
pappsomspp/core/pappsoexception.h
"
31
#include "
pappsomspp/core/precision.h
"
32
33
namespace
pappso
34
{
35
XtandemPresetReader::XtandemPresetReader
()
36
{
37
}
38
39
XtandemPresetReader::~XtandemPresetReader
()
40
{
41
}
42
43
44
void
45
XtandemPresetReader::read_note
()
46
{
47
// <note type="input"
48
// label="output,path">/gorgone/pappso/jouy/users/Celine/2019_Lumos/20191222_107_Juste_APD/metapappso_condor/test_run/20191222_18_EF1_third_step_test_condor_22janv.xml</note>
49
if
(
m_qxmlStreamReader
.name().toString() !=
"note"
)
50
{
51
m_qxmlStreamReader
.skipCurrentElement();
52
return
;
53
}
54
Q_ASSERT(
m_qxmlStreamReader
.name().toString() ==
"note"
);
55
QString label;
56
57
58
m_countNote
++;
59
if
((
m_qxmlStreamReader
.attributes().hasAttribute(
"type"
)) &&
60
(
m_qxmlStreamReader
.attributes().value(
"type"
).toString() ==
"input"
))
61
{
62
if
(
m_qxmlStreamReader
.attributes().hasAttribute(
"label"
))
63
{
64
label =
m_qxmlStreamReader
.attributes().value(
"label"
).toString();
65
}
66
}
67
if
(label.isEmpty())
68
{
69
}
70
else
71
{
72
if
(label ==
"spectrum, timstof MS2 filters"
)
73
{
74
}
75
else
if
(label ==
"spectrum, threads"
)
76
{
77
m_threads
=
m_qxmlStreamReader
.readElementText().toInt();
78
return
;
79
}
80
else
if
(label ==
"spectrum, fragment monoisotopic mass error units"
)
81
{
82
83
m_ms2precisionUnit
=
Enums::PrecisionUnit::dalton
;
84
if
(
m_qxmlStreamReader
.readElementText().trimmed().toLower() ==
"ppm"
)
85
{
86
m_ms2precisionUnit
=
Enums::PrecisionUnit::ppm
;
87
}
88
return
;
89
}
90
else
if
(label ==
"spectrum, fragment monoisotopic mass error"
)
91
{
92
m_ms2precisionValue
=
m_qxmlStreamReader
.readElementText().toDouble();
93
return
;
94
}
95
}
96
m_qxmlStreamReader
.skipCurrentElement();
97
// qDebug() << "end ";
98
//
99
}
100
101
102
int
103
XtandemPresetReader::getNumberOfThreads
()
const
104
{
105
return
m_threads
;
106
}
107
108
109
const
QString
110
XtandemPresetReader::getMs2FiltersOptions
()
const
111
{
112
QString filter_suite;
113
PrecisionPtr
precision =
114
PrecisionFactory::getPrecisionPtrInstance
(
m_ms2precisionUnit
,
m_ms2precisionValue
);
115
QString charge_decon_filter =
116
QString(
"chargeDeconvolution|%1"
).arg(precision->
toString
().replace(
" "
,
""
));
117
118
PrecisionPtr
precision_exclu =
119
PrecisionFactory::getPrecisionPtrInstance
(
m_ms2precisionUnit
,
m_ms2precisionValue
/ 2);
120
QString mz_exclusion_filter =
121
QString(
"mzExclusion|%1"
).arg(precision_exclu->
toString
().replace(
" "
,
""
));
122
filter_suite = charge_decon_filter +
" "
+ mz_exclusion_filter;
123
return
filter_suite;
124
}
125
126
127
void
128
XtandemPresetReader::readStream
()
129
{
130
qDebug();
131
m_countNote
= 0;
132
m_threads
= -1;
133
m_ms2precisionUnit
=
Enums::PrecisionUnit::dalton
;
134
m_ms2precisionValue
= -1;
135
if
(
m_qxmlStreamReader
.readNextStartElement())
136
{
137
if
(
m_qxmlStreamReader
.name().toString() ==
"bioml"
)
138
{
139
qDebug();
140
while
(
m_qxmlStreamReader
.readNextStartElement())
141
{
142
// qDebug() << m_qxmlStreamReader.name();
143
read_note
();
144
}
145
}
146
else
147
{
148
m_qxmlStreamReader
.raiseError(QObject::tr(
"Not an X!Tandem preset file"
));
149
m_qxmlStreamReader
.skipCurrentElement();
150
}
151
}
152
if
(
m_threads
== -1)
153
{
154
qDebug();
155
m_qxmlStreamReader
.raiseError(QObject::tr(
"Not an X!Tandem preset file"
));
156
}
157
qDebug();
158
}
159
160
int
161
XtandemPresetReader::getCountNote
()
const
162
{
163
return
m_countNote
;
164
}
165
166
}
// namespace pappso
pappso::PrecisionBase::toString
virtual QString toString() const =0
pappso::PrecisionFactory::getPrecisionPtrInstance
static PrecisionPtr getPrecisionPtrInstance(Enums::PrecisionUnit unit, double value)
get a precision pointer instance
Definition
precision.cpp:219
pappso::XmlStreamReaderInterface::m_qxmlStreamReader
QXmlStreamReader m_qxmlStreamReader
Definition
xmlstreamreaderinterface.h:71
pappso::XtandemPresetReader::m_threads
int m_threads
Definition
xtandempresetreader.h:64
pappso::XtandemPresetReader::m_countNote
int m_countNote
Definition
xtandempresetreader.h:63
pappso::XtandemPresetReader::~XtandemPresetReader
virtual ~XtandemPresetReader()
Definition
xtandempresetreader.cpp:39
pappso::XtandemPresetReader::m_ms2precisionUnit
Enums::PrecisionUnit m_ms2precisionUnit
Definition
xtandempresetreader.h:66
pappso::XtandemPresetReader::getMs2FiltersOptions
const QString getMs2FiltersOptions() const
Definition
xtandempresetreader.cpp:110
pappso::XtandemPresetReader::m_ms2precisionValue
double m_ms2precisionValue
Definition
xtandempresetreader.h:67
pappso::XtandemPresetReader::getCountNote
int getCountNote() const
Definition
xtandempresetreader.cpp:161
pappso::XtandemPresetReader::getNumberOfThreads
int getNumberOfThreads() const
Definition
xtandempresetreader.cpp:103
pappso::XtandemPresetReader::readStream
virtual void readStream() override
Definition
xtandempresetreader.cpp:128
pappso::XtandemPresetReader::XtandemPresetReader
XtandemPresetReader()
Definition
xtandempresetreader.cpp:35
pappso::XtandemPresetReader::read_note
void read_note()
Definition
xtandempresetreader.cpp:45
pappso::Enums::PrecisionUnit::ppm
@ ppm
Definition
types.h:93
pappso::Enums::PrecisionUnit::dalton
@ dalton
Definition
types.h:92
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
pappsoexception.h
precision.h
xtandempresetreader.h
pappsomspp
core
processing
tandemwrapper
xtandempresetreader.cpp
Generated on
for libpappsomspp by
1.17.0