Loading...
Searching...
No Matches
pappso::MsRunReader Class Referenceabstract

base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory More...

`#include <msrunreader.h>`

Inheritance diagram for pappso::MsRunReader:

## Public Member Functions

| MsRunReader (MsRunIdCstSPtr &ms_run_id)
| MsRunReader (const MsRunReader &other)
virtual | ~MsRunReader ()
const MsRunIdCstSPtr & | getMsRunId () const
virtual MassSpectrumSPtr | massSpectrumSPtr (std::size_t spectrum_index)=0
| get a MassSpectrumSPtr class given its spectrum index
virtual MassSpectrumCstSPtr | massSpectrumCstSPtr (std::size_t spectrum_index)=0
virtual QualifiedMassSpectrum | qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const =0
| get a QualifiedMassSpectrum class given its scan number
virtual XicCoordSPtr | newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, PrecisionPtr precision) const =0
| get a xic coordinate object from a given spectrum index
virtual XicCoordSPtr | newXicCoordSPtrFromQualifiedMassSpectrum (const QualifiedMassSpectrum &mass_spectrum, PrecisionPtr precision) const =0
| get a xic coordinate object from a given spectrum
virtual std::size_t | spectrumListSize () const =0
| get the totat number of spectrum conained in the MSrun data file
virtual void | readSpectrumCollection (SpectrumCollectionHandlerInterface &handler)=0
| function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual void | readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)=0
virtual void | readSpectrumCollectionByMsLevel (SpectrumCollectionHandlerInterface &handler, unsigned int ms_level)=0
| function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels
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 bool | hasScanNumbers () const
| 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 ()=0
| 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 ()=0
| acquire data back end device
virtual std::vector< double > | getRetentionTimeLine ()
| retention timeline get retention times along the MSrun in seconds
virtual Trace | getTicChromatogram ()
| get a TIC chromatogram
void | setMonoThread (bool is_mono_thread)
| set only one is_mono_thread to true
bool | isMonoThread () const

## Protected Member Functions

virtual void | initialize ()=0
virtual bool | accept (const QString &file_name) const =0
| 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

## Protected Attributes

MsRunIdCstSPtr | mcsp_msRunId
MsRunReaderScanNumberMultiMap * | mpa_multiMapScanNumber = nullptr

## Private Attributes

bool | m_isMonoThread = false

## Friends

class | MsFileAccessor

## Detailed Description

base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory

Definition at line 62 of file msrunreader.h.

## Constructor & Destructor Documentation

## MsRunReader() [1/2]

pappso::MsRunReader::MsRunReader | ( | MsRunIdCstSPtr & | ms_run_id | ) |

Definition at line 43 of file msrunreader.cpp.

: mcsp_msRunId(ms_run_id)
{
}
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition msrunreader.h:175

## MsRunReader() [2/2]

pappso::MsRunReader::MsRunReader | ( | const MsRunReader & | other | ) |

Definition at line 47 of file msrunreader.cpp.

: mcsp_msRunId(other.mcsp_msRunId)
{
mpa_multiMapScanNumber = nullptr;
m_isMonoThread = other.m_isMonoThread;
}
pappso::MsRunReader::mpa_multiMapScanNumber
MsRunReaderScanNumberMultiMap * mpa_multiMapScanNumber
Definition msrunreader.h:176
pappso::MsRunReader::m_isMonoThread
bool m_isMonoThread
Definition msrunreader.h:187

References m_isMonoThread, and mpa_multiMapScanNumber.

## ~MsRunReader()

pappso::MsRunReader::~MsRunReader | ( |  | ) |

virtual

Definition at line 62 of file msrunreader.cpp.

{
if(mpa_multiMapScanNumber == nullptr)
delete mpa_multiMapScanNumber;
}

References mpa_multiMapScanNumber.

## Member Function Documentation

## accept()

virtual bool pappso::MsRunReader::accept | ( | const QString & | file_name | ) | const

protected pure 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

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

## acquireDevice()

virtual bool pappso::MsRunReader::acquireDevice | ( |  | ) |

pure virtual

acquire data back end device

Returns
  bool true if done

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::XyMsRunReader.

## getMsRunId()

const MsRunIdCstSPtr & pappso::MsRunReader::getMsRunId | ( |  | ) | const

Definition at line 56 of file msrunreader.cpp.

{
return mcsp_msRunId;
}

References mcsp_msRunId.

