libpappsomspp
Library for mass spectrometry
pappso::TimsFramesMsRunReader Class Reference

#include <timsframesmsrunreader.h>

Inheritance diagram for pappso::TimsFramesMsRunReader:
pappso::MsRunReader

Public Member Functions

 TimsFramesMsRunReader (MsRunIdCstSPtr &msrun_id_csp)
 
virtual ~TimsFramesMsRunReader ()
 
virtual MassSpectrumSPtr massSpectrumSPtr (std::size_t spectrum_index) override
 get a MassSpectrumSPtr class given its spectrum index More...
 
virtual MassSpectrumCstSPtr massSpectrumCstSPtr (std::size_t spectrum_index) override
 
virtual QualifiedMassSpectrum qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const override
 get a QualifiedMassSpectrum class given its scan number More...
 
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler More...
 
virtual void readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
 
virtual void readSpectrumCollectionByMsLevel (SpectrumCollectionHandlerInterface &handler, unsigned int ms_level) override
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels More...
 
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum index More...
 
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum (const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
 get a xic coordinate object from a given spectrum More...
 
virtual std::size_t spectrumListSize () const override
 get the totat number of spectrum conained in the MSrun data file More...
 
virtual bool hasScanNumbers () const override
 tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file More...
 
virtual bool releaseDevice () override
 release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object More...
 
virtual bool acquireDevice () override
 acquire data back end device More...
 
virtual TimsDataSp getTimsDataSPtr ()
 give an access to the underlying raw data pointer More...
 
virtual Trace getTicChromatogram () override
 get a TIC chromatogram More...
 
virtual Trace computeTicChromatogram ()
 
- Public Member Functions inherited from pappso::MsRunReader
 MsRunReader (MsRunIdCstSPtr &ms_run_id)
 
 MsRunReader (const MsRunReader &other)
 
virtual ~MsRunReader ()
 
const MsRunIdCstSPtrgetMsRunId () const
 
virtual MassSpectrumSPtr massSpectrumSPtr (std::size_t spectrum_index)=0
 get a MassSpectrumSPtr class given its spectrum index More...
 
virtual MassSpectrumCstSPtr massSpectrumCstSPtr (std::size_t spectrum_index)=0
 
virtual QualifiedMassSpectrum qualifiedMassSpectrum (std::size_t spectrum_index, bool want_binary_data=true) const =0
 get a QualifiedMassSpectrum class given its scan number More...
 
virtual XicCoordSPtr newXicCoordSPtrFromSpectrumIndex (std::size_t spectrum_index, PrecisionPtr precision) const =0
 get a xic coordinate object from a given spectrum index More...
 
virtual XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum (const QualifiedMassSpectrum &mass_spectrum, PrecisionPtr precision) const =0
 get a xic coordinate object from a given spectrum More...
 
virtual std::size_t spectrumListSize () const =0
 get the totat number of spectrum conained in the MSrun data file More...
 
virtual void readSpectrumCollection (SpectrumCollectionHandlerInterface &handler)=0
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler More...
 
virtual void readSpectrumCollection2 (const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)=0
 
virtual void readSpectrumCollectionByMsLevel (SpectrumCollectionHandlerInterface &handler, unsigned int ms_level)=0
 function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels More...
 
virtual std::size_t scanNumber2SpectrumIndex (std::size_t scan_number)
 if possible, converts a scan number into a spectrum index This is a convenient function to help transition from the old scan number (not implemented by all vendors) to more secure spectrum index (not vendor dependant). It is better to not rely on this function. More...
 
virtual bool hasScanNumbers () const
 tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file More...
 
virtual bool releaseDevice ()=0
 release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object More...
 
virtual bool acquireDevice ()=0
 acquire data back end device More...
 
virtual std::vector< double > getRetentionTimeLine ()
 retention timeline get retention times along the MSrun in seconds More...
 
virtual Trace getTicChromatogram ()
 get a TIC chromatogram More...
 
void setMonoThread (bool is_mono_thread)
 set only one is_mono_thread to true More...
 
bool isMonoThread () const
 

Protected Member Functions

virtual void initialize () override
 
virtual bool accept (const QString &file_name) const override
 tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format More...
 
virtual void initialize ()=0
 
virtual bool accept (const QString &file_name) const =0
 tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format More...
 

Private Attributes

TimsDataSp msp_timsData = nullptr
 

Friends

class MsFileAccessor
 

Additional Inherited Members

- Protected Attributes inherited from pappso::MsRunReader
MsRunIdCstSPtr mcsp_msRunId
 
MsRunReaderScanNumberMultiMapmpa_multiMapScanNumber = nullptr
 

Detailed Description

Definition at line 43 of file timsframesmsrunreader.h.

Constructor & Destructor Documentation

◆ TimsFramesMsRunReader()

TimsFramesMsRunReader::TimsFramesMsRunReader ( MsRunIdCstSPtr msrun_id_csp)
Todo:
write docs

Definition at line 34 of file timsframesmsrunreader.cpp.

35 : MsRunReader(msrun_id_csp)
36{
37 qDebug() << "Now initializing the TimsFramesMsRunReader.";
38
39 initialize();
40}
MsRunReader(MsRunIdCstSPtr &ms_run_id)
Definition: msrunreader.cpp:43
virtual void initialize() override

References initialize().

◆ ~TimsFramesMsRunReader()

TimsFramesMsRunReader::~TimsFramesMsRunReader ( )
virtual

Definition at line 42 of file timsframesmsrunreader.cpp.

43{
44 msp_timsData = nullptr;
45}

References msp_timsData.

Member Function Documentation

◆ accept()

bool TimsFramesMsRunReader::accept ( const QString &  file_name) const
overrideprotectedvirtual

tells if the reader is able to handle this file must be implemented by private MS run reader, specific of one or more file format

Implements pappso::MsRunReader.

Definition at line 62 of file timsframesmsrunreader.cpp.

63{
64 qDebug() << file_name;
65 return true;
66}

◆ acquireDevice()

bool TimsFramesMsRunReader::acquireDevice ( )
overridevirtual

acquire data back end device

Returns
bool true if done

Implements pappso::MsRunReader.

Definition at line 378 of file timsframesmsrunreader.cpp.

379{
380 if(msp_timsData == nullptr)
381 {
382 initialize();
383 }
384 return true;
385}

References initialize(), and msp_timsData.

Referenced by getTicChromatogram(), and getTimsDataSPtr().

◆ computeTicChromatogram()

Trace TimsFramesMsRunReader::computeTicChromatogram ( )
virtual

Definition at line 431 of file timsframesmsrunreader.cpp.

432{
433
434 // We want to compute the TIC chromatogram, not load the chromatogram that
435 // is located in the SQL database.
436 //
437 // For this, we need to iterated into the frames and ask for MS1 spectra
438 // only. msp_timsData has that information:
439 //
440 // std::vector<FrameIdDescr> m_frameIdDescrList;
441 //
442 // and
443
444 // struct FrameIdDescr
445 // {
446 // std::size_t m_frameId; // frame id
447 // std::size_t m_size; // frame size (number of TOF scans in frame)
448 // std::size_t m_cumulSize; // cumulative size
449 // };
450
451 Trace tic_chromatogram;
452
453 const std::vector<FrameIdDescr> frame_descr_list =
454 msp_timsData->getFrameIdDescrList();
455
456 for(FrameIdDescr frame_id_descr : frame_descr_list)
457 {
458 TimsFrameCstSPtr tims_frame_csp =
459 msp_timsData->getTimsFrameCstSPtrCached(frame_id_descr.m_frameId);
460 std::size_t scan_begin = 0;
461 std::size_t scan_end = tims_frame_csp->getTotalNumberOfScans() - 1;
462
463 // By convention, a TIC chromatogram is only performed using MS1
464 // spectra.
465 if(tims_frame_csp->getMsLevel() == 1)
466 {
467
468 double rt = tims_frame_csp->getTime();
469
470 tic_chromatogram.append(DataPoint(
471 rt,
472 tims_frame_csp->cumulateScansIntensities(scan_begin, scan_end)));
473 }
474 else
475 continue;
476 }
477
478 return tic_chromatogram;
479}
A simple container of DataPoint instances.
Definition: trace.h:148
size_t append(const DataPoint &data_point)
appends a datapoint and return new size
Definition: trace.cpp:648
@ rt
Retention time.
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
Definition: timsframe.h:42

References pappso::Trace::append(), msp_timsData, and pappso::rt.

◆ getTicChromatogram()

Trace TimsFramesMsRunReader::getTicChromatogram ( )
overridevirtual

get a TIC chromatogram

for each retention time, computes the sum of all intensities. For IM-MS, combines the mobility spectra

Note that, formally, a TIC chromatogram is computed only for MS1 spectra.

Returns
a trace (x=rt, y=intensities)

Reimplemented from pappso::MsRunReader.

Definition at line 419 of file timsframesmsrunreader.cpp.

420{
421 // Use the Sqlite database to fetch the total ion current chromatogram (TIC
422 // chromatogram).
423
425
426 return msp_timsData->getTicChromatogram();
427}
virtual bool acquireDevice() override
acquire data back end device

References acquireDevice(), and msp_timsData.

◆ getTimsDataSPtr()

TimsDataSp TimsFramesMsRunReader::getTimsDataSPtr ( )
virtual

give an access to the underlying raw data pointer

Definition at line 411 of file timsframesmsrunreader.cpp.

412{
414 return msp_timsData;
415}

References acquireDevice(), and msp_timsData.

◆ hasScanNumbers()

bool TimsFramesMsRunReader::hasScanNumbers ( ) const
overridevirtual

tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided functions can check if scan numbers are available in the current file

Reimplemented from pappso::MsRunReader.

Definition at line 364 of file timsframesmsrunreader.cpp.

365{
366 return false;
367}

◆ initialize()

void TimsFramesMsRunReader::initialize ( )
overrideprotectedvirtual

Implements pappso::MsRunReader.

Definition at line 48 of file timsframesmsrunreader.cpp.

49{
50 msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
51 if(msp_timsData == nullptr)
52 {
53 throw PappsoException(
54 QObject::tr("ERROR in TimsFramesMsRunReader::initialize "
55 "msp_timsData is null for MsRunId %1")
56 .arg(mcsp_msRunId.get()->toString()));
57 }
58}
MsRunIdCstSPtr mcsp_msRunId
Definition: msrunreader.h:175

References pappso::MsRunReader::mcsp_msRunId, and msp_timsData.

Referenced by TimsFramesMsRunReader(), and acquireDevice().

◆ massSpectrumCstSPtr()

pappso::MassSpectrumCstSPtr TimsFramesMsRunReader::massSpectrumCstSPtr ( std::size_t  spectrum_index)
overridevirtual

Implements pappso::MsRunReader.

Definition at line 82 of file timsframesmsrunreader.cpp.

83{
84 return msp_timsData->getMassSpectrumCstSPtrByRawIndex(spectrum_index);
85}

References msp_timsData.

◆ massSpectrumSPtr()

pappso::MassSpectrumSPtr TimsFramesMsRunReader::massSpectrumSPtr ( std::size_t  spectrum_index)
overridevirtual

get a MassSpectrumSPtr class given its spectrum index

Implements pappso::MsRunReader.

Definition at line 70 of file timsframesmsrunreader.cpp.

72{
74 QObject::tr("Not yet implemented in TimsFramesMsRunReader %1.\n")
75 .arg(__LINE__));
76
78}
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition: massspectrum.h:54

