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

379 {
380 }

◆ ~MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::~MsRunReaderTicChromatogram ( )
virtual

Definition at line 383 of file msrunreader.cpp.

384 {
385 }

Member Function Documentation

◆ getTicChromatogram()

Trace pappso::MsRunReaderTicChromatogram::getTicChromatogram ( ) const

Definition at line 432 of file msrunreader.cpp.

433 {
434  return m_ticChromMapTrace.toTrace();
435 }
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 389 of file msrunreader.cpp.

390 {
391  return true;
392 }

◆ setQualifiedMassSpectrum()

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

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 396 of file msrunreader.cpp.

398 {
399  // In this specialized reader we want to compute the total ion current
400  // chromatogram that plot the sum of all the ion intensities in the spectra as
401  // a function of the retention time.
402 
403  uint spectrum_ms_level = qualified_mass_spectrum.getMsLevel();
404 
405  if(spectrum_ms_level != 1)
406  return;
407 
408  double sumY = qualified_mass_spectrum.getMassSpectrumSPtr()->sumY();
409 
410  if(!sumY)
411  return;
412 
413  double rt = qualified_mass_spectrum.getRtInMinutes();
414 
415  using Pair = std::pair<double, double>;
416  using Map = std::map<double, double>;
417  using Iterator = Map::iterator;
418 
419  std::pair<Iterator, bool> res = m_ticChromMapTrace.insert(Pair(rt, sumY));
420 
421  if(!res.second)
422  {
423  // One other same rt value was seen already (like in ion mobility mass
424  // spectrometry, for example). Only increment the y value.
425 
426  res.first->second += sumY;
427  }
428 }
@ 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: