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 virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override;
54 virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override;
55
56 virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index,
57 bool want_binary_data = true) const override;
58
59 virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override;
60
61 virtual void readSpectrumCollection2(const MsRunReadConfig &config,
62 SpectrumCollectionHandlerInterface &handler) override;
63
65 newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index,
66 pappso::PrecisionPtr precision) const override;
67
70 pappso::PrecisionPtr precision) const override;
71
72
74 unsigned int ms_level) override;
75
76
77 virtual std::size_t spectrumListSize() const override;
78
79 virtual bool hasScanNumbers() const override;
80
81 virtual bool releaseDevice() override;
82
83 virtual bool acquireDevice() override;
84
85
86 /** @brief get OboPsiModTerm corresponding to the nativeID format format of mz
87 * data
88 */
90
91 virtual std::size_t
92 spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override;
93
94 protected:
95 virtual void
98
99 virtual void initialize() override;
100 virtual bool accept(const QString &file_name) const override;
101
102 bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p,
103 QualifiedMassSpectrum &qualified_mass_spectrum) const;
104 bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p,
105 QualifiedMassSpectrum &qualified_mass_spectrum) const;
106
108 bool want_binary_data,
109 bool &ok) const;
110
113 pwiz::msdata::Spectrum *spectrum_p,
114 bool want_binary_data,
115 bool &ok) const;
116
117 pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list,
118 std::size_t spectrum_index,
119 bool want_binary_data) const;
120
121 static std::string setGlobalLocaleToEnglish();
122
123 static void setGlobalLocaleToCurrentOs(const std::string &environment_locale);
124
125 virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override;
126
127 protected:
128 static QMutex m_mutex;
129 pwiz::msdata::MSDataPtr msp_msData = nullptr;
130
131
132 private:
133 bool m_hasScanNumbers = false;
134};
135
136} // namespace pappso
137
138
139// Q_DECLARE_METATYPE(pappso::PwizMsRunReader);
140// extern int pwizMsRunReaderMetaTypeId;
MsRunReader(const MsRunIdCstSPtr &ms_run_id)
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
pwiz::msdata::MSDataPtr msp_msData
virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler, unsigned int ms_level) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels
static std::string setGlobalLocaleToEnglish()
virtual void readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)
bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData(std::size_t spectrum_index, bool want_binary_data, bool &ok) const
PwizMsRunReader(MsRunIdCstSPtr &msrun_id_csp)
static void setGlobalLocaleToCurrentOs(const std::string &environment_locale)
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizSpectrumPtr(const MassSpectrumId &massSpectrumId, pwiz::msdata::Spectrum *spectrum_p, bool want_binary_data, bool &ok) const
virtual void readSpectrumCollection2(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
virtual std::size_t spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override
if possible, get the spectrum index given a string identifier throw a not found exception if spectrum...
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
virtual bool acquireDevice() override
acquire data back end device
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override
get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: i...
virtual void initialize() override
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual bool accept(const QString &file_name) const override
tells if the reader is able to handle this file must be implemented by private MS run reader,...
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list, std::size_t spectrum_index, bool want_binary_data) const
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
const OboPsiModTerm getOboPsiModTermNativeIDFormat() const
get OboPsiModTerm corresponding to the nativeID format format of mz data
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
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
const PrecisionBase * PrecisionPtr
Definition precision.h:122
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44