libpappsomspp
Library for mass spectrometry
pappso::MsRunReaderTicChromatogram Class Reference

calculate a TIC chromatogram More...

#include <spectrumcollectionhandlerinterface.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 void setQualifiedMassSpectrum (const QualifiedMassSpectrum &spectrum)=0
 
virtual bool needPeakList () const =0
 tells if we need the peak list (if we want the binary data) for each spectrum More...
 
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 spectrumcollectionhandlerinterface.h.

Constructor & Destructor Documentation

◆ MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::MsRunReaderTicChromatogram ( )

Definition at line 251 of file spectrumcollectionhandlerinterface.cpp.

252{
253}

◆ ~MsRunReaderTicChromatogram()

pappso::MsRunReaderTicChromatogram::~MsRunReaderTicChromatogram ( )
virtual

Definition at line 256 of file spectrumcollectionhandlerinterface.cpp.

257{
258}

Member Function Documentation

◆ getTicChromatogram()

Trace pappso::MsRunReaderTicChromatogram::getTicChromatogram ( ) const

◆ 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 262 of file spectrumcollectionhandlerinterface.cpp.

263{
264 return true;
265}

◆ setQualifiedMassSpectrum()

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

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 269 of file spectrumcollectionhandlerinterface.cpp.

271{
272 // In this specialized reader we want to compute the total ion current
273 // chromatogram that plot the sum of all the ion intensities in the spectra as
274 // a function of the retention time.
275
276 uint spectrum_ms_level = qualified_mass_spectrum.getMsLevel();
277
278 if(spectrum_ms_level != 1)
279 return;
280
281 double sumY = qualified_mass_spectrum.getMassSpectrumSPtr()->sumY();
282
283 if(!sumY)
284 return;
285
286 double rt = qualified_mass_spectrum.getRtInMinutes();
287
288 using Pair = std::pair<double, double>;
289 using Map = std::map<double, double>;
290 using Iterator = Map::iterator;
291
292 std::pair<Iterator, bool> res = m_ticChromMapTrace.insert(Pair(rt, sumY));
293
294 if(!res.second)
295 {
296 // One other same rt value was seen already (like in ion mobility mass
297 // spectrometry, for example). Only increment the y value.
298
299 res.first->second += sumY;
300 }
301}
@ rt
Retention time.
unsigned int uint
Definition: types.h:57

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

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