29#include "../../exception/exceptionnotimplemented.h"
30#include "../../exception/exceptioninterrupted.h"
38 qDebug() <<
"Now initializing the TimsFramesMsRunReader.";
55 QObject::tr(
"ERROR in TimsFramesMsRunReader::initialize "
56 "msp_timsData is null for MsRunId %1")
65 qDebug() << file_name;
72 [[maybe_unused]] std::size_t spectrum_index)
75 QObject::tr(
"Not yet implemented in TimsFramesMsRunReader %1.\n")
85 return msp_timsData->getMassSpectrumCstSPtrByRawIndex(spectrum_index);
91 bool want_binary_data)
const
97 getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
106 qDebug() <<
"Reading the spectrum collection with no specific configuration.";
116 qDebug().noquote() <<
"Reading the spectrum collection with this "
117 "specific configuration:"
125 std::vector<std::size_t> subset_of_tims_frame_ids;
132 for(
auto const &frame_record :
msp_timsData->getTimsFrameRecordList())
134 if(frame_record.frame_id == 0)
139 std::size_t ms_level = 2;
140 if(frame_record.msms_type == 0)
144 subset_of_tims_frame_ids.push_back(frame_record.frame_id);
150 std::size_t frames_count = subset_of_tims_frame_ids.size();
151 qDebug() <<
"The number of retained RT range-matching frames:"
159 bool asked_ion_mobility_range =
false;
160 quint32 mobility_scan_num_begin = 0;
161 quint32 mobility_scan_num_end = 0;
168 asked_ion_mobility_range =
true;
170 mobility_scan_num_begin =
175 mobility_scan_num_end =
183 std::size_t mz_index_merge_window = 0;
189 mz_index_merge_window =
197 bool asked_mz_range =
false;
198 double mz_range_begin = -1;
199 double mz_range_end = -1;
206 asked_mz_range =
true;
213 mz_range_end = config
218 qDebug() <<
"The m/z range asked is: " << mz_range_begin <<
"--"
227 const std::vector<FrameIdDescr> &frame_id_descr_list =
232 std::size_t scan_index = 0;
234 for(std::size_t tims_frame_id : subset_of_tims_frame_ids)
239 qDebug() <<
"The operation was cancelled. Breaking the loop.";
241 QObject::tr(
"reading TimsTOF job cancelled by the user"));
245 frame_id_descr_list[tims_frame_id];
261 asked_ion_mobility_range =
true;
263 mobility_scan_num_begin =
264 tims_frame_csp.get()->getScanNumFromOneOverK0(
271 mobility_scan_num_end = tims_frame_csp.get()->getScanNumFromOneOverK0(
281 quint32 mobility_scans_count = tims_frame_csp->getTotalNumberOfScans();
285 quint32 min_mz_index_out = 0;
286 quint32 max_mz_index_out = 0;
292 if(asked_ion_mobility_range)
294 if(mobility_scan_num_end > (mobility_scans_count - 1))
296 mobility_scan_num_end = mobility_scans_count - 1;
301 mobility_scan_num_begin = 0;
302 mobility_scan_num_end = mobility_scans_count - 1;
307 spectrum = tims_frame_csp->cumulateScansToTraceMzDownResolution2(
308 mz_index_merge_window,
311 mobility_scan_num_begin,
312 mobility_scan_num_end,
318 spectrum = tims_frame_csp->cumulateScansToTraceMzDownResolution(
319 mz_index_merge_window,
320 mobility_scan_num_begin,
321 mobility_scan_num_end,
341 QString(
"frame id=%1 scan index=%2 im_begin=%3 im_end=%4")
344 .arg(mobility_scan_num_begin)
345 .arg(mobility_scan_num_end));
354 unsigned int frame_ms_level = tims_frame_csp.get()->getMsLevel();
363 static_cast<qlonglong
>(tims_frame_csp->getTotalNumberOfScans()));
366 tims_frame_csp->getOneOverK0Transformation(0));
369 tims_frame_csp->getOneOverK0Transformation(
370 tims_frame_csp->getTotalNumberOfScans() - 1));
388 std::make_shared<MassSpectrum>(spectrum));
403 [[maybe_unused]]
unsigned int ms_level)
443 std::size_t spectrum_index [[maybe_unused]],
504 Trace tic_chromatogram;
506 const std::vector<FrameIdDescr> frame_descr_list =
512 msp_timsData->getTimsFrameCstSPtrCached(frame_id_descr.m_frameId);
513 std::size_t scan_begin = 0;
514 std::size_t scan_end = tims_frame_csp->getTotalNumberOfScans() - 1;
518 if(tims_frame_csp->getMsLevel() == 1)
522 double rt = tims_frame_csp->getTime();
526 tims_frame_csp->cumulateScansIntensities(scan_begin, scan_end)));
532 return tic_chromatogram;
void setNativeId(const QString &native_id)
void setMsRunId(MsRunIdCstSPtr other)
void setSpectrumIndex(std::size_t index)
bool needPeakList() const
const QVariant getParameterValue(MsRunReadConfigParameter parameter) const
bool acceptMsLevel(std::size_t ms_level) const
bool acceptRetentionTimeInSeconds(double retention_time_in_seconds) const
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
MsRunIdCstSPtr mcsp_msRunId
const MsRunIdCstSPtr & getMsRunId() const
Class representing a fully specified mass spectrum.
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 setParameterValue(QualifiedMassSpectrumParameter parameter, const QVariant &value)
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)
interface to collect spectrums from the MsRunReader class
virtual bool shouldStop()
virtual void spectrumListHasSize(std::size_t size)
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
virtual Trace getTicChromatogram() override
get a TIC chromatogram
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
virtual void initialize() override
virtual void readSpectrumCollection2(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
virtual Trace computeTicChromatogram()
virtual TimsDataSp getTimsDataSPtr()
give an access to the underlying raw data pointer
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
virtual bool acquireDevice() override
acquire data back end device
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,...
virtual ~TimsFramesMsRunReader()
TimsFramesMsRunReader(MsRunIdCstSPtr &msrun_id_csp)
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
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
A simple container of DataPoint instances.
size_t append(const DataPoint &data_point)
appends a datapoint and return new size
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
std::shared_ptr< TimsData > TimsDataSp
shared pointer on a TimsData object
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
@ TimsFrameInvKoBegin
Bruker's Tims tof 1/K0 frame start range.
@ TimsFrameMzIndexBegin
Bruker's Tims tof mz index frame start range.
@ TimsFrameMzIndexEnd
Bruker's Tims tof mz index frame end range.
@ TimsFrameInvKoEnd
Bruker's Tims tof 1/K0 frame end range.
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
@ TimsFramesMsRunReader_mobility_index_end
@ TimsFramesMsRunReader_mz_end
@ TimsFramesMsRunReader_mz_index_merge_window
@ TimsFramesMsRunReader_mobility_index_begin
@ TimsFramesMsRunReader_mz_begin
@ TimsFramesMsRunReader_mobility_one_over_k0_begin
@ TimsFramesMsRunReader_mobility_one_over_k0_end
std::shared_ptr< XicCoord > XicCoordSPtr