Loading...
Searching...
No Matches
pappso::TimsMsRunReader Class Reference

`#include <timsmsrunreader.h>`

Inheritance diagram for pappso::TimsMsRunReader:

## Public Member Functions

| TimsMsRunReader (MsRunIdCstSPtr &msrun_id_csp)
virtual | ~TimsMsRunReader ()
virtual MassSpectrumSPtr | massSpectrumSPtr (std::size_t spectrum_index) override
| get a MassSpectrumSPtr class given its spectrum index
virtual MassSpectrumCstSPtr | massSpectrumCstSPtr (std::size_t spectrum_index) override
virtual QualifiedMassSpectrum | qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const override
| get a QualifiedMassSpectrum class given its scan number
virtual void | readSpectrumCollection (SpectrumCollectionHandlerInterface &handler) override
| function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual void | readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
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
virtual pappso::XicCoordSPtr | newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
| get a xic coordinate object from a given spectrum index
virtual pappso::XicCoordSPtr | newXicCoordSPtrFromQualifiedMassSpectrum (const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
| get a xic coordinate object from a given spectrum
virtual std::size_t | spectrumListSize () const override
| get the totat number of spectrum conained in the MSrun data file
virtual bool | hasScanNumbers () const override
| tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file
virtual bool | releaseDevice () override
| release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object
virtual bool | acquireDevice () override
| acquire data back end device
virtual TimsDataSp | getTimsDataSPtr ()
| give an access to the underlying raw data pointer
virtual Trace | getTicChromatogram () override
| get a TIC chromatogram
Public Member Functions inherited from pappso::MsRunReader
| MsRunReader (MsRunIdCstSPtr &ms_run_id)
| MsRunReader (const MsRunReader &other)
virtual | ~MsRunReader ()
const MsRunIdCstSPtr & | getMsRunId () const
virtual std::size_t | scanNumber2SpectrumIndex (std::size_t scan_number)
| if possible, converts a scan number into a spectrum index This is a convenient function to help transition from the old scan number (not implemented by all vendors) to more secure spectrum index (not vendor dependant). It is better to not rely on this function.
virtual std::vector< double > | getRetentionTimeLine ()
| retention timeline get retention times along the MSrun in seconds
void | setMonoThread (bool is_mono_thread)
| set only one is_mono_thread to true
bool | isMonoThread () const

## Protected Member Functions

virtual void | initialize () override
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, specific of one or more file format

## Private Attributes

TimsDataSp | msp_timsData = nullptr

## Friends

class | MsFileAccessor

## Additional Inherited Members

Protected Attributes inherited from pappso::MsRunReader
MsRunIdCstSPtr | mcsp_msRunId
MsRunReaderScanNumberMultiMap * | mpa_multiMapScanNumber = nullptr

## Detailed Description

Definition at line 37 of file timsmsrunreader.h.

## Constructor & Destructor Documentation

## TimsMsRunReader()

TimsMsRunReader::TimsMsRunReader | ( | MsRunIdCstSPtr & | msrun_id_csp | ) |

Todo:
  write docs

Definition at line 35 of file timsmsrunreader.cpp.

: MsRunReader(msrun_id_csp)
{
initialize();
}
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::TimsMsRunReader::initialize
virtual void initialize() override
Definition timsmsrunreader.cpp:47

References initialize().

## ~TimsMsRunReader()

TimsMsRunReader::~TimsMsRunReader | ( |  | ) |

virtual

Definition at line 41 of file timsmsrunreader.cpp.

{
msp_timsData = nullptr;
}
pappso::TimsMsRunReader::msp_timsData
TimsDataSp msp_timsData
Definition timsmsrunreader.h:96

References msp_timsData.

## Member Function Documentation

## accept()

bool TimsMsRunReader::accept | ( | const QString & | file_name | ) | const

override protected virtual

tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format

Implements pappso::MsRunReader.

Definition at line 61 of file timsmsrunreader.cpp.

{
qDebug() << file_name;
return true;
}

## acquireDevice()

bool TimsMsRunReader::acquireDevice | ( |  | ) |

override virtual

acquire data back end device

Returns
  bool true if done

Implements pappso::MsRunReader.

Definition at line 162 of file timsmsrunreader.cpp.

{
if(msp_timsData == nullptr)
{
initialize();
}
return true;
}

References initialize(), and msp_timsData.

Referenced by getTicChromatogram(), and getTimsDataSPtr().

## getTicChromatogram()

Trace TimsMsRunReader::getTicChromatogram | ( |  | ) |

override virtual

get a TIC chromatogram

for each retention time, computes the sum of all intensities. For IM-MS, combines the mobility spectra

Note that, formally, a TIC chromatogram is computed only for MS1 spectra.

Returns
  a trace (x=rt, y=intensities)

Reimplemented from pappso::MsRunReader.

Definition at line 204 of file timsmsrunreader.cpp.

{
// 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();
}
pappso::TimsMsRunReader::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition timsmsrunreader.cpp:162

References acquireDevice(), and msp_timsData.

## getTimsDataSPtr()

TimsDataSp TimsMsRunReader::getTimsDataSPtr | ( |  | ) |

virtual

give an access to the underlying raw data pointer

Definition at line 196 of file timsmsrunreader.cpp.

{
acquireDevice();
return msp_timsData;
}

References acquireDevice(), and msp_timsData.

## hasScanNumbers()

bool TimsMsRunReader::hasScanNumbers | ( |  | ) | const

override virtual

tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file

Reimplemented from pappso::MsRunReader.

Definition at line 148 of file timsmsrunreader.cpp.

{
return false;
}

## initialize()

void TimsMsRunReader::initialize | ( |  | ) |

override protected virtual

Implements pappso::MsRunReader.

Definition at line 47 of file timsmsrunreader.cpp.

{
msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
if(msp_timsData == nullptr)
{
throw PappsoException(QObject::tr("ERROR in TimsMsRunReader::initialize "
"msp_timsData is null for MsRunId %1")
.arg(mcsp_msRunId.get()->toString()));
}
}
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition msrunreader.h:175
pappso::PappsoException
Definition pappsoexception.h:42

References pappso::MsRunReader::mcsp_msRunId, and msp_timsData.

Referenced by TimsMsRunReader(), and acquireDevice().

## massSpectrumCstSPtr()

pappso::MassSpectrumCstSPtr TimsMsRunReader::massSpectrumCstSPtr | ( | std::size_t | spectrum_index | ) |

override virtual

Implements pappso::MsRunReader.

Definition at line 78 of file timsmsrunreader.cpp.

{
return msp_timsData->getMassSpectrumCstSPtrByRawIndex(spectrum_index);
}

References msp_timsData.

## massSpectrumSPtr()

pappso::MassSpectrumSPtr TimsMsRunReader::massSpectrumSPtr | ( | std::size_t | spectrum_index | ) |

override virtual

get a MassSpectrumSPtr class given its spectrum index

Implements pappso::MsRunReader.

Definition at line 69 of file timsmsrunreader.cpp.

{
throw ExceptionNotImplemented(
QObject::tr("Not yet implemented in TimsMsRunReader %1.\n").arg(__LINE__));
return pappso::MassSpectrumSPtr();
}
pappso::ExceptionNotImplemented
Definition exceptionnotimplemented.h:32
pappso::MassSpectrumSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition massspectrum.h:56

## newXicCoordSPtrFromQualifiedMassSpectrum()

XicCoordSPtr TimsMsRunReader::newXicCoordSPtrFromQualifiedMassSpectrum | ( | const pappso::QualifiedMassSpectrum & | mass_spectrum,
|  | pappso::PrecisionPtr | precision
| ) |  | const

override virtual

get a xic coordinate object from a given spectrum

Implements pappso::MsRunReader.

Definition at line 185 of file timsmsrunreader.cpp.

{
throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}

## newXicCoordSPtrFromSpectrumIndex()

XicCoordSPtr TimsMsRunReader::newXicCoordSPtrFromSpectrumIndex | ( | std::size_t | spectrum_index,
|  | pappso::PrecisionPtr | precision
| ) |  | const

override virtual

get a xic coordinate object from a given spectrum index

Implements pappso::MsRunReader.

Definition at line 173 of file timsmsrunreader.cpp.

{
throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}

## qualifiedMassSpectrum()

QualifiedMassSpectrum TimsMsRunReader::qualifiedMassSpectrum | ( | std::size_t | spectrum_index,
|  | bool | want_binary_data = `true`
| ) |  | const

override virtual

get a QualifiedMassSpectrum class given its scan number

Implements pappso::MsRunReader.

Definition at line 85 of file timsmsrunreader.cpp.

{
QualifiedMassSpectrum mass_spectrum;
msp_timsData->getQualifiedMassSpectrumByRawIndex(
getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
return mass_spectrum;
}
pappso::MsRunReader::getMsRunId
const MsRunIdCstSPtr & getMsRunId() const
Definition msrunreader.cpp:56
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:93

References pappso::MsRunReader::getMsRunId(), and msp_timsData.

## readSpectrumCollection()

void TimsMsRunReader::readSpectrumCollection | ( | SpectrumCollectionHandlerInterface & | handler | ) |

override virtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

Implements pappso::MsRunReader.

Definition at line 98 of file timsmsrunreader.cpp.

{
readSpectrumCollectionByMsLevel(handler, 0);
}
pappso::TimsMsRunReader::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 timsmsrunreader.cpp:113

References readSpectrumCollectionByMsLevel().

Referenced by readSpectrumCollection2().

## readSpectrumCollection2()

void TimsMsRunReader::readSpectrumCollection2 | ( | const MsRunReadConfig & | config,
|  | SpectrumCollectionHandlerInterface & | handler
| ) |  |

override virtual

Implements pappso::MsRunReader.

Definition at line 105 of file timsmsrunreader.cpp.

{
return readSpectrumCollection(handler);
}
pappso::TimsMsRunReader::readSpectrumCollection
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
Definition timsmsrunreader.cpp:98

References readSpectrumCollection().

## readSpectrumCollectionByMsLevel()

void TimsMsRunReader::readSpectrumCollectionByMsLevel | ( | SpectrumCollectionHandlerInterface & | handler,
|  | unsigned int | ms_level
| ) |  |

override virtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels

Implements pappso::MsRunReader.

Definition at line 113 of file timsmsrunreader.cpp.

{
qDebug();
try
{
msp_timsData.get()->rawReaderSpectrumCollectionByMsLevel(
getMsRunId(), handler, ms_level);
}
catch(ExceptionInterrupted &)
{
qDebug() << "Reading of MS data interrupted by the user.";
}
// Now let the loading handler know that the loading of the data has ended.
// The handler might need this "signal" to perform additional tasks or to
// cleanup cruft.
// qDebug() << "Loading ended";
handler.loadingEnded();
}
pappso::ExceptionInterrupted
Definition exceptioninterrupted.h:36
pappso::SpectrumCollectionHandlerInterface::loadingEnded
virtual void loadingEnded()
Definition spectrumcollectionhandlerinterface.cpp:43

References pappso::MsRunReader::getMsRunId(), pappso::SpectrumCollectionHandlerInterface::loadingEnded(), and msp_timsData.

Referenced by readSpectrumCollection().

## releaseDevice()

bool TimsMsRunReader::releaseDevice | ( |  | ) |

override virtual

release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object

Returns
  bool true if done

Implements pappso::MsRunReader.

Definition at line 155 of file timsmsrunreader.cpp.

{
msp_timsData = nullptr;
return true;
}

References msp_timsData.

## spectrumListSize()

std::size_t TimsMsRunReader::spectrumListSize | ( |  | ) | const

override virtual

get the totat number of spectrum conained in the MSrun data file

Implements pappso::MsRunReader.

Definition at line 141 of file timsmsrunreader.cpp.

{
return msp_timsData->getTotalNumberOfScans();
}

References msp_timsData.

## Friends And Related Symbol Documentation

## MsFileAccessor

friend class MsFileAccessor

friend

Definition at line 39 of file timsmsrunreader.h.

## Member Data Documentation

## msp_timsData

TimsDataSp pappso::TimsMsRunReader::msp_timsData = nullptr

private

Definition at line 96 of file timsmsrunreader.h.

Referenced by ~TimsMsRunReader(), acquireDevice(), getTicChromatogram(), getTimsDataSPtr(), initialize(), massSpectrumCstSPtr(), qualifiedMassSpectrum(), readSpectrumCollectionByMsLevel(), releaseDevice(), and spectrumListSize().

The documentation for this class was generated from the following files:

- pappsomspp/msrun/private/timsmsrunreader.h
- pappsomspp/msrun/private/timsmsrunreader.cpp