29#include "../../exception/exceptionnotimplemented.h"
37 qDebug() <<
"Now initializing the TimsFramesMsRunReader.";
54 QObject::tr(
"ERROR in TimsFramesMsRunReader::initialize "
55 "msp_timsData is null for MsRunId %1")
64 qDebug() << file_name;
71 [[maybe_unused]] std::size_t spectrum_index)
74 QObject::tr(
"Not yet implemented in TimsFramesMsRunReader %1.\n")
84 return msp_timsData->getMassSpectrumCstSPtrByRawIndex(spectrum_index);
90 bool want_binary_data)
const
96 getMsRunId(), mass_spectrum, spectrum_index, want_binary_data);
105 qDebug() <<
"Reading the spectrum collection with no specific configuration.";
115 qDebug().noquote() <<
"20231129 Reading the spectrum collection with this "
116 "specific configuration:"
124 std::vector<std::size_t> subset_of_tims_frame_ids;
131 for(
auto const &frame_record :
msp_timsData->getTimsFrameRecordList())
133 if(frame_record.frame_id == 0)
138 std::size_t ms_level = 2;
139 if(frame_record.msms_type == 0)
143 subset_of_tims_frame_ids.push_back(frame_record.frame_id);
149 std::size_t frames_count = subset_of_tims_frame_ids.size();
150 qDebug() <<
"The number of retained RT range-matching frames:"
158 bool asked_ion_mobility_range =
false;
159 quint32 mobility_scan_num_begin = 0;
160 quint32 mobility_scan_num_end = 0;
167 asked_ion_mobility_range =
true;
169 mobility_scan_num_begin =
174 mobility_scan_num_end =
182 std::size_t mz_index_merge_window = 0;
188 mz_index_merge_window =
196 bool asked_mz_range =
false;
197 double mz_range_begin = -1;
198 double mz_range_end = -1;
205 asked_mz_range =
true;
212 mz_range_end = config
217 qDebug() <<
"The m/z range asked is: " << mz_range_begin <<
"--"
226 const std::vector<FrameIdDescr> &frame_id_descr_list =
231 std::size_t scan_index = 0;
233 for(std::size_t tims_frame_id : subset_of_tims_frame_ids)
236 frame_id_descr_list[tims_frame_id];
252 asked_ion_mobility_range =
true;
254 mobility_scan_num_begin =
255 tims_frame_csp.get()->getScanNumFromOneOverK0(
262 mobility_scan_num_end = tims_frame_csp.get()->getScanNumFromOneOverK0(
272 quint32 mobility_scans_count = tims_frame_csp->getTotalNumberOfScans();
276 quint32 min_mz_index_out = 0;
277 quint32 max_mz_index_out = 0;
283 if(asked_ion_mobility_range)
285 if(mobility_scan_num_end > (mobility_scans_count - 1))
287 mobility_scan_num_end = mobility_scans_count - 1;
292 mobility_scan_num_begin = 0;
293 mobility_scan_num_end = mobility_scans_count - 1;
298 spectrum = tims_frame_csp->cumulateScansToTraceMzDownResolution2(
299 mz_index_merge_window,
302 mobility_scan_num_begin,
303 mobility_scan_num_end,
309 spectrum = tims_frame_csp->cumulateScansToTraceMzDownResolution(
310 mz_index_merge_window,
311 mobility_scan_num_begin,
312 mobility_scan_num_end,
332 QString(
"frame id=%1 scan index=%2 im_begin=%3 im_end=%4")
335 .arg(mobility_scan_num_begin)
336 .arg(mobility_scan_num_end));
345 unsigned int frame_ms_level = tims_frame_csp.get()->getMsLevel();
354 (qlonglong)tims_frame_csp->getTotalNumberOfScans());
357 tims_frame_csp->getOneOverK0Transformation(0));
360 tims_frame_csp->getOneOverK0Transformation(
361 tims_frame_csp->getTotalNumberOfScans() - 1));
379 std::make_shared<MassSpectrum>(spectrum));
394 [[maybe_unused]]
unsigned int ms_level)
434 std::size_t spectrum_index [[maybe_unused]],
495 Trace tic_chromatogram;
497 const std::vector<FrameIdDescr> frame_descr_list =
503 msp_timsData->getTimsFrameCstSPtrCached(frame_id_descr.m_frameId);
504 std::size_t scan_begin = 0;
505 std::size_t scan_end = tims_frame_csp->getTotalNumberOfScans() - 1;
509 if(tims_frame_csp->getMsLevel() == 1)
513 double rt = tims_frame_csp->getTime();
517 tims_frame_csp->cumulateScansIntensities(scan_begin, scan_end)));
523 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 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