libpappsomspp
Library for mass spectrometry
pappso::TimsMsRunReader Class Reference

#include <timsmsrunreader.h>

Inheritance diagram for pappso::TimsMsRunReader:
pappso::MsRunReader

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 More...
 
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 More...
 
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler More...
 
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 More...
 
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum index More...
 
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum (const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum More...
 
virtual std::size_t spectrumListSize () const override
 get the totat number of spectrum conained in the MSrun data file More...
 
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 More...
 
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 More...
 
virtual bool acquireDevice () override
 acquire data back end device More...
 
virtual TimsDataSp getTimsDataSPtr ()
 give an access to the underlying raw data pointer More...
 
virtual Trace getTicChromatogram () override
 get a TIC chromatogram More...
 
- Public Member Functions inherited from pappso::MsRunReader
 MsRunReader (MsRunIdCstSPtr &ms_run_id)
 
 MsRunReader (const MsRunReader &other)
 
virtual ~MsRunReader ()
 
const MsRunIdCstSPtrgetMsRunId () 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. More...
 
virtual std::vector< double > getRetentionTimeLine ()
 retention timeline get retention times along the MSrun in seconds More...
 
void setMonoThread (bool is_mono_thread)
 set only one is_mono_thread to true More...
 
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 More...
 

Private Attributes

TimsDataSp msp_timsData = nullptr
 

Friends

class MsFileAccessor
 

Additional Inherited Members

- Protected Attributes inherited from pappso::MsRunReader
MsRunIdCstSPtr mcsp_msRunId
 
MsRunReaderScanNumberMultiMapmpa_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 34 of file timsmsrunreader.cpp.

35  : MsRunReader(msrun_id_csp)
36 {
37  initialize();
38 }
MsRunReader(MsRunIdCstSPtr &ms_run_id)
virtual void initialize() override

References initialize().

◆ ~TimsMsRunReader()

TimsMsRunReader::~TimsMsRunReader ( )
virtual

Definition at line 40 of file timsmsrunreader.cpp.

41 {
42  msp_timsData = nullptr;
43 }

References msp_timsData.

Member Function Documentation

◆ accept()

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

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 60 of file timsmsrunreader.cpp.

61 {
62  qDebug() << file_name;
63  return true;
64 }

◆ acquireDevice()

bool TimsMsRunReader::acquireDevice ( )
overridevirtual

acquire data back end device

Returns
bool true if done

Implements pappso::MsRunReader.

Definition at line 146 of file timsmsrunreader.cpp.

147 {
148  if(msp_timsData == nullptr)
149  {
150  initialize();
151  }
152  return true;
153 }

References initialize(), and msp_timsData.

Referenced by getTicChromatogram(), and getTimsDataSPtr().

◆ getTicChromatogram()

Trace TimsMsRunReader::getTicChromatogram ( )
overridevirtual

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 188 of file timsmsrunreader.cpp.

189 {
190  // Use the Sqlite database to fetch the total ion current chromatogram (TIC
191  // chromatogram).
192 
193  acquireDevice();
194 
195  return msp_timsData->getTicChromatogram();
196 }
virtual bool acquireDevice() override
acquire data back end device

References acquireDevice(), and msp_timsData.

◆ getTimsDataSPtr()

TimsDataSp TimsMsRunReader::getTimsDataSPtr ( )
virtual

give an access to the underlying raw data pointer

Definition at line 180 of file timsmsrunreader.cpp.

181 {
182  acquireDevice();
183  return msp_timsData;
184 }

References acquireDevice(), and msp_timsData.

◆ hasScanNumbers()

bool TimsMsRunReader::hasScanNumbers ( ) const
overridevirtual

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 132 of file timsmsrunreader.cpp.

133 {
134  return false;
135 }

◆ initialize()

void TimsMsRunReader::initialize ( )
overrideprotectedvirtual

Implements pappso::MsRunReader.

Definition at line 46 of file timsmsrunreader.cpp.

47 {
48  msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
49 
50  if(msp_timsData == nullptr)
51  {
52  throw PappsoException(QObject::tr("ERROR in TimsMsRunReader::initialize "
53  "msp_timsData is null for MsRunId %1")
54  .arg(mcsp_msRunId.get()->toString()));
55  }
56 }
MsRunIdCstSPtr mcsp_msRunId
Definition: msrunreader.h:301

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

Referenced by TimsMsRunReader(), and acquireDevice().

◆ massSpectrumCstSPtr()

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

Implements pappso::MsRunReader.

Definition at line 77 of file timsmsrunreader.cpp.

78 {
79  return msp_timsData->getMassSpectrumCstSPtrByRawIndex(spectrum_index);
80 }

References msp_timsData.

◆ massSpectrumSPtr()

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

get a MassSpectrumSPtr class given its spectrum index

Implements pappso::MsRunReader.

Definition at line 68 of file timsmsrunreader.cpp.

69 {
71  QObject::tr("Not yet implemented in TimsMsRunReader %1.\n").arg(__LINE__));
72  return pappso::MassSpectrumSPtr();
73 }
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition: massspectrum.h:54

