libpappsomspp
Library for mass spectrometry
msrunxicextractorinterface.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/xicextractor/msrunxicextractor.h
3  * \date 07/05/2018
4  * \author Olivier Langella
5  * \brief base interface to build XICs on an MsRun file
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2018 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  ******************************************************************************/
27 
28 #pragma once
29 
30 
31 #include "../msrun/msrunreader.h"
32 #include <memory>
33 #include <vector>
34 #include "../mzrange.h"
35 #include "../xic/xic.h"
36 
37 
38 namespace pappso
39 {
40 
41 class MsRunXicExtractorInterface;
42 typedef std::shared_ptr<MsRunXicExtractorInterface>
44 
45 class PMSPP_LIB_DECL MsRunXicExtractorInterface
46 {
47 
48  public:
49  /** @brief set the XIC extraction method
50  */
51  void setXicExtractMethod(XicExtractMethod method); // sum or max
52 
53  /** @brief get a XIC on this MsRun at the given mass range
54  * @param mz_range mz range to extract
55  */
56  virtual XicCstSPtr getXicCstSPtr(const MzRange &mz_range) final;
57 
58  /** @brief get a XIC on this MsRun at the given mass range
59  * @param mz_range mz range to extract
60  * @param rt_begin begining of the XIC in seconds
61  * @param rt_end end of the XIC in seconds
62  */
63  virtual XicCstSPtr getXicCstSPtr(const MzRange &mz_range,
64  pappso::pappso_double rt_begin,
65  pappso::pappso_double rt_end) = 0;
66 
67  /** @brief extract a list of XIC given a list of mass to extract
68  */
69  virtual std::vector<XicCstSPtr>
70  getXicCstSPtrList(const std::vector<MzRange> &mz_range_list) = 0;
71 
72  const MsRunIdCstSPtr &getMsRunId() const;
73 
74  protected:
76  {
77  std::size_t spectrum_index;
78  double rt;
79  };
80 
81  /** @brief class to read retention time points of MsRun
82  */
84  {
85  private:
86  std::vector<MsRunXicExtractorPoints> &m_msrun_points;
87 
88  public:
90  std::vector<MsRunXicExtractorPoints> &msrun_points)
91  : m_msrun_points(msrun_points){};
92 
93  virtual void
94  setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
95  {
96  if(spectrum.getMsLevel() == 1)
97  {
98  m_msrun_points.push_back(
99  {spectrum.getMassSpectrumId().getSpectrumIndex(),
100  spectrum.getRtInSeconds()});
101  }
102  }
103  virtual bool
104  needPeakList() const override
105  {
106  return false;
107  }
108  virtual void
109  loadingEnded() override
110  {
111  }
112  };
113 
114 
115  /** @brief constructor is private, use the MsRunXicExtractorFactory
116  */
119  virtual ~MsRunXicExtractorInterface();
120 
121 
122  protected:
123  MsRunReaderSPtr msp_msrun_reader;
124  XicExtractMethod m_xicExtractMethod = XicExtractMethod::max;
125 };
126 
127 
128 } // namespace pappso
pappso::QualifiedMassSpectrum::getMsLevel
uint getMsLevel() const
Get the mass spectrum level.
Definition: qualifiedmassspectrum.cpp:205
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:69
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::MsRunReaderSPtr
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition: msrunreader.h:172
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition: msrunid.h:65
pappso::DataKind::rt
@ rt
Retention time.
pappso::MsRunXicExtractorInterface
Definition: msrunxicextractorinterface.h:64
pappso::MzRange
Definition: mzrange.h:67
pappso::XicExtractMethod
XicExtractMethod
Definition: types.h:221
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition: qualifiedmassspectrum.h:103
pappso::XicCstSPtr
std::shared_ptr< const Xic > XicCstSPtr
Definition: xic.h:58
pappso::XicExtractMethod::max
@ max
maximum of intensities
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition: qualifiedmassspectrum.cpp:175
pappso::MsRunXicExtractorInterfaceSp
std::shared_ptr< MsRunXicExtractorInterface > MsRunXicExtractorInterfaceSp
Definition: msrunxicextractorinterface.h:59
pappso::SpectrumCollectionHandlerInterface
interface to collect spectrums from the MsRunReader class
Definition: msrunreader.h:80
pappso::MsRunXicExtractorInterface::MsRunXicExtractorPoints
Definition: msrunxicextractorinterface.h:94
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints
class to read retention time points of MsRun
Definition: msrunxicextractorinterface.h:102
pappso::QualifiedMassSpectrum::getRtInSeconds
pappso_double getRtInSeconds() const
Get the retention time in seconds.
Definition: qualifiedmassspectrum.cpp:221