Referenced by pappso::TimsFramesMsRunReader::qualifiedMassSpectrum(), pappso::TimsMsRunReader::qualifiedMassSpectrum(), pappso::TimsMsRunReaderMs2::qualifiedMassSpectrum(), pappso::TimsMsRunReaderMs2Selected::qualifiedMassSpectrum(), pappso::TimsFramesMsRunReader::readSpectrumCollection2(), pappso::TimsMsRunReader::readSpectrumCollectionByMsLevel(), pappso::TimsMsRunReaderMs2::readSpectrumCollectionByMsLevel(), and pappso::MzxmlOutput::writeHeader().

## getRetentionTimeLine()

std::vector< double > pappso::MsRunReader::getRetentionTimeLine | ( |  | ) |

virtual

retention timeline get retention times along the MSrun in seconds

Returns
  vector of retention times (seconds)

Reimplemented in pappso::TimsMsRunReaderMs2.

Definition at line 119 of file msrunreader.cpp.

{
qDebug();
try
{
MsRunReaderRetentionTimeLine reader_timeline;
readSpectrumCollectionByMsLevel(reader_timeline, 1);
return reader_timeline.getRetentionTimeLine();
}
catch(ExceptionNotFound &error)
{
throw ExceptionNotFound(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
}
pappso::MsRunReader::readSpectrumCollectionByMsLevel
virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler, unsigned int ms_level)=0
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels

References pappso::MsRunReaderRetentionTimeLine::getRetentionTimeLine(), mcsp_msRunId, pappso::PappsoException::qwhat(), and readSpectrumCollectionByMsLevel().

## getTicChromatogram()

Trace pappso::MsRunReader::getTicChromatogram | ( |  | ) |

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 in pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, and pappso::TimsMsRunReaderMs2.

Definition at line 149 of file msrunreader.cpp.

{
qDebug();
try
{
MsRunReaderTicChromatogram ms_run_reader;
readSpectrumCollection(ms_run_reader);
return ms_run_reader.getTicChromatogram();
}
catch(ExceptionNotFound &error)
{
throw ExceptionNotFound(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
}
pappso::MsRunReader::readSpectrumCollection
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler)=0
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

References pappso::MsRunReaderTicChromatogram::getTicChromatogram(), mcsp_msRunId, pappso::PappsoException::qwhat(), and readSpectrumCollection().

## hasScanNumbers()

bool pappso::MsRunReader::hasScanNumbers | ( |  | ) | const

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 in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::TimsMsRunReaderMs2Selected.

Definition at line 113 of file msrunreader.cpp.

{
return false;
}

## initialize()

virtual void pappso::MsRunReader::initialize | ( |  | ) |

protected pure virtual

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

## isMonoThread()

bool pappso::MsRunReader::isMonoThread | ( |  | ) | const

Definition at line 75 of file msrunreader.cpp.

{
return m_isMonoThread;
}

References m_isMonoThread.

Referenced by pappso::TimsMsRunReaderMs2::readSpectrumCollectionByMsLevel().

## massSpectrumCstSPtr()

virtual MassSpectrumCstSPtr pappso::MsRunReader::massSpectrumCstSPtr | ( | std::size_t | spectrum_index | ) |

pure virtual

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

## massSpectrumSPtr()

virtual MassSpectrumSPtr pappso::MsRunReader::massSpectrumSPtr | ( | std::size_t | spectrum_index | ) |

pure virtual

get a MassSpectrumSPtr class given its spectrum index

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

## newXicCoordSPtrFromQualifiedMassSpectrum()

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

pure virtual

get a xic coordinate object from a given spectrum

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::XyMsRunReader.

## newXicCoordSPtrFromSpectrumIndex()

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

pure virtual

get a xic coordinate object from a given spectrum index

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::XyMsRunReader.

## qualifiedMassSpectrum()

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

pure virtual

get a QualifiedMassSpectrum class given its scan number

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

## readSpectrumCollection()

virtual void pappso::MsRunReader::readSpectrumCollection | ( | SpectrumCollectionHandlerInterface & | handler | ) |

pure virtual

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

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

Referenced by getTicChromatogram(), scanNumber2SpectrumIndex(), and pappso::MzxmlOutput::write().

## readSpectrumCollection2()

virtual void pappso::MsRunReader::readSpectrumCollection2 | ( | const MsRunReadConfig & | config,
|  | SpectrumCollectionHandlerInterface & | handler
| ) |  |

pure virtual

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

Referenced by pappso::MzxmlOutput::write().

## readSpectrumCollectionByMsLevel()

virtual void pappso::MsRunReader::readSpectrumCollectionByMsLevel | ( | SpectrumCollectionHandlerInterface & | handler,
|  | unsigned int | ms_level
| ) |  |

pure virtual

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

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::XyMsRunReader.

Referenced by getRetentionTimeLine().

## releaseDevice()

virtual bool pappso::MsRunReader::releaseDevice | ( |  | ) |

pure 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

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, and pappso::XyMsRunReader.

## scanNumber2SpectrumIndex()

std::size_t pappso::MsRunReader::scanNumber2SpectrumIndex | ( | std::size_t | scan_number | ) |

virtual

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.

Definition at line 82 of file msrunreader.cpp.

{
qDebug() << " " << mpa_multiMapScanNumber;
if(mpa_multiMapScanNumber == nullptr)
{
mpa_multiMapScanNumber = new MsRunReaderScanNumberMultiMap();
readSpectrumCollection(*mpa_multiMapScanNumber);
}
try
{
return mpa_multiMapScanNumber->getSpectrumIndexFromScanNumber(
scan_number);
}
catch(ExceptionNotFound &error)
{
throw ExceptionNotFound(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
catch(PappsoException &error)
{
throw PappsoException(QObject::tr("error reading file %1 : %2")
.arg(mcsp_msRunId.get()->getFileName())
.arg(error.qwhat()));
}
}
pappso::MsRunReaderScanNumberMultiMap::getSpectrumIndexFromScanNumber
std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const
Definition spectrumcollectionhandlerinterface.cpp:191

References pappso::MsRunReaderScanNumberMultiMap::getSpectrumIndexFromScanNumber(), mcsp_msRunId, mpa_multiMapScanNumber, pappso::PappsoException::qwhat(), and readSpectrumCollection().

## setMonoThread()

void pappso::MsRunReader::setMonoThread | ( | bool | is_mono_thread | ) |

set only one is_mono_thread to true

this avoid to use qtconcurrent

Definition at line 69 of file msrunreader.cpp.

{
m_isMonoThread = is_mono_thread;
}

References m_isMonoThread.

## spectrumListSize()

virtual std::size_t pappso::MsRunReader::spectrumListSize | ( |  | ) | const

pure virtual

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

Implemented in pappso::PwizMsRunReader, pappso::TimsFramesMsRunReader, pappso::TimsMsRunReader, pappso::TimsMsRunReaderMs2, pappso::TimsMsRunReaderMs2Selected, and pappso::XyMsRunReader.

Referenced by pappso::MzxmlOutput::write(), pappso::MzxmlOutput::write(), and pappso::MzxmlOutput::writeHeader().

## Friends And Related Symbol Documentation

## MsFileAccessor

friend class MsFileAccessor

friend

Definition at line 65 of file msrunreader.h.

## Member Data Documentation

## m_isMonoThread

bool pappso::MsRunReader::m_isMonoThread = false

private

Definition at line 187 of file msrunreader.h.

Referenced by MsRunReader(), isMonoThread(), and setMonoThread().

## mcsp_msRunId

MsRunIdCstSPtr pappso::MsRunReader::mcsp_msRunId

protected

Definition at line 175 of file msrunreader.h.

Referenced by getMsRunId(), getRetentionTimeLine(), getTicChromatogram(), pappso::PwizMsRunReader::initialize(), pappso::TimsFramesMsRunReader::initialize(), pappso::TimsMsRunReader::initialize(), pappso::XyMsRunReader::initialize(), pappso::PwizMsRunReader::processRetentionTime(), pappso::PwizMsRunReader::qualifiedMassSpectrum(), pappso::XyMsRunReader::qualifiedMassSpectrum(), pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizMSData(), pappso::PwizMsRunReader::qualifiedMassSpectrumFromPwizSpectrumPtr(), pappso::XyMsRunReader::qualifiedMassSpectrumFromXyMSDataFile(), pappso::XyMsRunReader::readSpectrumCollection(), pappso::PwizMsRunReader::readSpectrumCollectionByMsLevel(), pappso::XyMsRunReader::readSpectrumCollectionByMsLevel(), pappso::PwizMsRunReader::readSpectrumCollectionWithMsrunReadConfig(), and scanNumber2SpectrumIndex().

## mpa_multiMapScanNumber

MsRunReaderScanNumberMultiMap* pappso::MsRunReader::mpa_multiMapScanNumber = nullptr

protected

Definition at line 176 of file msrunreader.h.

Referenced by MsRunReader(), ~MsRunReader(), and scanNumber2SpectrumIndex().

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

- pappsomspp/msrun/msrunreader.h
- pappsomspp/msrun/msrunreader.cpp