libpappsomspp
Library for mass spectrometry
mzxmloutput.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/msrun/output/mzxmloutput.h
3  * \date 23/11/2019
4  * \author Olivier Langella
5  * \brief write msrun peaks into mzxml output stream
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of the PAPPSOms++ library.
12  *
13  * PAPPSOms++ is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms++ is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25  *
26  * Contributors:
27  * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
28  *implementation
29  ******************************************************************************/
30 
31 #pragma once
32 
33 #include "../msrunreader.h"
34 #include <QXmlStreamWriter>
35 #include "../../processing/uimonitor/uimonitorinterface.h"
36 
37 namespace pappso
38 {
39 /**
40  * @todo use msrunreader as input and writes all peaks into an mzXML output
41  * stream
42  */
44 {
45  public:
46  /**
47  * Default constructor
48  */
49  MzxmlOutput(UiMonitorInterface &monitor, QIODevice *p_output_device);
50 
51  /**
52  * Destructor
53  */
54  ~MzxmlOutput();
55 
56  void write(MsRunReader *p_msrunreader);
57  void close();
58 
59  void maskMs1(bool mask_ms1);
60 
61  void setReadAhead(bool read_ahead);
62 
63  private:
64  void writeHeader(MsRunReader *p_msrunreader);
65 
66  void writeQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum);
67 
68 
69  std::size_t getScanNumber(const QualifiedMassSpectrum &spectrum) const;
70  std::size_t
71  getPrecursorScanNumber(const QualifiedMassSpectrum &spectrum) const;
72  std::size_t getScanNumberFromNativeId(const QString &native_id) const;
73 
74 
76  {
77  public:
78  Translater(MzxmlOutput *p_mzxml_output);
79  virtual ~Translater();
80  virtual void
81  setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
82  virtual bool needPeakList() const override;
83 
84  private:
86  };
87 
88 
89  private:
91  QXmlStreamWriter *mpa_outputStream;
92  bool m_isReadAhead = false;
93  bool m_ms1IsMasked = false;
94 };
95 } // namespace pappso
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
Definition: msrunreader.h:192
UiMonitorInterface & m_monitor
Definition: mzxmloutput.h:90
QXmlStreamWriter * mpa_outputStream
Definition: mzxmloutput.h:91
Class representing a fully specified mass spectrum.
interface to collect spectrums from the MsRunReader class
Definition: msrunreader.h:56
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39