Loading...
Searching...
No Matches
pwizmsrunreader.h
Go to the documentation of this file.
/**
* \file pappsomspp/msrun/private/pwizmsrunreader.h
* \date 29/05/2018
* \author Olivier Langella
* \brief MSrun file reader base on proteowizard library
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
*implementation
******************************************************************************/
#pragma once
#include <pwiz/data/msdata/MSData.hpp>
#include <pwiz/data/msdata/MSDataFile.hpp>
#include "../../types.h"
#include "pappsomspp/core/msfile/msfileaccessor.h"
#include "pappsomspp/core/msfile/msfilereader.h"
namespace pappso
{
class PMSPP_LIB_DECL PwizMsRunReader : public MsRunReader
{
friend class MsFileAccessor;
public:
PwizMsRunReader(MsRunIdCstSPtr &msrun_id_csp);
virtual ~PwizMsRunReader();
const pwiz::msdata::MSDataPtr getMsDataPtr() const;
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override;
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override;
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index,
bool want_binary_data = true) const override;
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override;
virtual void readSpectrumCollection2(const MsRunReadConfig &config,
SpectrumCollectionHandlerInterface &handler) override;
virtual pappso::XicCoordSPtr
newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index,
pappso::PrecisionPtr precision) const override;
virtual pappso::XicCoordSPtr
newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum,
pappso::PrecisionPtr precision) const override;
virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler,
unsigned int ms_level) override;
virtual std::size_t spectrumListSize() const override;
virtual bool hasScanNumbers() const override;
virtual bool releaseDevice() override;
virtual bool acquireDevice() override;
/** @brief get OboPsiModTerm corresponding to the nativeID format format of mz
* data
*/
const OboPsiModTerm getOboPsiModTermNativeIDFormat() const;
virtual std::size_t
spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override;
protected:
virtual void
readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config,
SpectrumCollectionHandlerInterface &handler);
virtual void initialize() override;
virtual bool accept(const QString &file_name) const override;
bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p,
QualifiedMassSpectrum &qualified_mass_spectrum) const;
bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p,
QualifiedMassSpectrum &qualified_mass_spectrum) const;
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData(std::size_t spectrum_index,
bool want_binary_data,
bool &ok) const;
QualifiedMassSpectrum
qualifiedMassSpectrumFromPwizSpectrumPtr(const MassSpectrumId &massSpectrumId,
pwiz::msdata::Spectrum *spectrum_p,
bool want_binary_data,
bool &ok) const;
pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list,
std::size_t spectrum_index,
bool want_binary_data) const;
static std::string setGlobalLocaleToEnglish();
static void setGlobalLocaleToCurrentOs(const std::string &environment_locale);
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override;
protected:
static QMutex m_mutex;
pwiz::msdata::MSDataPtr msp_msData = nullptr;
private:
bool m_hasScanNumbers = false;
};
} // namespace pappso
// Q_DECLARE_METATYPE(pappso::PwizMsRunReader);
// extern int pwizMsRunReaderMetaTypeId;
pappso::MassSpectrumId
Definition massspectrumid.h:41
pappso::MsRunReadConfig
Definition msrunreadconfig.h:62
pappso::MsRunReader::MsRunReader
MsRunReader(const MsRunIdCstSPtr &ms_run_id)
Definition msrunreader.cpp:43
pappso::OboPsiModTerm
Definition obopsimodterm.h:34
pappso::PwizMsRunReader::newXicCoordSPtrFromSpectrumIndex
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
Definition pwizmsrunreader.cpp:1121
pappso::PwizMsRunReader::msp_msData
pwiz::msdata::MSDataPtr msp_msData
Definition pwizmsrunreader.h:131
pappso::PwizMsRunReader::readSpectrumCollectionByMsLevel
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
Definition pwizmsrunreader.cpp:824
pappso::PwizMsRunReader::setGlobalLocaleToEnglish
static std::string setGlobalLocaleToEnglish()
Definition pwizmsrunreader.cpp:1143
pappso::PwizMsRunReader::readSpectrumCollectionWithMsrunReadConfig
virtual void readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)
Definition pwizmsrunreader.cpp:954
pappso::PwizMsRunReader::processDriftTime
bool processDriftTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
Definition pwizmsrunreader.cpp:310
pappso::PwizMsRunReader::MsFileAccessor
friend class MsFileAccessor
Definition pwizmsrunreader.h:47
pappso::PwizMsRunReader::massSpectrumCstSPtr
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
Definition pwizmsrunreader.cpp:755
pappso::PwizMsRunReader::m_mutex
static QMutex m_mutex
Definition pwizmsrunreader.h:130
pappso::PwizMsRunReader::getMsDataPtr
const pwiz::msdata::MSDataPtr getMsDataPtr() const
Definition pwizmsrunreader.cpp:170
pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizMSData
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizMSData(std::size_t spectrum_index, bool want_binary_data, bool &ok) const
Definition pwizmsrunreader.cpp:689
pappso::PwizMsRunReader::PwizMsRunReader
PwizMsRunReader(MsRunIdCstSPtr &msrun_id_csp)
Definition pwizmsrunreader.cpp:56
pappso::PwizMsRunReader::setGlobalLocaleToCurrentOs
static void setGlobalLocaleToCurrentOs(const std::string &environment_locale)
Definition pwizmsrunreader.cpp:1167
pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizSpectrumPtr
QualifiedMassSpectrum qualifiedMassSpectrumFromPwizSpectrumPtr(const MassSpectrumId &massSpectrumId, pwiz::msdata::Spectrum *spectrum_p, bool want_binary_data, bool &ok) const
Definition pwizmsrunreader.cpp:375
pappso::PwizMsRunReader::readSpectrumCollection2
virtual void readSpectrumCollection2(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
Definition pwizmsrunreader.cpp:804
pappso::PwizMsRunReader::m_hasScanNumbers
bool m_hasScanNumbers
Definition pwizmsrunreader.h:135
pappso::PwizMsRunReader::spectrumStringIdentifier2SpectrumIndex
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...
Definition pwizmsrunreader.cpp:1189
pappso::PwizMsRunReader::qualifiedMassSpectrum
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
Definition pwizmsrunreader.cpp:762
pappso::PwizMsRunReader::hasScanNumbers
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
Definition pwizmsrunreader.cpp:1097
pappso::PwizMsRunReader::processRetentionTime
bool processRetentionTime(pwiz::msdata::Spectrum *spectrum_p, QualifiedMassSpectrum &qualified_mass_spectrum) const
Definition pwizmsrunreader.cpp:247
pappso::PwizMsRunReader::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition pwizmsrunreader.cpp:1110
pappso::PwizMsRunReader::getOboPsiModTermInstrumentModelName
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override
get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: i...
Definition pwizmsrunreader.cpp:1206
pappso::PwizMsRunReader::initialize
virtual void initialize() override
Definition pwizmsrunreader.cpp:67
pappso::PwizMsRunReader::readSpectrumCollection
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
Definition pwizmsrunreader.cpp:786
pappso::PwizMsRunReader::accept
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,...
Definition pwizmsrunreader.cpp:733
pappso::PwizMsRunReader::spectrumListSize
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
Definition pwizmsrunreader.cpp:1091
pappso::PwizMsRunReader::getPwizSpectrumPtr
pwiz::msdata::SpectrumPtr getPwizSpectrumPtr(pwiz::msdata::SpectrumList *p_spectrum_list, std::size_t spectrum_index, bool want_binary_data) const
Definition pwizmsrunreader.cpp:207
pappso::PwizMsRunReader::releaseDevice
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
Definition pwizmsrunreader.cpp:1103
pappso::PwizMsRunReader::newXicCoordSPtrFromQualifiedMassSpectrum
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
Definition pwizmsrunreader.cpp:1131
pappso::PwizMsRunReader::getOboPsiModTermNativeIDFormat
const OboPsiModTerm getOboPsiModTermNativeIDFormat() const
get OboPsiModTerm corresponding to the nativeID format format of mz data
Definition pwizmsrunreader.cpp:176
pappso::PwizMsRunReader::massSpectrumSPtr
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
Definition pwizmsrunreader.cpp:748
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:99
pappso::SpectrumCollectionHandlerInterface
interface to collect spectrums from the MsRunReader class
Definition spectrumcollectionhandlerinterface.h:52
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
msfileaccessor.h
msfilereader.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
pappso::MassSpectrumCstSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition massspectrum.h:54
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition precision.h:122
pappso::MassSpectrumSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition massspectrum.h:53
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
types.h