libpappsomspp
Library for mass spectrometry
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 "../../pappsoexception.h"
31#include "../../precision.h"
32
33namespace pappso
34{
36{
37}
38
40{
41}
42
43
44void
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
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
84 if(m_qxmlStreamReader.readElementText().trimmed().toLower() == "ppm")
85 {
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
102int
104{
105 return m_threads;
106}
107
108
109const QString
111{
112 QString filter_suite;
115 QString charge_decon_filter = QString("chargeDeconvolution|%1")
116 .arg(precision->toString().replace(" ", ""));
117
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
127void
129{
130 qDebug();
131 m_countNote = 0;
132 m_threads = -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(
149 QObject::tr("Not an X!Tandem preset file"));
150 m_qxmlStreamReader.skipCurrentElement();
151 }
152 }
153 if(m_threads == -1)
154 {
155 qDebug();
156 m_qxmlStreamReader.raiseError(QObject::tr("Not an X!Tandem preset file"));
157 }
158 qDebug();
159}
160
161int
163{
164 return m_countNote;
165}
166
167} // namespace pappso
virtual QString toString() const =0
static PrecisionPtr getPrecisionPtrInstance(PrecisionUnit unit, double value)
get a precision pointer instance
Definition: precision.cpp:214
const QString getMs2FiltersOptions() const
virtual void readStream() override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
read tandem preset file to get centroid parameters and number of threads