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 
46 {
47  protected:
49  {
50  std::size_t spectrum_index;
51  double rt;
52  };
53 
54  /** @brief class to read retention time points of MsRun
55  */
57  {
58  private:
59  std::vector<MsRunXicExtractorPoints> &m_msrun_points;
60 
61  public:
63  std::vector<MsRunXicExtractorPoints> &msrun_points)
64  : m_msrun_points(msrun_points){};
65 
66  virtual void
68  {
69  if(spectrum.getMsLevel() == 1)
70  {
71  m_msrun_points.push_back(
72  {spectrum.getMassSpectrumId().getSpectrumIndex(),
73  spectrum.getRtInSeconds()});
74  }
75  }
76  virtual bool
77  needPeakList() const override
78  {
79  return false;
80  }
81  virtual void
82  loadingEnded() override
83  {
84  }
85  };
86 
89 
90  /** @brief constructor is private, use the MsRunXicExtractorFactory
91  */
94  virtual ~MsRunXicExtractorInterface();
95 
96  public:
97  /** @brief set the XIC extraction method
98  */
99  void setXicExtractMethod(XicExtractMethod method); // sum or max
100 
101  /** @brief get a XIC on this MsRun at the given mass range
102  * @param mz_range mz range to extract
103  */
104  virtual XicCstSPtr getXicCstSPtr(const MzRange &mz_range) final;
105 
106  /** @brief get a XIC on this MsRun at the given mass range
107  * @param mz_range mz range to extract
108  * @param rt_begin begining of the XIC in seconds
109  * @param rt_end end of the XIC in seconds
110  */
111  virtual XicCstSPtr getXicCstSPtr(const MzRange &mz_range,
112  pappso::pappso_double rt_begin,
113  pappso::pappso_double rt_end) = 0;
114 
115  /** @brief extract a list of XIC given a list of mass to extract
116  */
117  virtual std::vector<XicCstSPtr>
118  getXicCstSPtrList(const std::vector<MzRange> &mz_range_list) = 0;
119 
120  const MsRunIdCstSPtr &getMsRunId() const;
121 };
122 
123 
124 } // namespace pappso
pappso::MsRunXicExtractorInterface::getXicCstSPtrList
virtual std::vector< XicCstSPtr > getXicCstSPtrList(const std::vector< MzRange > &mz_range_list)=0
extract a list of XIC given a list of mass to extract
pappso::QualifiedMassSpectrum::getMsLevel
uint getMsLevel() const
Get the mass spectrum level.
Definition: qualifiedmassspectrum.cpp:187
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:48
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
Definition: aa.cpp:39
pappso::MsRunReaderSPtr
std::shared_ptr< MsRunReader > MsRunReaderSPtr
Definition: msrunreader.h:151
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition: msrunid.h:44
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints::setQualifiedMassSpectrum
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
Definition: msrunxicextractorinterface.h:67
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints::MsRunXicExtractorReadPoints
MsRunXicExtractorReadPoints(std::vector< MsRunXicExtractorPoints > &msrun_points)
Definition: msrunxicextractorinterface.h:62
pappso::MsRunXicExtractorInterface
Definition: msrunxicextractorinterface.h:46
pappso::MzRange
Definition: mzrange.h:46
pappso::XicExtractMethod
XicExtractMethod
Definition: types.h:183
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition: qualifiedmassspectrum.h:85
pappso::XicCstSPtr
std::shared_ptr< const Xic > XicCstSPtr
Definition: xic.h:37
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints::m_msrun_points
std::vector< MsRunXicExtractorPoints > & m_msrun_points
Definition: msrunxicextractorinterface.h:59
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints::loadingEnded
virtual void loadingEnded() override
Definition: msrunxicextractorinterface.h:82
pappso::MsRunXicExtractorInterface::MsRunXicExtractorPoints::spectrum_index
std::size_t spectrum_index
Definition: msrunxicextractorinterface.h:50
pappso::MsRunXicExtractorInterface::getXicCstSPtr
virtual XicCstSPtr getXicCstSPtr(const MzRange &mz_range, pappso::pappso_double rt_begin, pappso::pappso_double rt_end)=0
get a XIC on this MsRun at the given mass range
pappso::MsRunXicExtractorInterface::msp_msrun_reader
MsRunReaderSPtr msp_msrun_reader
Definition: msrunxicextractorinterface.h:87
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition: qualifiedmassspectrum.cpp:157
pappso::XicExtractMethod::sum
@ sum
sum of intensities
pappso::MsRunXicExtractorInterface::MsRunXicExtractorPoints::rt
double rt
Definition: msrunxicextractorinterface.h:51
pappso::MsRunXicExtractorInterfaceSp
std::shared_ptr< MsRunXicExtractorInterface > MsRunXicExtractorInterfaceSp
Definition: msrunxicextractorinterface.h:41
pappso::SpectrumCollectionHandlerInterface
interface to collect spectrums from the MsRunReader class
Definition: msrunreader.h:59
pappso::MsRunXicExtractorInterface::MsRunXicExtractorPoints
Definition: msrunxicextractorinterface.h:49
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints::needPeakList
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
Definition: msrunxicextractorinterface.h:77
pappso::MsRunXicExtractorInterface::MsRunXicExtractorReadPoints
class to read retention time points of MsRun
Definition: msrunxicextractorinterface.h:57
pappso::QualifiedMassSpectrum::getRtInSeconds
pappso_double getRtInSeconds() const
Get the retention time in seconds.
Definition: qualifiedmassspectrum.cpp:203