libpappsomspp
Library for mass spectrometry
|
Go to the documentation of this file.
28 #include "../../../pappsomspp/pappsoexception.h"
29 #include "../../../pappsomspp/exception/exceptionoutofrange.h"
62 double digitizerTimebase,
63 double digitizerDelay,
71 C1 = C1 * temperature_correction;
72 C2 = C2 / temperature_correction;
89 QObject::tr(
"Invalid scan number : scanNum%1 > m_scanNumber")
99 throw PappsoException(
101 "ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
110 "ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
115 std::size_t scanNumEnd)
const
118 QObject::tr(
"ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
119 "number begin %1 end %2")
126 std::size_t scanNumBegin,
127 std::size_t scanNumEnd)
const
131 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
132 "number begin %1 end %2")
179 std::vector<double> X;
195 alglib::real_1d_array polynom_array;
198 polynom_array.setcontent(X.size(), &(X[0]));
200 catch(alglib::ap_error &error)
204 QObject::tr(
"ERROR in alglib::polynom_array.setcontent :\n%1")
205 .arg(error.msg.c_str()));
217 alglib::complex_1d_array m;
218 alglib::polynomialsolverreport rep;
222 alglib::polynomialsolve(polynom_array, X.size() - 1, m, rep);
224 catch(alglib::ap_error &error)
226 qDebug() <<
" X.size() - 1 = " << X.size() - 1;
234 QObject::tr(
"ERROR in alglib::polynomialsolve :\n%1")
235 .arg(error.msg.c_str()));
244 QObject::tr(
"ERROR in TimsFrame::getMzFromTof m.size() == 0"));
250 QObject::tr(
"ERROR in TimsFrame::getMzFromTof m[0].y!= 0"));
253 return pow(m[0].x, 2);
264 qDebug() <<
"mz=" <<
mz;
267 qDebug() <<
"tof ( m_mzCalibrationArr[0])=" << tof;
270 qDebug() <<
"tof=" << tof;
272 qDebug() <<
"tof=" << tof;
274 qDebug() <<
"tof=" << tof;
276 qDebug() <<
"tof=" << tof;
278 qDebug() <<
"index=" << tof;
279 return (quint32)std::round(tof);
292 qDebug() <<
" m_msMsType=" << type;
322 [[maybe_unused]]
double C5,
328 if(tims_model_type != 2)
331 "ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
355 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
356 "calibration, v < m_timsVmin"));
363 QObject::tr(
"ERROR in TimsFrame::getVoltageTransformation invalid tims "
364 "calibration, v > m_timsVmax"));
384 double temp = 1 / one_over_k0;
390 return (std::size_t)std::round(temp);
410 std::map<quint32, quint32> &accumulated_scans)
const
416 transform(begin(accumulated_scans),
417 end(accumulated_scans),
418 back_inserter(local_trace),
419 [](std::map<quint32, quint32>::value_type
const &pair) {
442 std::map<quint32, quint32> &accumulated_scans)
const
447 std::vector<quint32> keys;
448 transform(begin(accumulated_scans),
449 end(accumulated_scans),
451 [](std::map<quint32, quint32>::value_type
const &pair) {
454 std::sort(keys.begin(), keys.end());
456 data_point_cumul.
x = 0;
457 data_point_cumul.
y = 0;
461 quint32 last_key = 0;
463 for(quint32 key : keys)
465 if(key == last_key + 1)
468 if(accumulated_scans[key] > accumulated_scans[last_key])
470 if(data_point_cumul.
x == last_key)
473 data_point_cumul.
x = key;
474 data_point_cumul.
y += accumulated_scans[key];
480 if(data_point_cumul.
y > 0)
490 local_trace.push_back(data_point_cumul);
494 data_point_cumul.
x = key;
495 data_point_cumul.
y = accumulated_scans[key];
500 data_point_cumul.
y += accumulated_scans[key];
506 if(data_point_cumul.
y > 0)
516 local_trace.push_back(data_point_cumul);
520 data_point_cumul.
x = key;
521 data_point_cumul.
y = accumulated_scans[key];
527 if(data_point_cumul.
y > 0)
537 local_trace.push_back(data_point_cumul);
double m_digitizerTimebase
bool checkScanNum(std::size_t scanNum) const
std::size_t m_timsId
Tims frame database id (the SQL identifier of this frame)
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)
unsigned int getMsLevel() const
virtual Trace cumulateScanToTrace(std::size_t scanNumBegin, std::size_t scanNumEnd) const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
void setAccumulationTime(double accumulation_time_ms)
void setMzCalibration(double temperature_correction, double digitizerTimebase, double digitizerDelay, double C0, double C1, double C2, double C3)
void setTime(double time)
virtual std::size_t getNbrPeaks(std::size_t scanNum) const
quint32 getRawIndexFromMz(double mz) const
get raw index of a given m/z
double getDriftTime(std::size_t scanNum) const
get drift time of a scan number in milliseconds
double m_accumulationTime
accumulation time in milliseconds
double m_time
retention time
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
A simple container of DataPoint instances.
double getVoltageTransformation(std::size_t scanNum) const
std::size_t getId() const
virtual MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const
std::size_t getScanNumFromOneOverK0(double one_over_k0) const
get the scan number from a given 1/Ko mobility value
handle a single Bruker's TimsTof frame without binary data
TimsFrameBase(std::size_t timsId, quint32 scanNum)
constructor for binary independant tims frame
void setMsMsType(quint8 type)
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
double getOneOverK0Transformation(std::size_t scanNum) const
get 1/K0 value of a given scan (mobility value)
double getMzFromTof(double tof) const
get m/z from time of flight
quint32 m_scanNumber
total number of scans contained in this frame
double getTofFromIndex(quint32 index) const
get time of flight from raw index
std::vector< double > m_mzCalibrationArr
MZ calibration parameters.
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
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...