◆ newXicCoordSPtrFromQualifiedMassSpectrum()

XicCoordSPtr TimsFramesMsRunReader::newXicCoordSPtrFromQualifiedMassSpectrum ( const pappso::QualifiedMassSpectrum mass_spectrum,
pappso::PrecisionPtr  precision 
) const
overridevirtual

get a xic coordinate object from a given spectrum

Implements pappso::MsRunReader.

Definition at line 400 of file timsframesmsrunreader.cpp.

403{
404 throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
405 .arg(__FILE__)
406 .arg(__FUNCTION__)
407 .arg(__LINE__));
408}

◆ newXicCoordSPtrFromSpectrumIndex()

XicCoordSPtr TimsFramesMsRunReader::newXicCoordSPtrFromSpectrumIndex ( std::size_t  spectrum_index,
pappso::PrecisionPtr  precision 
) const
overridevirtual

get a xic coordinate object from a given spectrum index

Implements pappso::MsRunReader.

Definition at line 389 of file timsframesmsrunreader.cpp.

392{
393 throw ExceptionNotImplemented(QObject::tr("Not implemented %1 %2 %3")
394 .arg(__FILE__)
395 .arg(__FUNCTION__)
396 .arg(__LINE__));
397}

◆ qualifiedMassSpectrum()

