Loading...
Searching...
No Matches
timsmsrunreaderdia.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/msrun/private/timsmsrunreaderdia.cpp
* \date 09/07/2024
* \author Olivier Langella
* \brief MSrun file reader for native Bruker TimsTOF specialized for DIA
* purpose
*/
/*******************************************************************************
* Copyright (c) 2024 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.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/>.
*
******************************************************************************/
#include "pappsomspp/core/msrun/private/timsmsrunreaderdia.h"
#include "pappsomspp/core/exception/exceptionnotfound.h"
#include "pappsomspp/core/exception/exceptionnotimplemented.h"
#include <QDebug>
namespace pappso
{
TimsMsRunReaderDia::TimsMsRunReaderDia(MsRunIdCstSPtr &msrun_id_csp)
: TimsMsRunReaderBase(msrun_id_csp)
{
// qInfo() << msp_timsData.get();
initialize();
}
TimsMsRunReaderDia::TimsMsRunReaderDia(const TimsMsRunReaderBase &msrun_reader_base)
: TimsMsRunReaderBase(msrun_reader_base)
{
initialize();
}
TimsMsRunReaderDia::~TimsMsRunReaderDia()
{
}
void
pappso::TimsMsRunReaderDia::initialize()
{
qDebug();
if(msp_timsData == nullptr)
msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
if(msp_timsData.get() == nullptr)
{
throw PappsoException(QObject::tr("ERROR in TimsMsRunReaderDia::initialize "
"msp_timsData is null for MsRunId %1")
.arg(mcsp_msRunId.get()->toString()));
}
qDebug();
qDebug() << msp_timsData.get();
mp_timsDiaSlices = msp_timsData.get()->getTimsDiaSlicesPtr();
qDebug();
}
XicCoordSPtr
TimsMsRunReaderDia::newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index [[maybe_unused]],
pappso::PrecisionPtr precision
[[maybe_unused]]) const
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
pappso::XicCoordSPtr
TimsMsRunReaderDia::newXicCoordSPtrFromQualifiedMassSpectrum(
const pappso::QualifiedMassSpectrum &mass_spectrum [[maybe_unused]],
pappso::PrecisionPtr precision [[maybe_unused]]) const
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
void
TimsMsRunReaderDia::readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler
[[maybe_unused]],
unsigned int ms_level [[maybe_unused]])
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
QualifiedMassSpectrum
TimsMsRunReaderDia::qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data) const
{
// spectrum index is a global slice index
QualifiedMassSpectrum q_dia_spectrum;
mp_timsDiaSlices->getMs2QualifiedSpectrumByGlobalSliceIndex(
getMsRunId(), q_dia_spectrum, spectrum_index, want_binary_data);
return q_dia_spectrum;
}
void
TimsMsRunReaderDia::readSpectrumCollection(SpectrumCollectionHandlerInterface &handler
[[maybe_unused]])
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
void
TimsMsRunReaderDia::readSpectrumCollection2(const MsRunReadConfig &config [[maybe_unused]],
SpectrumCollectionHandlerInterface &handler
[[maybe_unused]])
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
MassSpectrumSPtr
TimsMsRunReaderDia::massSpectrumSPtr(std::size_t spectrum_index [[maybe_unused]])
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
MassSpectrumCstSPtr
TimsMsRunReaderDia::massSpectrumCstSPtr(std::size_t spectrum_index [[maybe_unused]])
{
throw ExceptionNotImplemented(
QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
std::size_t
TimsMsRunReaderDia::spectrumListSize() const
{
return mp_timsDiaSlices->getTotalSlicesCount();
}
bool
TimsMsRunReaderDia::acquireDevice()
{
if(TimsMsRunReaderBase::acquireDevice())
{
qDebug() << msp_timsData.get();
mp_timsDiaSlices = msp_timsData.get()->getTimsDiaSlicesPtr();
return true;
}
return false;
qDebug();
}
std::size_t
TimsMsRunReaderDia::spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier
[[maybe_unused]])
{
throw pappso::ExceptionNotImplemented(
QObject::tr("%1 %2 %3 not implemented").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
}
} // namespace pappso
pappso::ExceptionNotImplemented
Definition exceptionnotimplemented.h:32
pappso::MsRunReadConfig
Definition msrunreadconfig.h:62
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition msrunreader.h:194
pappso::MsRunReader::getMsRunId
const MsRunIdCstSPtr & getMsRunId() const
Definition msrunreader.cpp:55
pappso::PappsoException
Definition pappsoexception.h:41
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
pappso::TimsMsRunReaderBase::TimsMsRunReaderBase
TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
Definition timsmsrunreaderbase.cpp:38
pappso::TimsMsRunReaderBase::msp_timsData
TimsDataSp msp_timsData
Definition timsmsrunreaderbase.h:87
pappso::TimsMsRunReaderBase::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition timsmsrunreaderbase.cpp:93
pappso::TimsMsRunReaderDia::readSpectrumCollection
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
Definition timsmsrunreaderdia.cpp:116
pappso::TimsMsRunReaderDia::mp_timsDiaSlices
TimsDiaSlices * mp_timsDiaSlices
Definition timsmsrunreaderdia.h:119
pappso::TimsMsRunReaderDia::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 timsmsrunreaderdia.cpp:96
pappso::TimsMsRunReaderDia::massSpectrumSPtr
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
Definition timsmsrunreaderdia.cpp:133
pappso::TimsMsRunReaderDia::newXicCoordSPtrFromSpectrumIndex
virtual XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
Definition timsmsrunreaderdia.cpp:79
pappso::TimsMsRunReaderDia::initialize
virtual void initialize() override
Definition timsmsrunreaderdia.cpp:58
pappso::TimsMsRunReaderDia::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 timsmsrunreaderdia.cpp:166
pappso::TimsMsRunReaderDia::newXicCoordSPtrFromQualifiedMassSpectrum
virtual XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const QualifiedMassSpectrum &mass_spectrum, PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
Definition timsmsrunreaderdia.cpp:88
pappso::TimsMsRunReaderDia::TimsMsRunReaderDia
TimsMsRunReaderDia(MsRunIdCstSPtr &msrun_id_csp)
Definition timsmsrunreaderdia.cpp:38
pappso::TimsMsRunReaderDia::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 timsmsrunreaderdia.cpp:105
pappso::TimsMsRunReaderDia::massSpectrumCstSPtr
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
Definition timsmsrunreaderdia.cpp:139
pappso::TimsMsRunReaderDia::spectrumListSize
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
Definition timsmsrunreaderdia.cpp:146
pappso::TimsMsRunReaderDia::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition timsmsrunreaderdia.cpp:153
pappso::TimsMsRunReaderDia::~TimsMsRunReaderDia
virtual ~TimsMsRunReaderDia()
Definition timsmsrunreaderdia.cpp:52
pappso::TimsMsRunReaderDia::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 timsmsrunreaderdia.cpp:124
exceptionnotfound.h
exceptionnotimplemented.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
timsmsrunreaderdia.h