65 double digitizerTimebase,
66 double digitizerDelay,
108 QObject::tr(
"Invalid scan number : scanNum %1 > m_scanNumber %2")
121 "ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
136 "ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
150 std::size_t scanNumEnd)
const
153 QObject::tr(
"ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
154 "number begin %1 end %2")
161 std::size_t mzindex_merge_window [[maybe_unused]],
162 std::size_t scanNumBegin [[maybe_unused]],
163 std::size_t scanNumEnd [[maybe_unused]],
164 quint32 &minimum_tof_index_out [[maybe_unused]],
165 quint32 &maximum_tof_index_out [[maybe_unused]])
const
175 std::size_t mz_index_merge_window [[maybe_unused]],
176 double mz_range_begin [[maybe_unused]],
177 double mz_range_end [[maybe_unused]],
178 std::size_t mobility_scan_begin [[maybe_unused]],
179 std::size_t mobility_scan_end [[maybe_unused]],
180 quint32 &mz_minimum_index_out [[maybe_unused]],
181 quint32 &mz_maximum_index_out [[maybe_unused]])
const
191 std::size_t mz_index_merge_window
193 double mz_range_begin [[maybe_unused]],
194 double mz_range_end [[maybe_unused]],
195 quint32 &mz_minimum_index_out [[maybe_unused]],
196 quint32 &mz_maximum_index_out
197 [[maybe_unused]])
const
208 std::size_t scanNumBegin,
209 std::size_t scanNumEnd)
const
213 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
214 "number begin %1 end %2")
223 std::size_t scanNumBegin,
224 std::size_t scanNumEnd,
225 quint32 tof_index_begin,
226 quint32 tof_index_end)
const
230 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
231 "number begin %1 end %2, tof index begin %3, tof index end %4")
234 .arg(tof_index_begin)
235 .arg(tof_index_end));
243 "ERROR unable to cumulateSingleScanIntensities in TimsFrameBase for scan "
253 std::size_t scanNumEnd)
const
257 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
258 "number begin %1 end %2")
275 qDebug() <<
" m_msMsType=" << type;
305 [[maybe_unused]]
double C5,
311 if(tims_model_type != 2)
314 "ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
338 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
339 "calibration, v < m_timsVmin %1 < %2")
348 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
349 "calibration, v > m_timsVmax %1 > %2")
372 double temp = 1 / one_over_k0;
378 return (std::size_t)std::round(temp);
413 element.
y = ((double)accumulated_scans.
readIntensity(tof_index)) * 100.0 /
419 local_trace.push_back(element);
435 QObject::tr(
"ERROR in %1, %2, %3 msp_mzCalibration is null")
448 if(mzCalibration ==
nullptr)
452 QObject::tr(
"ERROR in %1, %2, %3 msp_mzCalibration is null")
464 quint32 max_value = 0;
467 qDebug() <<
"m_scanNumber=" <<
m_scanCount <<
" i=" << i;
469 auto it = std::max_element(index_list.begin(), index_list.end());
470 if(it != index_list.end())
472 max_value = std::max(max_value, *it);
483 "ERROR unable to getScanIndexList in TimsFrameBase for scan number %1")
493 "ERROR unable to getScanIntensities in TimsFrameBase for scan number %1")
499 std::size_t tof_index_begin,
500 std::size_t tof_index_end,
502 std::size_t scan_index_begin,
503 std::size_t scan_index_end)
const
509 for(quint32 i = scan_index_begin; i < (scan_index_end + 1); i++)
513 qDebug() <<
"m_scanNumber=" <<
m_scanCount <<
" i=" << i;
515 auto it_lower = std::find_if(index_list.begin(),
517 [tof_index_begin](quint32 to_compare) {
518 if(to_compare < tof_index_begin)
526 if(it_lower == index_list.end())
533 auto it_upper = std::find_if(index_list.begin(),
535 [tof_index_end](quint32 to_compare) {
536 if(tof_index_end >= to_compare)
543 for(
int j = std::distance(index_list.begin(), it_lower);
544 j < std::distance(index_list.begin(), it_upper);
549 data_point.
y += intensity_list[j];
554 std::max((
double)intensity_list[j], data_point.
y);
558 im_trace.push_back(data_point);
565std::vector<TimsFrameBase::TofIndexIntensityPair> &
566TimsFrameBase::downgradeResolutionOfTofIndexIntensityPairList(
567 std::size_t mzindex_merge_window,
568 std::vector<TimsFrameBase::TofIndexIntensityPair> &rawSpectrum)
const
571 qDebug() << rawSpectrum.size();
572 std::vector<TimsFrameBase::TofIndexIntensityPair> new_spectrum;
577 for(
auto &pair_mz_intensity : rawSpectrum)
579 quint32 mzkey = (pair_mz_intensity.tof_index / mzindex_merge_window);
580 mzkey = (mzkey * mzindex_merge_window) + (mzindex_merge_window / 2);
586 new_spectrum.push_back(current_point);
600 new_spectrum.push_back(current_point);
602 rawSpectrum = new_spectrum;
603 qDebug() << rawSpectrum.size();
virtual double getMzFromTofIndex(quint32 tof_index)=0
get m/z from time of flight raw index
const std::vector< quint32 > & getTofIndexList() const
std::size_t readIntensity(quint32)
reads intensity for a tof_index
double m_rtInSeconds
retention time
double getVoltageTransformation(std::size_t scanNum) const
get voltage for a given scan number
virtual std::size_t getTotalNumberOfScans() const
get the number of scans contained in this frame each scan represents an ion mobility slice
virtual pappso::MassSpectrumCstSPtr getMassSpectrumCstSPtr(std::size_t scan_index) const final
get the mass spectrum corresponding to a scan index
MzCalibrationInterfaceSPtr msp_mzCalibration
virtual std::size_t getScanPeakCount(std::size_t scanIndex) const
get the number of peaks in this spectrum need the binary file
double getDriftTimeInMilliseconds(std::size_t scan_index) const
get drift time of a scan number in milliseconds
virtual Trace cumulateScansToTrace(std::size_t scanIndexBegin, std::size_t scanIndexEnd) const
cumulate spectrum given a scan number range need the binary file The intensities are normalized with ...
std::size_t getScanIndexFromOneOverK0(double one_over_k0) const
get the scan number from a given 1/Ko mobility value
virtual bool hasSameCalibrationData(const TimsFrameBase &other) const
tells if 2 tims frame has the same calibration data Usefull to know if raw data can be handled betwee...
virtual Trace combineScansToTraceWithDowngradedMzResolution(std::size_t tof_index_merge_window, std::size_t scanIndexBegin, std::size_t scanIndexEnd, quint32 &minimum_tof_index_out, quint32 &maximum_tof_index_out) const
cumulate spectrum given a scan index range need the binary file The intensities are normalized with r...
virtual Trace getIonMobilityTraceByTofIndexRange(std::size_t tof_index_begin, std::size_t tof_index_end, XicExtractMethod method, std::size_t scan_index_begin, std::size_t scan_index_end) const
get a mobility trace cumulating intensities inside the given mass index range
double m_acqDurationInMilliseconds
acquisition duration in milliseconds
double getRtInSeconds() const
virtual quint32 getMaximumRawMassIndex() const
get the maximum raw mass index contained in this frame
TimsFrameBase(std::size_t frameId, quint32 scanCount)
constructor for binary independant tims frame
pappso::Trace getTraceFromTofIndexIntensityMap(TimsDataFastMap &accumulated_scans) const
transform accumulation of raw scans into a real mass spectrum
virtual Trace combineScansToTraceWithDowngradedMzResolution2(std::size_t mz_index_merge_window, double mz_range_begin, double mz_range_end, std::size_t mobility_scan_begin, std::size_t mobility_scan_end, quint32 &mz_minimum_index_out, quint32 &mz_maximum_index_out) const
cumulate spectrum given a scan number range need the binary file The intensities are normalized with ...
unsigned int getMsLevel() const
void setTimsCalibration(int tims_model_type, double C0, double C1, double C2, double C3, double C4, double C5, double C6, double C7, double C8, double C9)
virtual MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scan_index) const
get Mass spectrum with peaks for this scan index need the binary file
virtual const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
virtual quint64 cumulateScanRangeIntensities(std::size_t scan_index_begin, std::size_t scan_index_end) const
void setRtInSeconds(double time)
double getOneOverK0Transformation(std::size_t scan_index) const
get 1/K0 value of a given scan (mobility value)
void setMsMsType(quint8 type)
void setMzCalibration(double T1_frame, double T2_frame, double digitizerTimebase, double digitizerDelay, double C0, double C1, double C2, double C3, double C4, double T1_ref, double T2_ref, double dC1, double dC2)
quint32 m_scanCount
total number of scans contained in this frame
std::size_t m_frameId
Tims frame database id (the SQL identifier of this frame)
void setAcqDurationInMilliseconds(double acquisition_duration_ms)
virtual Trace getMobilityScan(std::size_t scan_index, std::size_t tof_index_merge_window, double mz_range_begin, double mz_range_end, quint32 &mz_minimum_index_out, quint32 &mz_maximum_index_out) const
get a single mobility scan m/z + intensities
bool checkScanNum(std::size_t scanNum) const
check that this scan number exists
virtual void combineScansInTofIndexIntensityMap(TimsDataFastMap &tof_index_intensity_map, std::size_t scan_index_begin, std::size_t scan_index_end) const
cumulate scan list into a trace into a raw spectrum map The intensities are NOT normalized with respe...
void setMzCalibrationInterfaceSPtr(MzCalibrationInterfaceSPtr mzCalibration)
virtual std::vector< quint32 > getScanTofIndexList(std::size_t scan_index) const
get raw index list for one given scan index are not TOF nor m/z, just index on digitizer
virtual std::vector< quint32 > getScanIntensityList(std::size_t scan_index) const
get raw intensities without transformation from one scan it needs intensity normalization
std::size_t getId() const
virtual quint64 cumulateScanIntensities(std::size_t scan_index) const
A simple container of DataPoint instances.
void sortX(SortOrder sort_order=SortOrder::ascending)
implement Bruker's model type 1 formula to compute m/z
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< MzCalibrationInterface > MzCalibrationInterfaceSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
handle a single Bruker's TimsTof frame without binary data