pappsomspp
Library for mass spectrometry
pappso::MsRunReaderScanNumberMultiMap Class Reference

provides a multimap to find quickly spectrum index from scan number More...

#include <msrunreader.h>

Inheritance diagram for pappso::MsRunReaderScanNumberMultiMap:
pappso::SpectrumCollectionHandlerInterface

Public Member Functions

 MsRunReaderScanNumberMultiMap ()
 
virtual ~MsRunReaderScanNumberMultiMap ()
 
virtual void setQualifiedMassSpectrum (const QualifiedMassSpectrum &spectrum) override
 
virtual bool needPeakList () const override
 tells if we need the peak list (if we want the binary data) for each spectrum More...
 
std::size_t getSpectrumIndexFromScanNumber (std::size_t scan_number) 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

std::multimap< std::size_t, std::size_t > m_mmap_scan2index
 

Detailed Description

provides a multimap to find quickly spectrum index from scan number

Definition at line 151 of file msrunreader.h.

Constructor & Destructor Documentation

◆ MsRunReaderScanNumberMultiMap()

pappso::MsRunReaderScanNumberMultiMap::MsRunReaderScanNumberMultiMap ( )

Definition at line 150 of file msrunreader.cpp.

152 {
153  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()";

◆ ~MsRunReaderScanNumberMultiMap()

pappso::MsRunReaderScanNumberMultiMap::~MsRunReaderScanNumberMultiMap ( )
virtual

Definition at line 154 of file msrunreader.cpp.

156 {
157  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()";

Member Function Documentation

◆ getSpectrumIndexFromScanNumber()

std::size_t pappso::MsRunReaderScanNumberMultiMap::getSpectrumIndexFromScanNumber ( std::size_t  scan_number) const

Definition at line 188 of file msrunreader.cpp.

191 {
192 
193  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
194  << " " << m_mmap_scan2index.size();
195  auto it = m_mmap_scan2index.find(scan_number);
196  if(it == m_mmap_scan2index.end())
197  {
198  throw ExceptionNotFound(
199  QObject::tr("scan number %1 not found").arg(scan_number));
200  }
201  std::size_t index = it->second;
202  it++;
203  if((it != m_mmap_scan2index.end()) && (it->first == scan_number))
204  {
205  throw PappsoException(
206  QObject::tr("scan number %1 found multiple times").arg(scan_number));
207  }
208  return index;

References m_mmap_scan2index.

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

◆ needPeakList()

bool pappso::MsRunReaderScanNumberMultiMap::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 159 of file msrunreader.cpp.

161 {
162  return false;

◆ setQualifiedMassSpectrum()

void pappso::MsRunReaderScanNumberMultiMap::setQualifiedMassSpectrum ( const QualifiedMassSpectrum spectrum)
overridevirtual

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 165 of file msrunreader.cpp.

168 {
169  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
170  << " " << qspectrum.getMassSpectrumId().getNativeId();
171  QStringList native_id_list =
172  qspectrum.getMassSpectrumId().getNativeId().split("=");
173  if(native_id_list.size() < 2)
174  {
175  return;
176  }
177  else
178  {
179  std::size_t scan_number = native_id_list.back().toULong();
180  m_mmap_scan2index.insert(std::pair<std::size_t, std::size_t>(
181  scan_number, qspectrum.getMassSpectrumId().getSpectrumIndex()));
182  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
183  << " " << scan_number << "=>"
184  << qspectrum.getMassSpectrumId().getSpectrumIndex();
185  }

References pappso::QualifiedMassSpectrum::getMassSpectrumId(), pappso::MassSpectrumId::getNativeId(), pappso::MassSpectrumId::getSpectrumIndex(), and m_mmap_scan2index.

Member Data Documentation

◆ m_mmap_scan2index

std::multimap<std::size_t, std::size_t> pappso::MsRunReaderScanNumberMultiMap::m_mmap_scan2index
private

Definition at line 154 of file msrunreader.h.

Referenced by getSpectrumIndexFromScanNumber(), and setQualifiedMassSpectrum().


The documentation for this class was generated from the following files:
pappso::MsRunReaderScanNumberMultiMap::m_mmap_scan2index
std::multimap< std::size_t, std::size_t > m_mmap_scan2index
Definition: msrunreader.h:154