libpappsomspp
Library for mass spectrometry
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:
pappso::PwizMsRunReader pappso::TimsMsRunReader pappso::TimsMsRunReaderMs2 pappso::XyMsRunReader

Public Member Functions

 MsRunReader (MsRunIdCstSPtr &ms_run_id)
 
 MsRunReader (const MsRunReader &other)
 
virtual ~MsRunReader ()
 
const MsRunIdCstSPtrgetMsRunId () const
 
virtual MassSpectrumSPtr massSpectrumSPtr (std::size_t spectrum_index)=0
 get a MassSpectrumSPtr class given its spectrum index More...
 
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 More...
 
virtual std::size_t spectrumListSize () const =0
 get the totat number of spectrum conained in the MSrun data file More...
 
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler)=0
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler More...
 
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 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 More...
 

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 More...
 

Protected Attributes

MsRunIdCstSPtr mcsp_msRunId
 
MsRunReaderScanNumberMultiMapmpa_multiMapScanNumber = nullptr
 

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 178 of file msrunreader.h.

Constructor & Destructor Documentation

◆ MsRunReader() [1/2]

pappso::MsRunReader::MsRunReader ( MsRunIdCstSPtr ms_run_id)

Definition at line 220 of file msrunreader.cpp.

220  : mcsp_msRunId(ms_run_id)
221 {
222 }

◆ MsRunReader() [2/2]

pappso::MsRunReader::MsRunReader ( const MsRunReader other)

Definition at line 224 of file msrunreader.cpp.

225  : mcsp_msRunId(other.mcsp_msRunId)
226 {
227  mpa_multiMapScanNumber = nullptr;
228 }

References mpa_multiMapScanNumber.

◆ ~MsRunReader()

pappso::MsRunReader::~MsRunReader ( )
virtual

Definition at line 238 of file msrunreader.cpp.

239 {
240  if(mpa_multiMapScanNumber == nullptr)
241  delete mpa_multiMapScanNumber;
242 }

References mpa_multiMapScanNumber.

Member Function Documentation

◆ accept()

virtual bool pappso::MsRunReader::accept ( const QString &  file_name) const
protectedpure 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::TimsMsRunReaderMs2, pappso::TimsMsRunReader, and pappso::XyMsRunReader.

◆ getMsRunId()

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

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

Definition at line 277 of file msrunreader.cpp.

278 {
279  return false;
280 }

◆ initialize()

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

◆ massSpectrumCstSPtr()

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

◆ 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::TimsMsRunReaderMs2, pappso::TimsMsRunReader, and pappso::XyMsRunReader.

◆ qualifiedMassSpectrum()

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

◆ 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::TimsMsRunReaderMs2, pappso::TimsMsRunReader, and pappso::XyMsRunReader.

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

◆ 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 246 of file msrunreader.cpp.

247 {
248  qDebug() << " " << mpa_multiMapScanNumber;
249 
250  if(mpa_multiMapScanNumber == nullptr)
251  {
252  mpa_multiMapScanNumber = new MsRunReaderScanNumberMultiMap();
254  }
255  try
256  {
258  scan_number);
259  }
260 
261  catch(ExceptionNotFound &error)
262  {
263  throw ExceptionNotFound(QObject::tr("error reading file %1 : %2")
264  .arg(mcsp_msRunId.get()->getFileName())
265  .arg(error.qwhat()));
266  }
267  catch(PappsoException &error)
268  {
269  throw PappsoException(QObject::tr("error reading file %1 : %2")
270  .arg(mcsp_msRunId.get()->getFileName())
271  .arg(error.qwhat()));
272  }
273 }

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

◆ 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::TimsMsRunReaderMs2, pappso::TimsMsRunReader, and pappso::XyMsRunReader.

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

Friends And Related Function Documentation

◆ MsFileAccessor

friend class MsFileAccessor
friend

Definition at line 181 of file msrunreader.h.

Member Data Documentation

◆ mcsp_msRunId

◆ mpa_multiMapScanNumber

MsRunReaderScanNumberMultiMap* pappso::MsRunReader::mpa_multiMapScanNumber = nullptr
protected

Definition at line 229 of file msrunreader.h.

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


The documentation for this class was generated from the following files:
pappso::MsRunReaderScanNumberMultiMap::getSpectrumIndexFromScanNumber
std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const
Definition: msrunreader.cpp:194
pappso::MsRunReader::mpa_multiMapScanNumber
MsRunReaderScanNumberMultiMap * mpa_multiMapScanNumber
Definition: msrunreader.h:229
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition: msrunreader.h:228
pappso::MsRunReader::readSpectrumCollection
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler)=0
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler