libpappsomspp
Library for mass spectrometry
pappso::MsRunReaderTicChromatogram Class Reference

calculate a TIC chromatogram More...

#include <msrunreader.h>

Inheritance diagram for pappso::MsRunReaderTicChromatogram:
pappso::SpectrumCollectionHandlerInterface

Public Member Functions

 MsRunReaderTicChromatogram ()
 
virtual ~MsRunReaderTicChromatogram ()
 
virtual void setQualifiedMassSpectrum (const QualifiedMassSpectrum &qualified_mass_spectrum) override
 
virtual bool needPeakList () const override
 tells if we need the peak list (if we want the binary data) for each spectrum More...
 
Trace getTicChromatogram () const
 
- Public Member Functions inherited from pappso::SpectrumCollectionHandlerInterface
virtual bool needMsLevelPeakList (unsigned int ms_level) const final
 tells if we need the peak list (if we want the binary data) for each spectrum, given an MS level More...
 
virtual void setNeedMsLevelPeakList (unsigned int ms_level, bool want_peak_list) final
 tells if we need the peak list given More...
 
virtual bool shouldStop ()
 
virtual void loadingEnded ()
 
virtual void spectrumListHasSize (std::size_t size)
 
virtual void setReadAhead (bool is_read_ahead) final
 use threads to read a spectrum by batch of batch_size More...
 
virtual bool isReadAhead () const
 tells if we want to read ahead spectrum More...
 

Private Attributes

MapTrace m_ticChromMapTrace
 

Detailed Description

calculate a TIC chromatogram

Definition at line 167 of file msrunreader.h.

Constructor & Destructor Documentation

◆ MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::MsRunReaderTicChromatogram ( )

Definition at line 392 of file msrunreader.cpp.

393 {
394 }

◆ ~MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::~MsRunReaderTicChromatogram ( )
virtual

Definition at line 397 of file msrunreader.cpp.

398 {
399 }

Member Function Documentation

◆ getTicChromatogram()

Trace pappso::MsRunReaderTicChromatogram::getTicChromatogram ( ) const

Definition at line 446 of file msrunreader.cpp.

447 {
448  return m_ticChromMapTrace.toTrace();
449 }
Trace toTrace() const
Definition: maptrace.cpp:219

References m_ticChromMapTrace, and pappso::MapTrace::toTrace().

Referenced by pappso::MsRunReader::getTicChromatogram().

◆ needPeakList()

bool pappso::MsRunReaderTicChromatogram::needPeakList ( ) const
overridevirtual

tells if we need the peak list (if we want the binary data) for each spectrum

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 403 of file msrunreader.cpp.

404 {
405  return true;
406 }

◆ setQualifiedMassSpectrum()

void pappso::MsRunReaderTicChromatogram::setQualifiedMassSpectrum ( const QualifiedMassSpectrum qualified_mass_spectrum)
overridevirtual

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 410 of file msrunreader.cpp.

412 {
413  // In this specialized reader we want to compute the total ion current
414  // chromatogram that plot the sum of all the ion intensities in the spectra as
415  // a function of the retention time.
416 
417  uint spectrum_ms_level = qualified_mass_spectrum.getMsLevel();
418 
419  if(spectrum_ms_level != 1)
420  return;
421 
422  double sumY = qualified_mass_spectrum.getMassSpectrumSPtr()->sumY();
423 
424  if(!sumY)
425  return;
426 
427  double rt = qualified_mass_spectrum.getRtInMinutes();
428 
429  using Pair = std::pair<double, double>;
430  using Map = std::map<double, double>;
431  using Iterator = Map::iterator;
432 
433  std::pair<Iterator, bool> res = m_ticChromMapTrace.insert(Pair(rt, sumY));
434 
435  if(!res.second)
436  {
437  // One other same rt value was seen already (like in ion mobility mass
438  // spectrometry, for example). Only increment the y value.
439 
440  res.first->second += sumY;
441  }
442 }
@ rt
Retention time.
unsigned int uint
Definition: types.h:56

References pappso::QualifiedMassSpectrum::getMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::getMsLevel(), pappso::QualifiedMassSpectrum::getRtInMinutes(), m_ticChromMapTrace, pappso::res, and pappso::rt.

Member Data Documentation

◆ m_ticChromMapTrace

MapTrace pappso::MsRunReaderTicChromatogram::m_ticChromMapTrace
private

Definition at line 180 of file msrunreader.h.

Referenced by getTicChromatogram(), and setQualifiedMassSpectrum().


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