libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pwizmsrunreader.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/private/pwizmsrunreader.h
3 * \date 29/05/2018
4 * \author Olivier Langella
5 * \brief MSrun file reader base on proteowizard library
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 * Contributors:
27 * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
31
32#pragma once
33
34#include <pwiz/data/msdata/MSData.hpp>
35#include <pwiz/data/msdata/MSDataFile.hpp>
36
37#include "../../types.h"
40
41
42namespace pappso
43{
44
46{
47 friend class MsFileAccessor;
48
49 public:
50 PwizMsRunReader(MsRunIdCstSPtr &msrun_id_csp);
51 virtual ~PwizMsRunReader();
52
53 const pwiz::msdata::MSDataPtr getMsDataPtr() const;
54
55 virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override;
56 virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override;
57
58 virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index,
59 bool want_binary_data = true) const override;
60
61 virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override;
62
63 virtual void readSpectrumCollection2(const MsRunReadConfig &config,
64 SpectrumCollectionHandlerInterface &handler) override;
65
67 newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index,
68 pappso::PrecisionPtr precision) const override;
69
71 newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum,
72 pappso::PrecisionPtr precision) const override;
73
74
75 virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler,
76 unsigned int ms_level) override;
77
78
79 virtual std::size_t spectrumListSize() const override;
80
81 virtual bool hasScanNumbers() const override;
82
83 virtual bool releaseDevice() override;
84
85 virtual bool acquireDevice() override;
86
87
88 /** @brief get OboPsiModTerm corresponding to the nativeID format format of mz
89 * data
90 */
91 const OboPsiModTerm getOboPsiModTermNativeIDFormat() const;
92
93 virtual std::size_t
94 spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override;
95
96 protected:
97 virtual void
98 readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config,
100
101 virtual void initialize() override;
102 virtual bool accept(const QString &file_name) const override;
103
104 bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p,
105 QualifiedMassSpectrum &qualified_mass_spectrum) const;
106 bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p,
107 QualifiedMassSpectrum &qualified_mass_spectrum) const;
108
109 QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData(std::size_t spectrum_index,
110 bool want_binary_data,
111 bool &ok) const;
112
114 qualifiedMassSpectrumFromPwizSpectrumPtr(const MassSpectrumId &massSpectrumId,
115 pwiz::msdata::Spectrum *spectrum_p,
116 bool want_binary_data,
117 bool &ok) const;
118
119 pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list,
120 std::size_t spectrum_index,
121 bool want_binary_data) const;
122
123 static std::string setGlobalLocaleToEnglish();
124
125 static void setGlobalLocaleToCurrentOs(const std::string &environment_locale);
126
127 virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override;
128
129 void checkNativeId(const pwiz::msdata::Spectrum *pwiz_spectrum_ptr,
130 MassSpectrumId &mass_spectrum_id) const;
131
132 protected:
133 static QMutex m_mutex;
134 pwiz::msdata::MSDataPtr msp_msData = nullptr;
135
136
137 private:
138 bool m_hasScanNumbers = false;
139};
140
141} // namespace pappso
142
143
144// Q_DECLARE_METATYPE(pappso::PwizMsRunReader);
145// extern int pwizMsRunReaderMetaTypeId;
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
Definition msrunreader.h:64
Class representing a fully specified mass spectrum.
interface to collect spectrums from the MsRunReader class
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44