QualifiedMassSpectrum TimsFramesMsRunReader::qualifiedMassSpectrum ( std::size_t  spectrum_index,
bool  want_binary_data = true 
) const
overridevirtual

get a QualifiedMassSpectrum class given its scan number

Implements pappso::MsRunReader.

Definition at line 89 of file timsframesmsrunreader.cpp.

91{
92
93 QualifiedMassSpectrum mass_spectrum;
94
95 msp_timsData->getQualifiedMassSpectrumByRawIndex(
96 getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
97 return mass_spectrum;
98}
const MsRunIdCstSPtr & getMsRunId() const
Definition: msrunreader.cpp:56
Class representing a fully specified mass spectrum.

References pappso::MsRunReader::getMsRunId(), and msp_timsData.

◆ readSpectrumCollection()

void TimsFramesMsRunReader::readSpectrumCollection ( SpectrumCollectionHandlerInterface handler)
overridevirtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

Implements pappso::MsRunReader.

Definition at line 102 of file timsframesmsrunreader.cpp.

104{
105 // Here we want to only handle mass spectra as combined scans spectra, that
106 // is, for each frame, we want all the mobility scans to be cumulated (at the
107 // integer level, that is, without conversion of all the integers to m/z
108 // values) so as to yield a *single* mass spectrum per frame.
109
110 // We can iterate in the vector of frames records and for each frame ask that
111 // all its scans be combined into a single mass spectrum.
112
113 const std::vector<FrameIdDescr> &frame_id_descr_list =
114 msp_timsData->getFrameIdDescrList();
115
116 // The scan index is the index of the scan in the *whole* mass data file, it
117 // is a sequential number of scan over all the frames.
118 std::size_t scan_index = 0; // iterate in each spectrum
119
120 // We'll need it to perform the looping in the spectrum list.
121 std::size_t frames_count = msp_timsData->getTotalNumberOfFrames();
122
123 qDebug() << "The spectrum list has this much frames:" << frames_count;
124
125 // Inform the handler of the spectrum list so that it can handle feedback to
126 // the user.
127 handler.spectrumListHasSize(frames_count);
128
129 for(const FrameIdDescr &current_frame : frame_id_descr_list)
130 {
131 TimsFrameCstSPtr tims_frame =
132 msp_timsData->getTimsFrameCstSPtrCached(current_frame.m_frameId);
133
134 // Get to know the size of the frame, that is, the number of mobility
135 // scans in it.
136
137 quint32 scan_count = tims_frame->getTotalNumberOfScans();
138
139 Trace spectrum = tims_frame->cumulateScanToTrace(0, scan_count - 1);
140
141 QualifiedMassSpectrum mass_spectrum;
142
143 MassSpectrumId spectrum_id;
144
145 spectrum_id.setSpectrumIndex(scan_index);
146
147 spectrum_id.setMsRunId(getMsRunId());
148
149 // Can modify to help our case
150 spectrum_id.setNativeId(QString("frame id =%1 scan index=%2")
151 .arg(current_frame.m_frameId)
152 .arg(scan_index));
153
154 mass_spectrum.setMassSpectrumId(spectrum_id);
155
156 // We want to document the retention time!
157 mass_spectrum.setRtInSeconds(tims_frame.get()->getTime());
158
159 // We do want to document the ms level of the spectrum and possibly the
160 // precursor's m/z and charge.
161 unsigned int frame_ms_level = tims_frame.get()->getMsLevel();
162 mass_spectrum.setMsLevel(frame_ms_level);
163
164 if(frame_ms_level > 1)
165 {
166 // FIXME
167 // We want to document the precusor's m/z, z and index.
168 }
169
170 mass_spectrum.setDtInMilliSeconds(-1);
171
172 mass_spectrum.setEmptyMassSpectrum(false);
173
174 mass_spectrum.setMassSpectrumSPtr(
175 std::make_shared<MassSpectrum>(spectrum));
176
177 handler.setQualifiedMassSpectrum(mass_spectrum);
178
179 scan_index += scan_count;
180 }
181}
void setNativeId(const QString &native_id)
void setMsRunId(MsRunIdCstSPtr other)
void setSpectrumIndex(std::size_t index)
void setDtInMilliSeconds(pappso_double rt)
Set the drift time in milliseconds.
void setMassSpectrumId(const MassSpectrumId &iD)
Set the MassSpectrumId.
void setMsLevel(uint ms_level)
Set the mass spectrum level.
void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum)
Set the MassSpectrumSPtr.
void setRtInSeconds(pappso_double rt)
Set the retention time in seconds.
void setEmptyMassSpectrum(bool is_empty_mass_spectrum)
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0