◆ newXicCoordSPtrFromQualifiedMassSpectrum()

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

get a xic coordinate object from a given spectrum

Implements pappso::MsRunReader.

Definition at line 169 of file timsmsrunreader.cpp.

172 {
173  throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
174  .arg(__FILE__)
175  .arg(__FUNCTION__)
176  .arg(__LINE__));
177 }

◆ newXicCoordSPtrFromSpectrumIndex()

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

get a xic coordinate object from a given spectrum index

Implements pappso::MsRunReader.

Definition at line 157 of file timsmsrunreader.cpp.

161 {
162  throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
163  .arg(__FILE__)
164  .arg(__FUNCTION__)
165  .arg(__LINE__));
166 }

◆ qualifiedMassSpectrum()

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

get a QualifiedMassSpectrum class given its scan number

Implements pappso::MsRunReader.

Definition at line 84 of file timsmsrunreader.cpp.

86 {
87 
88  QualifiedMassSpectrum mass_spectrum;
89 
90  msp_timsData->getQualifiedMassSpectrumByRawIndex(
91  getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
92  return mass_spectrum;
93 }
const MsRunIdCstSPtr & getMsRunId() const
Class representing a fully specified mass spectrum.

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

◆ readSpectrumCollection()

void TimsMsRunReader::readSpectrumCollection ( SpectrumCollectionHandlerInterface handler)
overridevirtual

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

Implements pappso::MsRunReader.

Definition at line 97 of file timsmsrunreader.cpp.

99 {
101 }
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

References readSpectrumCollectionByMsLevel().

◆ readSpectrumCollectionByMsLevel()

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

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

Implements pappso::MsRunReader.

Definition at line 105 of file timsmsrunreader.cpp.

107 {
108 
109  qDebug();
110 
111 
112  msp_timsData.get()->rawReaderSpectrumCollectionByMsLevel(
113  getMsRunId(), handler, ms_level);
114 
115  // Now let the loading handler know that the loading of the data has ended.
116  // The handler might need this "signal" to perform additional tasks or to
117  // cleanup cruft.
118 
119  // qDebug() << "Loading ended";
120  handler.loadingEnded();
121 }

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

Referenced by readSpectrumCollection().

◆ releaseDevice()

bool TimsMsRunReader::releaseDevice ( )
overridevirtual

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 139 of file timsmsrunreader.cpp.

140 {
141  msp_timsData = nullptr;
142  return true;
143 }

References msp_timsData.

◆ spectrumListSize()

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

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

Implements pappso::MsRunReader.

Definition at line 125 of file timsmsrunreader.cpp.

126 {
127  return msp_timsData->getTotalNumberOfScans();
128 }

References msp_timsData.

Friends And Related Function Documentation

◆ MsFileAccessor

friend class MsFileAccessor
friend

Definition at line 39 of file timsmsrunreader.h.

Member Data Documentation

◆ msp_timsData


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