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

Constructor & Destructor Documentation

◆ MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::MsRunReaderTicChromatogram ( )

Definition at line 391 of file msrunreader.cpp.

392 {
393 }

◆ ~MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::~MsRunReaderTicChromatogram ( )
virtual

Definition at line 396 of file msrunreader.cpp.

397 {
398 }

Member Function Documentation

◆ getTicChromatogram()

Trace pappso::MsRunReaderTicChromatogram::getTicChromatogram ( ) const

Definition at line 445 of file msrunreader.cpp.

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

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

403 {
404  return true;
405 }

◆ setQualifiedMassSpectrum()

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

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 409 of file msrunreader.cpp.

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

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

Referenced by getTicChromatogram(), and setQualifiedMassSpectrum().


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