28 #include "../../../pappsomspp/pappsoexception.h"
29 #include "../../../pappsomspp/exception/exceptionoutofrange.h"
63 double digitizerTimebase,
64 double digitizerDelay,
106 QObject::tr(
"Invalid scan number : scanNum %1 > m_scanNumber %2")
119 "ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
128 "ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
133 std::size_t scanNumEnd)
const
136 QObject::tr(
"ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
137 "number begin %1 end %2")
144 std::size_t scanNumBegin,
145 std::size_t scanNumEnd)
const
149 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
150 "number begin %1 end %2")
164 qDebug() <<
" m_msMsType=" << type;
194 [[maybe_unused]]
double C5,
200 if(tims_model_type != 2)
203 "ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
227 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
228 "calibration, v < m_timsVmin"));
235 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
236 "calibration, v > m_timsVmax"));
256 double temp = 1 / one_over_k0;
262 return (std::size_t)std::round(temp);
282 std::map<quint32, quint32> &accumulated_scans)
const
294 for(
auto &scan_element : accumulated_scans)
302 local_trace.push_back(element);
313 std::map<quint32, quint32> &accumulated_scans)
const
318 std::vector<quint32> keys;
319 transform(begin(accumulated_scans),
320 end(accumulated_scans),
322 [](std::map<quint32, quint32>::value_type
const &pair) {
325 std::sort(keys.begin(), keys.end());
327 data_point_cumul.
x = 0;
328 data_point_cumul.
y = 0;
336 quint32 last_key = 0;
338 for(quint32 key : keys)
340 if(key == last_key + 1)
343 if(accumulated_scans[key] > accumulated_scans[last_key])
345 if(data_point_cumul.
x == last_key)
348 data_point_cumul.
x = key;
349 data_point_cumul.
y += accumulated_scans[key];
355 if(data_point_cumul.
y > 0)
364 local_trace.push_back(data_point_cumul);
368 data_point_cumul.
x = key;
369 data_point_cumul.
y = accumulated_scans[key];
374 data_point_cumul.
y += accumulated_scans[key];
380 if(data_point_cumul.
y > 0)
391 local_trace.push_back(data_point_cumul);
395 data_point_cumul.
x = key;
396 data_point_cumul.
y = accumulated_scans[key];
402 if(data_point_cumul.
y > 0)
411 local_trace.push_back(data_point_cumul);
427 QObject::tr(
"ERROR in %1, %2, %3 msp_mzCalibration is null")
440 if(mzCalibration ==
nullptr)
444 QObject::tr(
"ERROR in %1, %2, %3 msp_mzCalibration is null")
virtual double getMzFromTofIndex(quint32 tof_index)=0
get m/z from time of flight raw index
double m_accumulationTime
accumulation time in milliseconds
double getVoltageTransformation(std::size_t scanNum) const
get voltage for a given scan number
virtual Trace cumulateScanToTrace(std::size_t scanNumBegin, std::size_t scanNumEnd) const
cumulate spectrum given a scan number range need the binary file
virtual std::size_t getNbrPeaks(std::size_t scanNum) const
get the number of peaks in this spectrum need the binary file
MzCalibrationInterfaceSPtr msp_mzCalibration
virtual MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const
get Mass spectrum with peaks for this scan number need the binary file
TimsFrameBase(std::size_t timsId, quint32 scanNum)
constructor for binary independant tims frame
double getDriftTime(std::size_t scanNum) const
get drift time of a scan number in milliseconds
pappso::Trace getTraceFromCumulatedScansBuiltinCentroid(std::map< quint32, quint32 > &accumulated_scans) const
transform accumulation of raw scans into a real mass spectrum with a simple centroid on raw integers
double m_time
retention time
void setAccumulationTime(double accumulation_time_ms)
quint32 m_scanNumber
total number of scans contained in this frame
virtual void cumulateScansInRawMap(std::map< quint32, quint32 > &rawSpectrum, std::size_t scanNumBegin, std::size_t scanNumEnd) const
cumulate scan list into a trace into a raw spectrum map
void setTime(double time)
std::size_t m_timsId
Tims frame database id (the SQL identifier of this frame)
pappso::Trace getTraceFromCumulatedScans(std::map< quint32, quint32 > &accumulated_scans) const
transform accumulation of raw scans into a real mass spectrum
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...
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 const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
std::size_t getScanNumFromOneOverK0(double one_over_k0) const
get the scan number from a given 1/Ko 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)
double getOneOverK0Transformation(std::size_t scanNum) const
get 1/K0 value of a given scan (mobility value)
bool checkScanNum(std::size_t scanNum) const
check that this scan number exists
void setMzCalibrationInterfaceSPtr(MzCalibrationInterfaceSPtr mzCalibration)
std::size_t getId() const
A simple container of DataPoint instances.
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< MassSpectrum > MassSpectrumSPtr
handle a single Bruker's TimsTof frame without binary data