65 double digitizerTimebase,
66 double digitizerDelay,
108 QObject::tr(
"Invalid scan number : scanNum %1 > m_scanNumber %2")
120 QObject::tr(
"ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
134 QObject::tr(
"ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
149 throw PappsoException(QObject::tr(
"ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
150 "number begin %1 end %2")
157 std::size_t mzindex_merge_window [[maybe_unused]],
158 std::size_t scanNumBegin [[maybe_unused]],
159 std::size_t scanNumEnd [[maybe_unused]],
160 quint32 &minimum_tof_index_out [[maybe_unused]],
161 quint32 &maximum_tof_index_out [[maybe_unused]])
const
164 QObject::tr(
"Non implemented function %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
169 std::size_t mz_index_merge_window [[maybe_unused]],
170 double mz_range_begin [[maybe_unused]],
171 double mz_range_end [[maybe_unused]],
172 std::size_t mobility_scan_begin [[maybe_unused]],
173 std::size_t mobility_scan_end [[maybe_unused]],
174 quint32 &mz_minimum_index_out [[maybe_unused]],
175 quint32 &mz_maximum_index_out [[maybe_unused]])
const
178 QObject::tr(
"Non implemented function %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
183 std::size_t mz_index_merge_window [[maybe_unused]],
184 double mz_range_begin [[maybe_unused]],
185 double mz_range_end [[maybe_unused]],
186 quint32 &mz_minimum_index_out [[maybe_unused]],
187 quint32 &mz_maximum_index_out [[maybe_unused]])
const
190 QObject::tr(
"Non implemented function %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
195 std::size_t scanNumBegin,
196 std::size_t scanNumEnd)
const
199 QObject::tr(
"ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
200 "number begin %1 end %2")
208 std::size_t scanNumBegin,
209 std::size_t scanNumEnd,
210 quint32 tof_index_begin,
211 quint32 tof_index_end)
const
214 QObject::tr(
"ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
215 "number begin %1 end %2, tof index begin %3, tof index end %4")
218 .arg(tof_index_begin)
219 .arg(tof_index_end));
226 QObject::tr(
"ERROR unable to cumulateSingleScanIntensities in TimsFrameBase for scan "
238 QObject::tr(
"ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
239 "number begin %1 end %2")
256 qDebug() <<
" m_msMsType=" << type;
286 [[maybe_unused]]
double C5,
292 if(tims_model_type != 2)
295 QObject::tr(
"ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
317 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
318 "calibration, v < m_timsVmin %1 < %2")
327 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
328 "calibration, v > m_timsVmax %1 > %2")
350 double temp = 1 / one_over_k0;
356 return (std::size_t)std::round(temp);
394 local_trace.push_back(element);
421 if(mzCalibration ==
nullptr)
436 quint32 max_value = 0;
439 qDebug() <<
"m_scanNumber=" <<
m_scanCount <<
" i=" << i;
441 auto it = std::max_element(index_list.begin(), index_list.end());
442 if(it != index_list.end())
444 max_value = std::max(max_value, *it);
454 QObject::tr(
"ERROR unable to getScanIndexList in TimsFrameBase for scan number %1")
463 QObject::tr(
"ERROR unable to getScanIntensities in TimsFrameBase for scan number %1")
469 std::size_t tof_index_end,
471 std::size_t scan_index_begin,
472 std::size_t scan_index_end)
const
478 for(quint32 i = scan_index_begin; i < (scan_index_end + 1); i++)
482 qDebug() <<
"m_scanNumber=" <<
m_scanCount <<
" i=" << i;
485 std::find_if(index_list.begin(), index_list.end(), [tof_index_begin](quint32 to_compare) {
486 if(to_compare < tof_index_begin)
494 if(it_lower == index_list.end())
502 std::find_if(index_list.begin(), index_list.end(), [tof_index_end](quint32 to_compare) {
503 if(tof_index_end >= to_compare)
510 for(
int j = std::distance(index_list.begin(), it_lower);
511 j < std::distance(index_list.begin(), it_upper);
516 data_point.
y += intensity_list[j];
520 data_point.
y = std::max((
double)intensity_list[j], data_point.
y);
524 im_trace.push_back(data_point);
531std::vector<TimsFrameBase::TofIndexIntensityPair> &
533 std::size_t mzindex_merge_window,
534 std::vector<TimsFrameBase::TofIndexIntensityPair> &rawSpectrum)
const
537 qDebug() << rawSpectrum.size();
538 std::vector<TimsFrameBase::TofIndexIntensityPair> new_spectrum;
543 for(
auto &pair_mz_intensity : rawSpectrum)
545 quint32 mzkey = (pair_mz_intensity.tof_index / mzindex_merge_window);
546 mzkey = (mzkey * mzindex_merge_window) + (mzindex_merge_window / 2);
552 new_spectrum.push_back(current_point);
566 new_spectrum.push_back(current_point);
568 rawSpectrum = new_spectrum;
569 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 ...
virtual std::vector< TofIndexIntensityPair > & downgradeResolutionOfTofIndexIntensityPairList(std::size_t tof_index_merge_window, std::vector< TofIndexIntensityPair > &spectrum) const
Downgrade the TOF index resolution to lower the number of real m/z computations.
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...
double m_acqDurationInMilliseconds
acquisition duration in milliseconds
double getRtInSeconds() const
virtual quint32 getMaximumRawMassIndex() const
get the maximum raw mass index contained in this frame
virtual Trace getIonMobilityTraceByTofIndexRange(std::size_t tof_index_begin, std::size_t tof_index_end, Enums::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
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(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
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