References pappso::MsRunReader::getMsRunId(), msp_timsData, pappso::QualifiedMassSpectrum::setDtInMilliSeconds(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setMsRunId(), pappso::MassSpectrumId::setNativeId(), pappso::SpectrumCollectionHandlerInterface::setQualifiedMassSpectrum(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), and pappso::SpectrumCollectionHandlerInterface::spectrumListHasSize().

Referenced by readSpectrumCollection2().

◆ readSpectrumCollection2()

void TimsFramesMsRunReader::readSpectrumCollection2 ( const MsRunReadConfig config,
SpectrumCollectionHandlerInterface handler 
)
overridevirtual

Implements pappso::MsRunReader.

Definition at line 193 of file timsframesmsrunreader.cpp.

196{
197 qDebug() << "20230713 with" << config.getRetentionTimeStart() << "-" << config.getRetentionTimeEnd();
198
199 // We want to restrict the data reading process to the configuration provided
200 // as parameter.
201
202 // We have the TimsData that hold a list of FrameIdDescr that hold the
203 // retention time. We could use that list to search for the right retention
204 // times.
205
206 double rt_start = config.getRetentionTimeStart();
207 double rt_end = config.getRetentionTimeEnd();
208
209 // If retention time is not a critrion, load all frames.
210 if((rt_start < 0 && rt_end < 0) || (rt_end < rt_start))
211 return readSpectrumCollection(handler);
212
213 // Retention time is indeed a criterium to select mass spectra to be
214 // loaded.
215
216 const std::vector<TimsFrameRecord> &frame_record_list =
217 msp_timsData->getTimsFrameRecordList();
218
219 std::size_t frame_record_list_size = frame_record_list.size();
220
221 std::size_t list_start_index = 0;
222 std::size_t list_end_index = 0;
223
224 for(std::size_t iter = 0; iter < frame_record_list_size; ++iter)
225 {
226 const TimsFrameRecord &frame_record = frame_record_list.at(iter);
227
228 bool start_found = false;
229
230 if(frame_record.frame_time < rt_start)
231 {
232 // We have not reached the start of the RT range yet. Move
233 // the start index to the current index.
234 list_start_index = iter;
235 }
236 else
237 {
238 // We encounter one RT value that matches the start
239 // requirement. Is this the very first one such RT value ?
240 if(!start_found)
241 {
242 // This is indeed the very first time we encounter a RT
243 // value matching the start requirement. Store the
244 // indices and set the bool to true.
245 list_start_index = iter;
246 list_end_index = iter;
247
248 start_found = true;
249 }
250 else
251 {
252 // We did already encounter an RT value matching the start
253 // requirement. Do not change the start index, then.
254 // Now check the RT end requirement.
255 if(frame_record.frame_time <= rt_end)
256 {
257 // We still are fine with the RT end requirement.
258 // Update the end index.
259 list_end_index = iter;
260 }
261 else
262 {
263 // We are already outside of the searched RT range.
264 // Just break.
265 break;
266 }
267 }
268 }
269 }
270
271 // At this point, we have two indices into the frame_record_list. Note that
272 // the indices in the frame_record_list *are* the frame_id (see timsdata.cpp,
273 // around line 200).
274
275 std::size_t frames_count = list_end_index - list_start_index;
276 qDebug() << "The number of retained RT range-matching frames:"
277 << frames_count;
278 handler.spectrumListHasSize(frames_count);
279
280 // We need to get to the list of frame descriptors.
281 const std::vector<FrameIdDescr> &frame_id_descr_list =
282 msp_timsData->getFrameIdDescrList();
283
284 // The scan index is the index of the scan in the *whole* mass data file, it
285 // is a sequential number of scan over all the frames.
286 std::size_t scan_index = 0; // iterate in each spectrum
287
288 // In order to compute the spectrum index, we need to iterate in the
289 // frame_id_descr_list from the very first frame desriptor to the last before
290 // the one we will start to load in the next loop.
291 for(std::size_t iter = 0; iter < list_start_index; ++iter)
292 {
293 TimsFrameCstSPtr tims_frame = msp_timsData->getTimsFrameCstSPtrCached(
294 frame_id_descr_list.at(iter).m_frameId);
295
296 // Get to know the size of the frame, that is, the number of mobility
297 // scans in it.
298 quint32 scan_count = tims_frame->getTotalNumberOfScans();
299 scan_index += scan_count;
300 }
301
302 // We can now start iterating in the positions where we actually want to load
303 // frames. We will keep incrementing the scan_index.
304
305 for(std::size_t iter = list_start_index; iter < list_end_index; ++iter)
306 {
307 TimsFrameCstSPtr tims_frame =
308 msp_timsData->getTimsFrameCstSPtrCached(iter);
309
310 // Get to know the size of the frame, that is, the number of mobility
311 // scans in it.
312 quint32 scan_count = tims_frame->getTotalNumberOfScans();
313
314 Trace spectrum = tims_frame->cumulateScanToTrace(0, scan_count - 1);
315
316 QualifiedMassSpectrum mass_spectrum;
317
318 MassSpectrumId spectrum_id;
319 spectrum_id.setSpectrumIndex(scan_index);
320 spectrum_id.setMsRunId(getMsRunId());
321
322 // Can modify to help our case
323 spectrum_id.setNativeId(QString("frame id=%1 scan index=%2")
324 .arg(iter)
325 .arg(scan_index));
326
327 mass_spectrum.setMassSpectrumId(spectrum_id);
328
329 // We want to document the retention time!
330 mass_spectrum.setRtInSeconds(tims_frame.get()->getTime());
331
332 // We do want to document the ms level of the spectrum and possibly the
333 // precursor's m/z and charge.
334 unsigned int frame_ms_level = tims_frame.get()->getMsLevel();
335 mass_spectrum.setMsLevel(frame_ms_level);
336
337 if(frame_ms_level > 1)
338 {
339 // FIXME
340 // We want to document the precusor's m/z, z and index.
341 }
342
343 mass_spectrum.setDtInMilliSeconds(-1);
344
345 mass_spectrum.setEmptyMassSpectrum(false);
346
347 mass_spectrum.setMassSpectrumSPtr(
348 std::make_shared<MassSpectrum>(spectrum));
349
350 handler.setQualifiedMassSpectrum(mass_spectrum);
351
352 scan_index += scan_count;
353 }
354}
double getRetentionTimeEnd() const
double getRetentionTimeStart() const
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler

References pappso::TimsFrameRecord::frame_time, pappso::MsRunReader::getMsRunId(), pappso::MsRunReadConfig::getRetentionTimeEnd(), pappso::MsRunReadConfig::getRetentionTimeStart(), msp_timsData, readSpectrumCollection(), pappso::QualifiedMassSpectrum::setDtInMilliSeconds(), pappso::QualifiedMassSpectrum::setEmptyMassSpectrum(), pappso::QualifiedMassSpectrum::setMassSpectrumId(), pappso::QualifiedMassSpectrum::setMassSpectrumSPtr(), pappso::QualifiedMassSpectrum::setMsLevel(), pappso::MassSpectrumId::setMsRunId(), pappso::MassSpectrumId::setNativeId(), pappso::SpectrumCollectionHandlerInterface::setQualifiedMassSpectrum(), pappso::QualifiedMassSpectrum::setRtInSeconds(), pappso::MassSpectrumId::setSpectrumIndex(), and pappso::SpectrumCollectionHandlerInterface::spectrumListHasSize().

◆ readSpectrumCollectionByMsLevel()

void TimsFramesMsRunReader::readSpectrumCollectionByMsLevel ( SpectrumCollectionHandlerInterface handler,
unsigned int  ms_level 
)
overridevirtual

function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels

Implements pappso::MsRunReader.

Definition at line 185 of file timsframesmsrunreader.cpp.

188{
189 qDebug();
190}

◆ releaseDevice()

bool TimsFramesMsRunReader::releaseDevice ( )
overridevirtual

release data back end device if a the data back end is released, the developper has to use acquireDevice before using the msrunreader object

Returns
bool true if done

Implements pappso::MsRunReader.

Definition at line 371 of file timsframesmsrunreader.cpp.

372{
373 msp_timsData = nullptr;
374 return true;
375}

References msp_timsData.

◆ spectrumListSize()

std::size_t TimsFramesMsRunReader::spectrumListSize ( ) const
overridevirtual

get the totat number of spectrum conained in the MSrun data file

Implements pappso::MsRunReader.

Definition at line 357 of file timsframesmsrunreader.cpp.

358{
359 return msp_timsData->getTotalNumberOfScans();
360}

References msp_timsData.

Friends And Related Function Documentation

◆ MsFileAccessor

friend class MsFileAccessor
friend

Definition at line 45 of file timsframesmsrunreader.h.

Member Data Documentation

◆ msp_timsData


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