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 
36 namespace pappso
37 {
38 /**
39  * @todo use msrunreader as input and writes all peaks into an mzXML output
40  * stream
41  */
42 class PMSPP_LIB_DECL MzxmlOutput
43 {
44  public:
45  /**
46  * Default constructor
47  */
48  MzxmlOutput(QIODevice *p_output_device);
49 
50  /**
51  * Destructor
52  */
53  ~MzxmlOutput();
54 
55  void write(MsRunReader *p_msrunreader);
56  void close();
57 
58  void maskMs1(bool mask_ms1);
59 
60  void setReadAhead(bool read_ahead);
61 
62  private:
63  void writeHeader(MsRunReader *p_msrunreader);
64 
65  void writeQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum);
66 
67 
68  std::size_t getScanNumber(const QualifiedMassSpectrum &spectrum) const;
69  std::size_t
70  getPrecursorScanNumber(const QualifiedMassSpectrum &spectrum) const;
71  std::size_t getScanNumberFromNativeId(const QString &native_id) const;
72 
73 
75  {
76  public:
77  Translater(MzxmlOutput *p_mzxml_output);
78  virtual ~Translater();
79  virtual void
80  setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
81  virtual bool needPeakList() const override;
82 
83  private:
84  MzxmlOutput *mp_output;
85  };
86 
87 
88  private:
89  QXmlStreamWriter *mpa_outputStream;
90  bool m_isReadAhead = false;
91  bool m_ms1IsMasked = false;
92 };
93 } // namespace pappso
pappso::MsRunReader
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
Definition: msrunreader.h:178
pappso::MzxmlOutput
Definition: mzxmloutput.h:63
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
pappso
Definition: aa.cpp:38
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition: qualifiedmassspectrum.h:85
pappso::MsRunReader
class PMSPP_LIB_DECL MsRunReader
Definition: msrunreader.h:171
pappso::SpectrumCollectionHandlerInterface
interface to collect spectrums from the MsRunReader class
Definition: msrunreader.h:79
pappso::MzxmlOutput::Translater
Definition: mzxmloutput.h:116