Loading...
Searching...
No Matches
timsmsrunreaderbase.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/msrun/private/timsmsrunreaderbase.cpp
* \date 15/07/2024
* \author Olivier Langella
* \brief Base class for all tims ms run reader objects
*/
/*******************************************************************************
* 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 "timsmsrunreaderbase.h"
#include "../../exception/exceptionnotimplemented.h"
#include "../../exception/exceptioninterrupted.h"
#include <QDebug>
namespace pappso
{
TimsMsRunReaderBase::TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
: MsRunReader(msrun_id_csp)
{
initialize();
}
TimsMsRunReaderBase::TimsMsRunReaderBase(
const TimsMsRunReaderBase &msrun_reader_base)
: MsRunReader(msrun_reader_base.getMsRunId()),
msp_timsData(msrun_reader_base.msp_timsData)
{
initialize();
}
TimsMsRunReaderBase::~TimsMsRunReaderBase()
{
msp_timsData = nullptr;
}
void
TimsMsRunReaderBase::initialize()
{
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 TimsMsRunReaderBase::initialize "
"msp_timsData is null for MsRunId %1")
.arg(mcsp_msRunId.get()->toString()));
}
}
bool
TimsMsRunReaderBase::accept(const QString &file_name) const
{
qDebug() << file_name;
return true;
}
bool
TimsMsRunReaderBase::hasScanNumbers() const
{
return false;
}
bool
TimsMsRunReaderBase::releaseDevice()
{
msp_timsData = nullptr;
return true;
}
bool
TimsMsRunReaderBase::acquireDevice()
{
if(msp_timsData == nullptr)
{
initialize();
}
return true;
}
TimsDataSp
TimsMsRunReaderBase::getTimsDataSPtr()
{
acquireDevice();
return msp_timsData;
}
Trace
TimsMsRunReaderBase::getTicChromatogram()
{
// Use the Sqlite database to fetch the total ion current chromatogram (TIC
// chromatogram).
acquireDevice();
// The time unit here is seconds, not minutes!!!
return msp_timsData->getTicChromatogram();
}
std::vector<double>
pappso::TimsMsRunReaderBase::getRetentionTimeLine()
{
return msp_timsData.get()->getRetentionTimeLineInSeconds();
}
XicCoordSPtr
TimsMsRunReaderBase::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__));
}
XicCoordSPtr
TimsMsRunReaderBase::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__));
}
} // namespace pappso
pappso::ExceptionNotImplemented
Definition exceptionnotimplemented.h:32
pappso::MsRunReader
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
Definition msrunreader.h:63
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition msrunreader.h:175
pappso::PappsoException
Definition pappsoexception.h:42
pappso::PrecisionBase
Definition precision.h:44
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:99
pappso::TimsMsRunReaderBase
Definition timsmsrunreaderbase.h:38
pappso::TimsMsRunReaderBase::TimsMsRunReaderBase
TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
Definition timsmsrunreaderbase.cpp:36
pappso::TimsMsRunReaderBase::getTicChromatogram
virtual Trace getTicChromatogram() override
get a TIC chromatogram
Definition timsmsrunreaderbase.cpp:114
pappso::TimsMsRunReaderBase::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 timsmsrunreaderbase.cpp:89
pappso::TimsMsRunReaderBase::initialize
virtual void initialize() override
Definition timsmsrunreaderbase.cpp:58
pappso::TimsMsRunReaderBase::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 timsmsrunreaderbase.cpp:134
pappso::TimsMsRunReaderBase::getRetentionTimeLine
virtual std::vector< double > getRetentionTimeLine() override
retention timeline get retention times along the MSrun in seconds
Definition timsmsrunreaderbase.cpp:127
pappso::TimsMsRunReaderBase::msp_timsData
TimsDataSp msp_timsData
Definition timsmsrunreaderbase.h:84
pappso::TimsMsRunReaderBase::~TimsMsRunReaderBase
virtual ~TimsMsRunReaderBase()
Definition timsmsrunreaderbase.cpp:51
pappso::TimsMsRunReaderBase::hasScanNumbers
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
Definition timsmsrunreaderbase.cpp:82
pappso::TimsMsRunReaderBase::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 timsmsrunreaderbase.cpp:145
pappso::TimsMsRunReaderBase::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition timsmsrunreaderbase.cpp:96
pappso::TimsMsRunReaderBase::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 timsmsrunreaderbase.cpp:75
pappso::TimsMsRunReaderBase::getTimsDataSPtr
virtual TimsDataSp getTimsDataSPtr()
give an access to the underlying raw data pointer
Definition timsmsrunreaderbase.cpp:106
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
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::TimsDataSp
std::shared_ptr< TimsData > TimsDataSp
shared pointer on a TimsData object
Definition timsdata.h:52
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:43
timsmsrunreaderbase.h
Base class for all tims ms run reader objects.