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")
118 "ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
127 "ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
132 std::size_t scanNumEnd)
const
135 QObject::tr(
"ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
136 "number begin %1 end %2")
143 std::size_t scanNumBegin,
144 std::size_t scanNumEnd)
const
148 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
149 "number begin %1 end %2")
163 qDebug() <<
" m_msMsType=" << type;
193 [[maybe_unused]]
double C5,
199 if(tims_model_type != 2)
202 "ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
226 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
227 "calibration, v < m_timsVmin"));
234 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
235 "calibration, v > m_timsVmax"));
255 double temp = 1 / one_over_k0;
261 return (std::size_t)std::round(temp);
281 std::map<quint32, quint32> &accumulated_scans)
const
293 for(
auto &scan_element : accumulated_scans)
301 local_trace.push_back(element);
312 std::map<quint32, quint32> &accumulated_scans)
const
317 std::vector<quint32> keys;
318 transform(begin(accumulated_scans),
319 end(accumulated_scans),
321 [](std::map<quint32, quint32>::value_type
const &pair) {
324 std::sort(keys.begin(), keys.end());
326 data_point_cumul.
x = 0;
327 data_point_cumul.
y = 0;
335 quint32 last_key = 0;
337 for(quint32 key : keys)
339 if(key == last_key + 1)
342 if(accumulated_scans[key] > accumulated_scans[last_key])
344 if(data_point_cumul.
x == last_key)
347 data_point_cumul.
x = key;
348 data_point_cumul.
y += accumulated_scans[key];
354 if(data_point_cumul.
y > 0)
363 local_trace.push_back(data_point_cumul);
367 data_point_cumul.
x = key;
368 data_point_cumul.
y = accumulated_scans[key];
373 data_point_cumul.
y += accumulated_scans[key];
379 if(data_point_cumul.
y > 0)
385 qDebug() <<
"raw data x=" << data_point_cumul.
x;
389 qDebug() <<
"mz=" << data_point_cumul.
x;
390 local_trace.push_back(data_point_cumul);
394 data_point_cumul.
x = key;
395 data_point_cumul.
y = accumulated_scans[key];
401 if(data_point_cumul.
y > 0)
410 local_trace.push_back(data_point_cumul);
426 QObject::tr(
"ERROR in %1, %2, %3 msp_mzCalibration is null")
439 if(mzCalibration ==
nullptr)
443 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
virtual Trace cumulateScanToTrace(std::size_t scanNumBegin, std::size_t scanNumEnd) const
virtual std::size_t getNbrPeaks(std::size_t scanNum) const
MzCalibrationInterfaceSPtr msp_mzCalibration
virtual MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const
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
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