libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsmsrunreader.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/private/timsmsrunreader.h
3 * \date 05/09/2019
4 * \author Olivier Langella
5 * \brief MSrun file reader for native Bruker TimsTOF raw data
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
33#include <QDebug>
34
35using namespace pappso;
36
42 : TimsMsRunReaderBase(msrun_reader_base)
43{
44 initialize();
45}
46
47
51
52
54TimsMsRunReader::massSpectrumSPtr([[maybe_unused]] std::size_t spectrum_index)
55{
57 QObject::tr("Not yet implemented in TimsMsRunReader %1.\n").arg(__LINE__));
59}
60
61
63TimsMsRunReader::massSpectrumCstSPtr(std::size_t spectrum_index)
64{
65 return msp_timsData->getMassSpectrumCstSPtrByGlobalScanIndex(spectrum_index);
66}
67
68
70TimsMsRunReader::qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data) const
71{
72
73 QualifiedMassSpectrum mass_spectrum;
74
75 msp_timsData->getQualifiedMassSpectrumByGlobalScanIndex(
76 getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
77 return mass_spectrum;
78}
79
80
81void
86
87void
90{
91
92 qDebug().noquote() << "Reading the spectrum collection with this "
93 "specific configuration:"
94 << config.toString();
95
96 std::vector<std::size_t> subset_of_tims_frame_ids;
97
98 bool asked_ion_mobility_scan_num_range = false;
99
100 quint32 mobility_scan_num_range_begin = std::numeric_limits<quint32>::quiet_NaN();
101 quint32 mobility_scan_num_range_end = std::numeric_limits<quint32>::quiet_NaN();
102 quint32 mobility_scan_num_range_width = std::numeric_limits<quint32>::quiet_NaN();
103
104 double mobility_one_over_k0_range_begin = std::numeric_limits<double>::quiet_NaN();
105 double mobility_one_over_k0_range_end = std::numeric_limits<double>::quiet_NaN();
106
109 {
110 mobility_scan_num_range_begin =
112 mobility_scan_num_range_end =
114
115 // We need the range width below.
116 mobility_scan_num_range_width =
117 mobility_scan_num_range_end + 1 - mobility_scan_num_range_begin;
118
119 asked_ion_mobility_scan_num_range = true;
120
121 // Be sure to check in the frames loop below that the user might
122 // have asked for an ion mobility range but on the basis of the 1/K0 unit.
123 }
124
125 const std::vector<FrameIdDescr> &frame_id_descr_list = msp_timsData->getFrameIdDescrList();
126
127 // Just for the feedback to the user.
128 std::size_t scan_count = 0;
129
130 for(auto const &frame_record : msp_timsData->getTimsFrameRecordList())
131 {
132 if(handler.shouldStop())
133 {
134 // qDebug() << "The operation was cancelled. Breaking the loop.";
135 throw ExceptionInterrupted(QObject::tr("Reading timsTOF data cancelled by the user."));
136 }
137
138 if(frame_record.frame_id == 0)
139 continue;
140
141 if(!config.acceptRetentionTimeInSeconds(frame_record.frame_time))
142 continue;
143
144 std::size_t ms_level = 2;
145 if(frame_record.msms_type == 0)
146 ms_level = 1;
147
148 if(!config.acceptMsLevel(ms_level))
149 continue;
150
151 subset_of_tims_frame_ids.push_back(frame_record.frame_id);
152
153 if(mobility_scan_num_range_width)
154 {
155 scan_count += mobility_scan_num_range_width;
156 }
157 else
158 {
159 scan_count += frame_id_descr_list[frame_record.frame_id].m_scanCount;
160 }
161 }
162
163 // At this point, we have a subset of frame records.
164 std::size_t frame_count = subset_of_tims_frame_ids.size();
165 qDebug() << "The number of retained RT range- and MS level-matching frames : " << frame_count;
166 // Inform the handler of the spectrum list so that it can handle feedback to
167 // the user.
168 handler.spectrumListHasSize(scan_count);
169
170 // Check for m/z range selection
171 double mz_range_begin = -1;
172 double mz_range_end = -1;
173
176 {
177 mz_range_begin = config.getParameterValue(MsRunReadConfigParameter::MzRangeBegin).toDouble();
178
179 mz_range_end = config.getParameterValue(MsRunReadConfigParameter::MzRangeEnd).toDouble();
180
181 // qDebug() << "The m/z range asked is: " << mz_range_begin
182 // << "--" << mz_range_end;
183 }
184
185 // Check for m/z resolution downgrading (mz bins merge)
186 // The idea is that we merge a number of mz indices into a single index,
187 // which is essentially an increase of the m/z bin size, and therefore
188 // a reduction of the resolution/definition of the mass spectrum.
189 std::size_t mz_index_merge_window = 0;
191 {
192 mz_index_merge_window =
194
195 // qDebug() << "mz_index_merge_window=" << mz_index_merge_window;
196 }
197
198 std::size_t number_of_mobility_scans_set_as_qualified_mass_spectra = 0;
199
200 for(std::size_t tims_frame_id : subset_of_tims_frame_ids)
201 {
202 qDebug() << "tims_frame_id=" << tims_frame_id;
203
204 if(handler.shouldStop())
205 {
206 // qDebug() << "The operation was cancelled. Breaking the loop.";
207 throw ExceptionInterrupted(QObject::tr("Reading timsTOF data cancelled by the user."));
208 }
209
210 const FrameIdDescr &current_frame_record = frame_id_descr_list[tims_frame_id];
211
212 TimsFrameCstSPtr tims_frame_csp = msp_timsData->getTimsFrameCstSPtrCached(tims_frame_id);
213
214 qDebug() << "tims_frame_id=" << tims_frame_id;
215
216 // If the user wants to select 1/Ko values in a given range, we need to
217 // compute the ion mobility scan value starting from that 1/Ko value in
218 // *each* frame. Note that the computed mobility_scan_num_begin and
219 // mobility_scan_num_end would override thoses possibly set with
220 // TimsFramesMsRunReader_mobility_index_begin/end above.
221
223 .isNull() &&
225 {
226 mobility_one_over_k0_range_begin =
228 .toDouble();
229
230 mobility_one_over_k0_range_end =
232 .toDouble();
233
234 mobility_scan_num_range_begin =
235 tims_frame_csp.get()->getScanIndexFromOneOverK0(mobility_one_over_k0_range_begin);
236
237 mobility_scan_num_range_end =
238 tims_frame_csp.get()->getScanIndexFromOneOverK0(mobility_one_over_k0_range_end);
239
240 asked_ion_mobility_scan_num_range = true;
241 }
242
243 // qDebug() << "tims_frame_id=" << tims_frame_id;
244
245 // Now that we know if the user has asked for an ion mobility range,
246 // either using scan indices or 1/K0 values, we need to double check the
247 // range borders.
248
249 quint32 frame_scan_count = tims_frame_csp->getTotalNumberOfScans();
250
251 if(asked_ion_mobility_scan_num_range)
252 {
253 if(mobility_scan_num_range_end > (frame_scan_count - 1))
254 {
255 mobility_scan_num_range_end = frame_scan_count - 1;
256 }
257 }
258 else
259 {
260 mobility_scan_num_range_begin = 0;
261 mobility_scan_num_range_end = frame_scan_count - 1;
262 }
263
264 // Now, with or without the peak list, we have to craft a qualified mass
265 // spectrum that will hold all the metadata about the data potentially
266 // found in it.
267 QualifiedMassSpectrum mass_spectrum;
268
269 MassSpectrumId spectrum_id;
270
271 // FIXME: is this correct ? The spectrum index should be set later
272 // when creating mass spectra that correspond to scans inside frames, no ?
273 spectrum_id.setSpectrumIndex(tims_frame_id);
274 spectrum_id.setMsRunId(getMsRunId());
275
276 // FIXME: this is never true.
277 if(!tims_frame_id)
278 qDebug() << "20240724 - Now setting a spectrum index of 0";
279
280 mass_spectrum.setMassSpectrumId(spectrum_id);
281
282 // qDebug() << "tims_frame_id=" << tims_frame_id;
283
284 // We want to document the retention time!
285 mass_spectrum.setRtInSeconds(tims_frame_csp.get()->getRtInSeconds());
286
287 // We do want to document the ms level of the spectrum and possibly
288 // the precursor's m/z and charge values.
289 unsigned int frame_ms_level = tims_frame_csp.get()->getMsLevel();
290 mass_spectrum.setMsLevel(frame_ms_level);
291
292 std::vector<TimsDdaPrecursors::SpectrumDescr> dda_frame_precursor_spectrum_descr_list;
293
294 TimsDiaSlices::MsMsWindowGroup *p_dia_window_group = nullptr;
295 std::size_t frame_global_slice_begin = 0;
296
297 if(frame_ms_level > 1)
298 {
299 qDebug() << "Frame MS level:" << frame_ms_level;
300
301 if(msp_timsData.get()->isDdaRun())
302 {
303 TimsDdaPrecursors *dda_precursors_p = msp_timsData.get()->getTimsDdaPrecursorsPtr();
304
305 dda_frame_precursor_spectrum_descr_list =
306 dda_precursors_p->getSpectrumDescrListByFrameId(tims_frame_id);
307
308 qDebug() << "Got frame's" << dda_frame_precursor_spectrum_descr_list.size()
309 << "precursors for MS level" << frame_ms_level;
310
311 QString frame_precursors;
312
313 for(auto desc : dda_frame_precursor_spectrum_descr_list)
314 {
315 frame_precursors += QString("(%1, %2, %3\n)")
316 .arg(desc.isolationMz)
317 .arg(desc.isolationWidth)
318 .arg(desc.ms1_index);
319 }
320
321 qDebug() << "20240724 - The count of precursors:"
322 << dda_frame_precursor_spectrum_descr_list.size() << "\n"
323 << frame_precursors;
324 }
325
326 if(msp_timsData.get()->isDiaRun())
327 {
328 p_dia_window_group =
329 msp_timsData.get()->getTimsDiaSlicesPtr()->getMapFrame2WindowGroupPtr().at(
330 tims_frame_id);
331 frame_global_slice_begin =
332 msp_timsData.get()->getTimsDiaSlicesPtr()->getGlobalSliceIndexBeginByFrameId(
333 tims_frame_id);
334 }
335 }
336
337 // qDebug() << "tims_frame_id=" << tims_frame_id;
338
339 // The scan index is the index of the scan in the *whole* mass data file,
340 // it is a sequential number of scans over all the frames.
341
342 // FIXME: if we remove m_scanCount and then add
343 // mobility_scan_num_range_begin, does that mean that the
344 // m_globalScanIndex of the frame is the index of the last mobility scan
345 // of that frame ?
346
347 // FIXME: is this the reason we never have a scan_index = 0 ?
348 std::size_t scan_index = current_frame_record.m_globalScanIndex -
349 current_frame_record.m_scanCount + mobility_scan_num_range_begin;
350
351 // FIXME: is this needed ?
352 // QualifiedMassSpectrum mass_spectrum_no_precursor_data(mass_spectrum);
353
354 // Iterate in the frame's scans, only in the asked range. In each frame, these scan numbers
355 // start from 0 and end at frame_scan_count - 1, that is, these are not global scan numbers.
356 for(quint32 iter_scan_index = mobility_scan_num_range_begin;
357 iter_scan_index <= mobility_scan_num_range_end;
358 ++iter_scan_index, ++scan_index)
359 {
360 // FIXME: I do not understand the logic here: we are copying mass
361 // spectra around? mass_spectrum = mass_spectrum_no_precursor_data;
362 QualifiedMassSpectrum qualified_mass_spectrum(mass_spectrum);
363 qualified_mass_spectrum.getMassSpectrumId().setSpectrumIndex(scan_index);
364
365 qualified_mass_spectrum.getMassSpectrumId().setNativeId(
366 QString("frame_id=%1 scan_index=%2 global_scan_index=%3")
367 .arg(tims_frame_id)
368 .arg(iter_scan_index)
369 .arg(scan_index));
370
371 // qDebug() << "iter_scan_index:" << iter_scan_index;
372
373 // Arrival time
374 qualified_mass_spectrum.setDtInMilliSeconds(
375 tims_frame_csp.get()->getDriftTimeInMilliseconds(iter_scan_index));
376
377 // 1/K0
378 qualified_mass_spectrum.setParameterValue(
380 tims_frame_csp.get()->getOneOverK0Transformation(iter_scan_index));
381
382#if 0
383 // Debugging code to check that it is true that there is
384 // systematically a single precursor per mobility scan.
385 // See FIXME below in the code.
386
387 std::size_t per_scan_index_count_of_matching_precursors = 0;
388
389 for(TimsDdaPrecursors::SpectrumDescr prec_spec_desc :
390 dda_precursor_spectrum_descr_list)
391 {
392 std::size_t scan_index = (std::size_t)iter_scan_index;
393
394 if(scan_index >= precursor_spectrum_descr_iterator->scan_mobility_start &&
395 scan_index <= precursor_spectrum_descr_iterator->scan_mobility_end)
396 {
397 ++per_scan_index_count_of_matching_precursors;
398
399 qDebug() << "20240724 - Found a precursor desc for scan_index"
400 << scan_index
401 << "that matched the mobility scan range:"
402 << precursor_spectrum_descr_iterator->isolationMz << ","
403 << precursor_spectrum_descr_iterator->isolationWidth;
404
405 qualified_mass_spectrum.appendPrecursorIonData(
406 precursor_spectrum_descr_iterator->precursor_ion_data);
407
408 qualified_mass_spectrum.setPrecursorNativeId(
409 QString(
410 "frame_id=%1 begin=%2 end=%3 precursor=%4 idxms1=%5")
411 .arg(precursor_spectrum_descr_iterator->parent_frame)
412 .arg(precursor_spectrum_descr_iterator->scan_mobility_start)
413 .arg(precursor_spectrum_descr_iterator->scan_mobility_end)
414 .arg(precursor_spectrum_descr_iterator->precursor_id)
415 .arg(precursor_spectrum_descr_iterator->ms1_index));
416
417 qualified_mass_spectrum.setParameterValue(
419 precursor_spectrum_descr_iterator->isolationMz);
420 qualified_mass_spectrum.setParameterValue(
422 precursor_spectrum_descr_iterator->isolationWidth);
423
424 qualified_mass_spectrum.setParameterValue(
426 precursor_spectrum_descr_iterator->collisionEnergy);
427 qualified_mass_spectrum.setParameterValue(
429 (quint64)precursor_spectrum_descr_iterator->precursor_id);
430 }
431 }
432
433
434 qDebug() << "20240724 - For scan_index" << scan_index << "found"
435 << per_scan_index_count_of_matching_precursors
436 << "matching precursors";
437
438 if(per_scan_index_count_of_matching_precursors > 1)
439 qFatal();
440#endif
441
442 // FIXME: this code seems to assume that there should be only one
443 // precursor in the currently iterated scan index. Is this necessarily
444 // true ?
445
446 if(dda_frame_precursor_spectrum_descr_list.size() > 0)
447 {
448 std::size_t local_iter_scan_index = (std::size_t)iter_scan_index;
449
450 auto precursor_spectrum_descr_iterator = std::find_if(
451 dda_frame_precursor_spectrum_descr_list.begin(),
452 dda_frame_precursor_spectrum_descr_list.end(),
453 [local_iter_scan_index](const TimsDdaPrecursors::SpectrumDescr &spectrum_descr) {
454 if(local_iter_scan_index < spectrum_descr.scan_mobility_start)
455 return false;
456 if(local_iter_scan_index > spectrum_descr.scan_mobility_end)
457 return false;
458 return true;
459 });
460
461 if(precursor_spectrum_descr_iterator != dda_frame_precursor_spectrum_descr_list.end())
462 {
463 qDebug() << "local_iter_scan_index=" << local_iter_scan_index
464 << " spectrum_descr.scan_mobility_end="
465 << precursor_spectrum_descr_iterator->scan_mobility_end;
466
467 qualified_mass_spectrum.appendPrecursorIonData(
468 precursor_spectrum_descr_iterator->precursor_ion_data);
469
470 qualified_mass_spectrum.setPrecursorNativeId(
471 QString("frame_id=%1 begin=%2 end=%3 precursor=%4 idxms1=%5")
472 .arg(precursor_spectrum_descr_iterator->parent_frame)
473 .arg(precursor_spectrum_descr_iterator->scan_mobility_start)
474 .arg(precursor_spectrum_descr_iterator->scan_mobility_end)
475 .arg(precursor_spectrum_descr_iterator->precursor_id)
476 .arg(precursor_spectrum_descr_iterator->ms1_index));
477
478 qDebug() << "Native precursor ID:"
479 << qualified_mass_spectrum.getPrecursorNativeId();
480
481 // FIXME:
482 // The code below makes the program crash at
483 // src/pappsomspp/msrun/msrundatasettree.cpp @ 110
484 // "ERROR could not find a tree node matching the index"
485 // because ms1_index is not found in any spectrum of the tree.
486
487 // qualified_mass_spectrum.setPrecursorSpectrumIndex(
488 // precursor_spectrum_descr_iterator->ms1_index);
489 qDebug();
490
491 qualified_mass_spectrum.setParameterValue(
493 precursor_spectrum_descr_iterator->isolationMz);
494 qualified_mass_spectrum.setParameterValue(
496 precursor_spectrum_descr_iterator->isolationWidth);
497
498 qualified_mass_spectrum.setParameterValue(
500 precursor_spectrum_descr_iterator->collisionEnergy);
501
502 qualified_mass_spectrum.setParameterValue(
504 (quint64)precursor_spectrum_descr_iterator->precursor_id);
505 }
506 qDebug();
507 }
508
509 qDebug();
510
511 if(p_dia_window_group != nullptr)
512 {
513 std::size_t scan_index = (std::size_t)iter_scan_index;
514 auto it_dia_window =
515 std::find_if(p_dia_window_group->begin(),
516 p_dia_window_group->end(),
517 [scan_index](const TimsDiaSlices::MsMsWindow &dia_window) {
518 if(scan_index < dia_window.ScanNumBegin)
519 return false;
520 if(scan_index > dia_window.ScanNumEnd)
521 return false;
522 return true;
523 });
524
525 if(it_dia_window != p_dia_window_group->end())
526 {
527 qDebug() << "scan_index=" << scan_index
528 << " it_dia_window->ScanNumEnd=" << it_dia_window->ScanNumEnd;
529
530 qualified_mass_spectrum.setPrecursorNativeId(
531 QString("window_group=%1 begin=%2 end=%3 frame=%4 scan=%5 "
532 "global_slice_id=%6")
533 .arg(it_dia_window->WindowGroup)
534 .arg(it_dia_window->ScanNumBegin)
535 .arg(it_dia_window->ScanNumEnd)
536 .arg(msp_timsData.get()->getTimsDiaSlicesPtr()->getLastMs1FrameIdByMs2FrameId(
537 tims_frame_id))
538 .arg(iter_scan_index)
539 .arg(it_dia_window->SliceIndex + frame_global_slice_begin));
540
541 qualified_mass_spectrum.setParameterValue(
542 QualifiedMassSpectrumParameter::IsolationMz, it_dia_window->IsolationMz);
543 qualified_mass_spectrum.setParameterValue(
545 it_dia_window->IsolationWidth);
546
547 qualified_mass_spectrum.setParameterValue(
549 it_dia_window->CollisionEnergy);
550 }
551 }
552
553 qDebug();
554
555 if(config.needPeakList())
556 {
557 quint32 mz_minimum_index_out = 0;
558 quint32 mz_maximum_index_out = 0;
559
560 auto raw_trace = tims_frame_csp.get()->getMobilityScan(iter_scan_index,
561 mz_index_merge_window,
562 mz_range_begin,
563 mz_range_end,
564 mz_minimum_index_out,
565 mz_maximum_index_out);
566
567 qDebug() << "Ion mobility scan's raw trace size:" << raw_trace.size();
568
569 qualified_mass_spectrum.setEmptyMassSpectrum(false);
570
571 qualified_mass_spectrum.setParameterValue(
573 qualified_mass_spectrum.setParameterValue(
575
576
577 qDebug();
578 qualified_mass_spectrum.setMassSpectrumSPtr(
579 std::make_shared<MassSpectrum>(raw_trace));
580
581 qDebug() << "RT (s):" << qualified_mass_spectrum.getRtInSeconds();
582 }
583 else
584 {
585 qualified_mass_spectrum.setEmptyMassSpectrum(true);
586 }
587
588 qDebug();
589 handler.setQualifiedMassSpectrum(qualified_mass_spectrum);
590 qDebug();
591 ++number_of_mobility_scans_set_as_qualified_mass_spectra;
592 }
593
594 qDebug();
595 }
596
597 qDebug() << "Total number of loaded mass spectra:"
598 << number_of_mobility_scans_set_as_qualified_mass_spectra;
599}
600
601void
603 unsigned int ms_level)
604{
605
606 qDebug();
607
608 try
609 {
610
611 if(msp_timsData->isDdaRun())
612 {
613 msp_timsData.get()->getTimsDdaPrecursorsPtr()->rawReaderSpectrumCollectionByMsLevel(
614 getMsRunId(), handler, ms_level);
615 }
616 }
617
618 catch(ExceptionInterrupted &)
619 {
620 qDebug() << "Reading of MS data interrupted by the user.";
621 }
622
623 // Now let the loading handler know that the loading of the data has ended.
624 // The handler might need this "signal" to perform additional tasks or to
625 // cleanup cruft.
626
627 // qDebug() << "Loading ended";
628 handler.loadingEnded();
629}
630
631
632std::size_t
634{
635 return msp_timsData->getTotalScanCount();
636}
637
638std::size_t
640 [[maybe_unused]])
641{
643 QObject::tr("%1 %2 %3 not implemented").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
644}
void setNativeId(const QString &native_id)
void setMsRunId(MsRunIdCstSPtr other)
void setSpectrumIndex(std::size_t index)
const QVariant getParameterValue(MsRunReadConfigParameter parameter) const
bool acceptMsLevel(std::size_t ms_level) const
bool acceptRetentionTimeInSeconds(double retention_time_in_seconds) const
const MsRunIdCstSPtr & getMsRunId() const
Class representing a fully specified mass spectrum.
void setPrecursorNativeId(const QString &native_id)
Set the scan native id of the precursor ion.
void setDtInMilliSeconds(pappso_double rt)
Set the drift time in milliseconds.
const QString & getPrecursorNativeId() const
void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data)
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
void setMassSpectrumId(const MassSpectrumId &iD)
Set the MassSpectrumId.
void setMsLevel(uint ms_level)
Set the mass spectrum level.
void setParameterValue(QualifiedMassSpectrumParameter parameter, const QVariant &value)
void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum)
Set the MassSpectrumSPtr.
void setRtInSeconds(pappso_double rt)
Set the retention time in seconds.
pappso_double getRtInSeconds() const
Get the retention time in seconds.
void setEmptyMassSpectrum(bool is_empty_mass_spectrum)
interface to collect spectrums from the MsRunReader class
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0
std::vector< TimsDdaPrecursors::SpectrumDescr > getSpectrumDescrListByFrameId(std::size_t frame_id) const
get a list of TimsDdaPrecursors::SpectrumDescr for a frame
virtual std::size_t getTotalNumberOfScans() const
get the number of scans contained in this frame each scan represents an ion mobility slice
double getDriftTimeInMilliseconds(std::size_t scan_index) const
get drift time of a scan number in milliseconds
std::size_t getScanIndexFromOneOverK0(double one_over_k0) const
get the scan number from a given 1/Ko mobility value
double getRtInSeconds() const
unsigned int getMsLevel() const
double getOneOverK0Transformation(std::size_t scan_index) const
get 1/K0 value of a given scan (mobility value)
virtual Trace getMobilityScan(std::size_t scanNum, std::size_t mz_index_merge_window, double mz_range_begin, double mz_range_end, quint32 &mz_minimum_index_out, quint32 &mz_maximum_index_out) const override
get a single mobility scan m/z + intensities
TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
virtual void initialize() override
TimsMsRunReader(MsRunIdCstSPtr &msrun_id_csp)
virtual std::size_t spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override
if possible, get the spectrum index given a string identifier throw a not found exception if spectrum...
virtual void readSpectrumCollection2(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
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
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
@ IsolationMzWidth
m/z isolation window width (left + right)
@ TimsFrameMzIndexBegin
Bruker's timsTOF mz index frame start range.
@ CollisionEnergy
Bruker's timsTOF collision energy.
@ TimsFrameMzIndexEnd
Bruker's timsTOF mz index frame end range.
@ BrukerPrecursorIndex
Bruker's timsTOF precursor index.
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
Definition timsframe.h:44
std::size_t m_globalScanIndex
Definition timsdata.h:61
std::size_t m_scanCount
Definition timsdata.h:60