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() <<
"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
223 const std::vector<FrameIdDescr> &frame_id_descr_list =
228 std::size_t scan_index = 0;
230 for(std::size_t tims_frame_id : subset_of_tims_frame_ids)
233 frame_id_descr_list[tims_frame_id];
249 asked_ion_mobility_range =
true;
251 mobility_scan_num_begin =
252 tims_frame_csp.get()->getScanNumFromOneOverK0(
259 mobility_scan_num_end = tims_frame_csp.get()->getScanNumFromOneOverK0(
269 quint32 mobility_scans_count = tims_frame_csp->getTotalNumberOfScans();
273 quint32 min_mz_index_out = 0;
274 quint32 max_mz_index_out = 0;
280 if(asked_ion_mobility_range)
282 if(mobility_scan_num_end > (mobility_scans_count - 1))
283 mobility_scan_num_end = mobility_scans_count - 1;
286 spectrum = tims_frame_csp->cumulateScanToTraceMzDownResolution2(
287 mz_index_merge_window,
290 mobility_scan_num_begin,
291 mobility_scan_num_end,
295 spectrum = tims_frame_csp->cumulateScanToTraceMzDownResolution(
296 mz_index_merge_window,
297 mobility_scan_num_begin,
298 mobility_scan_num_end,
304 mobility_scan_num_end = mobility_scans_count - 1;
306 spectrum = tims_frame_csp->cumulateScanToTraceMzDownResolution(
307 mz_index_merge_window,
309 mobility_scan_num_end,
329 QString(
"frame id=%1 scan index=%2 im_begin=%3 im_end=%4")
332 .arg(mobility_scan_num_begin)
333 .arg(mobility_scan_num_end));
342 unsigned int frame_ms_level = tims_frame_csp.get()->getMsLevel();
351 (qlonglong)tims_frame_csp->getTotalNumberOfScans());
354 tims_frame_csp->getOneOverK0Transformation(0));
357 tims_frame_csp->getOneOverK0Transformation(
358 tims_frame_csp->getTotalNumberOfScans() - 1));
376 std::make_shared<MassSpectrum>(spectrum));
391 [[maybe_unused]]
unsigned int ms_level)
431 std::size_t spectrum_index [[maybe_unused]],
492 Trace tic_chromatogram;
494 const std::vector<FrameIdDescr> frame_descr_list =
500 msp_timsData->getTimsFrameCstSPtrCached(frame_id_descr.m_frameId);
501 std::size_t scan_begin = 0;
502 std::size_t scan_end = tims_frame_csp->getTotalNumberOfScans() - 1;
506 if(tims_frame_csp->getMsLevel() == 1)
510 double rt = tims_frame_csp->getTime();
514 tims_frame_csp->cumulateScansIntensities(scan_begin, scan_end)));
520 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