Loading...
Searching...
No Matches
pappso::TimsFrameBase Class Reference

`#include <timsframebase.h>`

Inheritance diagram for pappso::TimsFrameBase:

## Public Member Functions

| TimsFrameBase (std::size_t timsId, quint32 scanNum)
| constructor for binary independant tims frame
| TimsFrameBase (const TimsFrameBase &other)
virtual | ~TimsFrameBase ()
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 between frames
virtual std::size_t | getNbrPeaks (std::size_t scanNum) const
| get the number of peaks in this spectrum need the binary file
virtual std::size_t | getTotalNumberOfScans () const
| get the number of scans contained in this frame each scan represents an ion mobility slice
virtual quint32 | getMaximumRawMassIndex () const
| get the maximum raw mass index contained in this frame
virtual MassSpectrumSPtr | getMassSpectrumSPtr (std::size_t scanNum) const
| get Mass spectrum with peaks for this scan number need the binary file
virtual Trace | cumulateScansToTrace (std::size_t scanNumBegin, std::size_t scanNumEnd) const
| cumulate spectrum given a scan number range need the binary file The intensities are normalized with respect to the frame accumulation time
virtual Trace | cumulateScansToTraceMzDownResolution (std::size_t mzindex_merge_window, std::size_t scanNumBegin, std::size_t scanNumEnd, quint32 &minimum_index, quint32 &maximum_index) const
| cumulate spectrum given a scan number range need the binary file The intensities are normalized with respect to the frame accumulation time to leverage computing performance, this function decreases the mz resolution
std::map< quint32, quint32 > & | downsizeMzRawMap (std::size_t mzindex_merge_window, std::map< quint32, quint32 > &rawSpectrum) const
| downsize mz resolution to lower the number of real mz computations
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 The intensities are NOT normalized with respect to the frame accumulation time
virtual quint64 | cumulateSingleScanIntensities (std::size_t scanNum) const
virtual quint64 | cumulateScansIntensities (std::size_t scanNumBegin, std::size_t scanNumEnd) const
bool | checkScanNum (std::size_t scanNum) const
| check that this scan number exists
void | setAccumulationTime (double accumulation_time_ms)
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)
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)
void | setTime (double time)
void | setMsMsType (quint8 type)
unsigned int | getMsLevel () const
double | getTime () const
std::size_t | getId () const
double | getDriftTime (std::size_t scanNum) const
| get drift time of a scan number in milliseconds
double | getOneOverK0Transformation (std::size_t scanNum) const
| get 1/K0 value of a given scan (mobility value)
std::size_t | getScanNumFromOneOverK0 (double one_over_k0) const
| get the scan number from a given 1/Ko mobility value
double | getVoltageTransformation (std::size_t scanNum) const
| get voltage for a given scan number
pappso::Trace | getTraceFromCumulatedScans (std::map< quint32, quint32 > &accumulated_scans) const
| transform accumulation of raw scans into a real mass spectrum
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
virtual const MzCalibrationInterfaceSPtr & | getMzCalibrationInterfaceSPtr () const final
| get the MzCalibration model to compute mz and TOF for this frame
void | setMzCalibrationInterfaceSPtr (MzCalibrationInterfaceSPtr mzCalibration)
virtual std::vector< quint32 > | getScanIndexList (std::size_t scanNum) const
| get raw index list for one given scan index are not TOF nor m/z, just index on digitizer
virtual std::vector< quint32 > | getScanIntensities (std::size_t scanNum) const
| get raw intensities without transformation from one scan it needs intensity normalization
virtual Trace | getIonMobilityTraceByMzIndexRange (std::size_t mz_index_lower_bound, std::size_t mz_index_upper_bound, XicExtractMethod method) const
| get a mobility trace cumulating intensities inside the given mass index range

## Protected Attributes

quint32 | m_scanNumber
| total number of scans contained in this frame
std::size_t | m_timsId
| Tims frame database id (the SQL identifier of this frame)
double | m_accumulationTime = 0
| accumulation time in milliseconds
quint8 | m_msMsType = 0
double | m_time = 0
| retention time
double | m_timsDvStart = 0
double | m_timsSlope
double | m_timsTtrans = 0
double | m_timsNdelay = 0
double | m_timsVmin = 0
double | m_timsVmax = 0
double | m_timsC6 = 0
double | m_timsC7 = 0
MzCalibrationInterfaceSPtr | msp_mzCalibration = nullptr

## Detailed Description

Todo:
  write docs

Definition at line 47 of file timsframebase.h.

## Constructor & Destructor Documentation

## TimsFrameBase() [1/2]

pappso::TimsFrameBase::TimsFrameBase | ( | std::size_t | timsId,
|  | quint32 | scanNum
| ) |  |

constructor for binary independant tims frame

Parameters

  timsId | tims frame identifier in the database
  scanNum | the total number of scans contained in this frame

Definition at line 39 of file timsframebase.cpp.

{
qDebug() << timsId;
m_timsId = timsId;
m_scanNumber = scanNum;
}
pappso::TimsFrameBase::m_scanNumber
quint32 m_scanNumber
total number of scans contained in this frame
Definition timsframebase.h:273
pappso::TimsFrameBase::m_timsId
std::size_t m_timsId
Tims frame database id (the SQL identifier of this frame)
Definition timsframebase.h:279

References m_scanNumber, and m_timsId.

## TimsFrameBase() [2/2]

pappso::TimsFrameBase::TimsFrameBase | ( | const TimsFrameBase & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 47 of file timsframebase.cpp.

{
}

## ~TimsFrameBase()

pappso::TimsFrameBase::~TimsFrameBase | ( |  | ) |

virtual

Destructor

Definition at line 51 of file timsframebase.cpp.

{
}

## Member Function Documentation

## checkScanNum()

bool pappso::TimsFrameBase::checkScanNum | ( | std::size_t | scanNum | ) | const

check that this scan number exists

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Definition at line 103 of file timsframebase.cpp.

{
if(scanNum >= m_scanNumber)
{
throw pappso::ExceptionOutOfRange(
QObject::tr("Invalid scan number : scanNum %1 > m_scanNumber %2")
.arg(scanNum)
.arg(m_scanNumber));
}
return true;
}
pappso::ExceptionOutOfRange
Definition exceptionoutofrange.h:32

References m_scanNumber.

Referenced by pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::TimsFrame::getNbrPeaks(), pappso::TimsFrame::getScanIndexList(), pappso::TimsFrameType1::getScanIndexList(), pappso::TimsFrame::getScanIntensities(), and pappso::TimsFrameType1::getScanIntensities().

## cumulateScansInRawMap()

void pappso::TimsFrameBase::cumulateScansInRawMap | ( | std::map< quint32, quint32 > & | rawSpectrum,
|  | std::size_t | scanNumBegin,
|  | std::size_t | scanNumEnd
| ) |  | const

virtual

cumulate scan list into a trace into a raw spectrum map The intensities are NOT normalized with respect to the frame accumulation time

Parameters

  rawSpectrum | simple map of integers to cumulate raw counts
  scanNumBegin | scan number in the frame in the order it lies in binary file, from 0 to N-1
  scanNumEnd | scan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame.

Definition at line 165 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
"number begin %1 end %2")
.arg(scanNumBegin)
.arg(scanNumEnd));
}

## cumulateScansIntensities()

quint64 pappso::TimsFrameBase::cumulateScansIntensities | ( | std::size_t | scanNumBegin,
|  | std::size_t | scanNumEnd
| ) |  | const

virtual

Reimplemented in pappso::TimsFrame.

Definition at line 193 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
"number begin %1 end %2")
.arg(scanNumBegin)
.arg(scanNumEnd));
return 0;
}

## cumulateScansToTrace()

Trace pappso::TimsFrameBase::cumulateScansToTrace | ( | std::size_t | scanNumBegin,
|  | std::size_t | scanNumEnd
| ) |  | const

virtual

cumulate spectrum given a scan number range need the binary file The intensities are normalized with respect to the frame accumulation time

Parameters

  scanNumBegin | scan number in the frame in the order it lies in binary file, from 0 to N-1
  scanNumEnd | scan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame.

Definition at line 140 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr("ERROR unable to cumulateScanToTrace in TimsFrameBase for scan "
"number begin %1 end %2")
.arg(scanNumBegin)
.arg(scanNumEnd));
}

## cumulateScansToTraceMzDownResolution()

Trace pappso::TimsFrameBase::cumulateScansToTraceMzDownResolution | ( | std::size_t | mzindex_merge_window,
|  | std::size_t | scanNumBegin,
|  | std::size_t | scanNumEnd,
|  | quint32 & | minimum_index,
|  | quint32 & | maximum_index
| ) |  | const

virtual

cumulate spectrum given a scan number range need the binary file The intensities are normalized with respect to the frame accumulation time to leverage computing performance, this function decreases the mz resolution

Parameters

  mzindex_merge_window | width of the mzindex window used to merge all intensities into a single point. This results in faster computing.
  scanNumBegin | scan number in the frame in the order it lies in binary file, from 0 to N-1
  scanNumEnd | scan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame.

Definition at line 151 of file timsframebase.cpp.

{
throw PappsoException(QObject::tr("Non implemented function %1 %2 %3")
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}

## cumulateSingleScanIntensities()

quint64 pappso::TimsFrameBase::cumulateSingleScanIntensities | ( | std::size_t | scanNum | ) | const

virtual

Reimplemented in pappso::TimsFrame.

Definition at line 180 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to cumulateSingleScanIntensities in TimsFrameBase for scan "
"number %1.")
.arg(scanNum));
return 0;
}

## downsizeMzRawMap()

std::map< quint32, quint32 > & pappso::TimsFrameBase::downsizeMzRawMap | ( | std::size_t | mzindex_merge_window,
|  | std::map< quint32, quint32 > & | rawSpectrum
| ) |  | const

downsize mz resolution to lower the number of real mz computations

Parameters

  mzindex_merge_window | width of the mzindex window used to merge all intensities into a single point. This results in faster computing.
  rawSpectrum | the spectrum to shrink

Definition at line 606 of file timsframebase.cpp.

{
std::map<quint32, quint32> new_spectrum;
for(auto &pair_mz_intensity : rawSpectrum)
{
quint32 mzkey = (pair_mz_intensity.first / mzindex_merge_window);
mzkey = (mzkey * mzindex_merge_window) + (mzindex_merge_window / 2);
auto it = new_spectrum.insert({mzkey, pair_mz_intensity.second});
if(it.second == false)
{
it.first->second += pair_mz_intensity.second;
}
}
rawSpectrum = new_spectrum;
return rawSpectrum;
}

Referenced by pappso::TimsFrame::cumulateScansToTraceMzDownResolution(), and pappso::TimsFrame::cumulateScansToTraceMzDownResolution2().

## getDriftTime()

double pappso::TimsFrameBase::getDriftTime | ( | std::size_t | scanNum | ) | const

get drift time of a scan number in milliseconds

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Returns
  time in milliseconds of mobility delay (drift time)

Definition at line 293 of file timsframebase.cpp.

{
return (m_accumulationTime / (double)m_scanNumber) * ((double)scanNum);
}
pappso::TimsFrameBase::m_accumulationTime
double m_accumulationTime
accumulation time in milliseconds
Definition timsframebase.h:283

References m_accumulationTime, and m_scanNumber.

## getId()

std::size_t pappso::TimsFrameBase::getId | ( |  | ) | const

Definition at line 235 of file timsframebase.cpp.

{
return m_timsId;
}

References m_timsId.

Referenced by pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::TimsFrameType1::getScanIndexList(), and pappso::TimsFrameType1::getScanIntensities().

## getIonMobilityTraceByMzIndexRange()

Trace pappso::TimsFrameBase::getIonMobilityTraceByMzIndexRange | ( | std::size_t | mz_index_lower_bound,
|  | std::size_t | mz_index_upper_bound,
|  | XicExtractMethod | method
| ) |  | const

virtual

get a mobility trace cumulating intensities inside the given mass index range

Parameters

  mz_index_lower_bound | raw mass index lower bound
  mz_index_upper_bound | raw mass index upper bound
  method | max or sum intensities

Definition at line 542 of file timsframebase.cpp.

{
Trace im_trace;
DataPoint data_point;
for(quint32 i = 0; i < m_scanNumber; i++)
{
data_point.x = i;
data_point.y = 0;
qDebug() << "m_scanNumber=" << m_scanNumber << " i=" << i;
std::vector<quint32> index_list = getScanIndexList(i);
auto it_lower = std::find_if(index_list.begin(),
index_list.end(),
[mz_index_lower_bound](quint32 to_compare) {
if(to_compare < mz_index_lower_bound)
{
return false;
}
return true;
});
if(it_lower == index_list.end())
{
}
else
{
auto it_upper =
std::find_if(index_list.begin(),
index_list.end(),
[mz_index_upper_bound](quint32 to_compare) {
if(mz_index_upper_bound >= to_compare)
{
return false;
}
return true;
});
std::vector<quint32> intensity_list = getScanIntensities(i);
for(int j = std::distance(index_list.begin(), it_lower);
j < std::distance(index_list.begin(), it_upper);
j++)
{
if(method == XicExtractMethod::sum)
{
data_point.y += intensity_list[j];
}
else
{
data_point.y =
std::max((double)intensity_list[j], data_point.y);
}
}
}
im_trace.push_back(data_point);
}
qDebug();
return im_trace;
}
pappso::TimsFrameBase::getScanIndexList
virtual std::vector< quint32 > getScanIndexList(std::size_t scanNum) const
get raw index list for one given scan index are not TOF nor m/z, just index on digitizer
Definition timsframebase.cpp:523
pappso::TimsFrameBase::getScanIntensities
virtual std::vector< quint32 > getScanIntensities(std::size_t scanNum) const
get raw intensities without transformation from one scan it needs intensity normalization
Definition timsframebase.cpp:533
pappso::XicExtractMethod::sum
@ sum
sum of intensities

References getScanIndexList(), getScanIntensities(), m_scanNumber, pappso::sum, pappso::DataPoint::x, and pappso::DataPoint::y.

## getMassSpectrumSPtr()

MassSpectrumSPtr pappso::TimsFrameBase::getMassSpectrumSPtr | ( | std::size_t | scanNum | ) | const

virtual

get Mass spectrum with peaks for this scan number need the binary file

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame, and pappso::TimsFrameType1.

Definition at line 132 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to getMassSpectrumSPtr in TimsFrameBase for scan number %1")
.arg(scanNum));
}

## getMaximumRawMassIndex()

quint32 pappso::TimsFrameBase::getMaximumRawMassIndex | ( |  | ) | const

virtual

get the maximum raw mass index contained in this frame

Definition at line 506 of file timsframebase.cpp.

{
quint32 max_value = 0;
for(quint32 i = 0; i < m_scanNumber; i++)
{
qDebug() << "m_scanNumber=" << m_scanNumber << " i=" << i;
std::vector<quint32> index_list = getScanIndexList(i);
auto it = std::max_element(index_list.begin(), index_list.end());
if(it != index_list.end())
{
max_value = std::max(max_value, *it);
}
}
return max_value;
}

References getScanIndexList(), and m_scanNumber.

## getMsLevel()

unsigned int pappso::TimsFrameBase::getMsLevel | ( |  | ) | const

Definition at line 221 of file timsframebase.cpp.

{
if(m_msMsType == 0)
return 1;
return 2;
}
pappso::TimsFrameBase::m_msMsType
quint8 m_msMsType
Definition timsframebase.h:285

References m_msMsType.

## getMzCalibrationInterfaceSPtr()

const MzCalibrationInterfaceSPtr & pappso::TimsFrameBase::getMzCalibrationInterfaceSPtr | ( |  | ) | const

final virtual

get the MzCalibration model to compute mz and TOF for this frame

Definition at line 473 of file timsframebase.cpp.

{
if(msp_mzCalibration == nullptr)
{
throw pappso::PappsoException(
QObject::tr("ERROR in %1, %2, %3 msp_mzCalibration is null")
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}
return msp_mzCalibration;
}
pappso::PappsoException
Definition pappsoexception.h:42
pappso::TimsFrameBase::msp_mzCalibration
MzCalibrationInterfaceSPtr msp_mzCalibration
Definition timsframebase.h:302

References msp_mzCalibration.

Referenced by pappso::TimsFrame::XicComputeStructure::XicComputeStructure(), pappso::TimsFrame::cumulateScansToTrace(), pappso::TimsFrame::cumulateScansToTraceMzDownResolution(), pappso::TimsFrame::cumulateScansToTraceMzDownResolution2(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), getTraceFromCumulatedScans(), and getTraceFromCumulatedScansBuiltinCentroid().

## getNbrPeaks()

std::size_t pappso::TimsFrameBase::getNbrPeaks | ( | std::size_t | scanNum | ) | const

virtual

get the number of peaks in this spectrum need the binary file

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame, and pappso::TimsFrameType1.

Definition at line 117 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to get number of peaks in TimsFrameBase for scan number %1")
.arg(scanNum));
}

## getOneOverK0Transformation()

double pappso::TimsFrameBase::getOneOverK0Transformation | ( | std::size_t | scanNum | ) | const

get 1/K0 value of a given scan (mobility value)

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Definition at line 299 of file timsframebase.cpp.

{
return 1 / (m_timsC6 + (m_timsC7 / getVoltageTransformation(scanNum)));
}
pappso::TimsFrameBase::getVoltageTransformation
double getVoltageTransformation(std::size_t scanNum) const
get voltage for a given scan number
Definition timsframebase.cpp:271
pappso::TimsFrameBase::m_timsC6
double m_timsC6
Definition timsframebase.h:299
pappso::TimsFrameBase::m_timsC7
double m_timsC7
Definition timsframebase.h:300

References getVoltageTransformation(), m_timsC6, and m_timsC7.

## getScanIndexList()

std::vector< quint32 > pappso::TimsFrameBase::getScanIndexList | ( | std::size_t | scanNum | ) | const

virtual

get raw index list for one given scan index are not TOF nor m/z, just index on digitizer

Reimplemented in pappso::TimsFrame, and pappso::TimsFrameType1.

Definition at line 523 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to getScanIndexList in TimsFrameBase for scan number %1")
.arg(scanNum));
}

Referenced by getIonMobilityTraceByMzIndexRange(), and getMaximumRawMassIndex().

## getScanIntensities()

std::vector< quint32 > pappso::TimsFrameBase::getScanIntensities | ( | std::size_t | scanNum | ) | const

virtual

get raw intensities without transformation from one scan it needs intensity normalization

Reimplemented in pappso::TimsFrame, and pappso::TimsFrameType1.

Definition at line 533 of file timsframebase.cpp.

{
throw PappsoException(
QObject::tr(
"ERROR unable to getScanIntensities in TimsFrameBase for scan number %1")
.arg(scanNum));
}

Referenced by getIonMobilityTraceByMzIndexRange().

## getScanNumFromOneOverK0()

std::size_t pappso::TimsFrameBase::getScanNumFromOneOverK0 | ( | double | one_over_k0 | ) | const

get the scan number from a given 1/Ko mobility value

Parameters

  one_over_k0 | the mobility value to tranform

Returns
  integer the scan number in the frame in the order it lies in binary file, from 0 to N-1

Definition at line 306 of file timsframebase.cpp.

{
double temp = 1 / one_over_k0;
temp = temp - m_timsC6;
temp = temp / m_timsC7;
temp = 1 / temp;
temp = temp - m_timsDvStart;
temp = temp / m_timsSlope + m_timsTtrans + m_timsNdelay;
return (std::size_t)std::round(temp);
}
pappso::TimsFrameBase::m_timsSlope
double m_timsSlope
Definition timsframebase.h:292
pappso::TimsFrameBase::m_timsNdelay
double m_timsNdelay
Definition timsframebase.h:296
pappso::TimsFrameBase::m_timsTtrans
double m_timsTtrans
Definition timsframebase.h:295
pappso::TimsFrameBase::m_timsDvStart
double m_timsDvStart
Definition timsframebase.h:291

References m_timsC6, m_timsC7, m_timsDvStart, m_timsNdelay, m_timsSlope, and m_timsTtrans.

## getTime()

double pappso::TimsFrameBase::getTime | ( |  | ) | const

Definition at line 229 of file timsframebase.cpp.

{
return m_time;
}
pappso::TimsFrameBase::m_time
double m_time
retention time
Definition timsframebase.h:289

References m_time.

## getTotalNumberOfScans()

std::size_t pappso::TimsFrameBase::getTotalNumberOfScans | ( |  | ) | const

virtual

get the number of scans contained in this frame each scan represents an ion mobility slice

Definition at line 126 of file timsframebase.cpp.

{
return m_scanNumber;
}

References m_scanNumber.

Referenced by pappso::BaseColorMapPlotWidget::addColorMap().

## getTraceFromCumulatedScans()

pappso::Trace pappso::TimsFrameBase::getTraceFromCumulatedScans | ( | std::map< quint32, quint32 > & | accumulated_scans | ) | const

transform accumulation of raw scans into a real mass spectrum

Definition at line 333 of file timsframebase.cpp.

{
qDebug();
// qDebug();
// add flanking peaks
pappso::Trace local_trace;
MzCalibrationInterface *mz_calibration_p =
getMzCalibrationInterfaceSPtr().get();
DataPoint element;
for(auto &scan_element : accumulated_scans)
{
// intensity normalization
element.y = ((double)scan_element.second) * 100.0 / m_accumulationTime;
// mz calibration
element.x = mz_calibration_p->getMzFromTofIndex(scan_element.first);
local_trace.push_back(element);
}
local_trace.sortX();
qDebug();
// qDebug();
return local_trace;
}
pappso::TimsFrameBase::getMzCalibrationInterfaceSPtr
virtual const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
Definition timsframebase.cpp:473
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
pappso::Trace::sortX
void sortX(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1086

References getMzCalibrationInterfaceSPtr(), pappso::MzCalibrationInterface::getMzFromTofIndex(), m_accumulationTime, pappso::Trace::sortX(), pappso::DataPoint::x, and pappso::DataPoint::y.

## getTraceFromCumulatedScansBuiltinCentroid()

pappso::Trace pappso::TimsFrameBase::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

Definition at line 364 of file timsframebase.cpp.

{
qDebug();
// qDebug();
// add flanking peaks
std::vector<quint32> keys;
transform(begin(accumulated_scans),
end(accumulated_scans),
back_inserter(keys),
[](std::map<quint32, quint32>::value_type const &pair) {
return pair.first;
});
std::sort(keys.begin(), keys.end());
pappso::DataPoint data_point_cumul;
data_point_cumul.x = 0;
data_point_cumul.y = 0;
pappso::Trace local_trace;
MzCalibrationInterface *mz_calibration_p =
getMzCalibrationInterfaceSPtr().get();
quint32 last_key = 0;
for(quint32 key : keys)
{
if(key == last_key + 1)
{
// cumulate
if(accumulated_scans[key] > accumulated_scans[last_key])
{
if(data_point_cumul.x == last_key)
{
// growing peak
data_point_cumul.x = key;
data_point_cumul.y += accumulated_scans[key];
}
else
{
// new peak
// flush
if(data_point_cumul.y > 0)
{
// intensity normalization
data_point_cumul.y *= 100.0 / m_accumulationTime;
// mz calibration
data_point_cumul.x =
mz_calibration_p->getMzFromTofIndex(data_point_cumul.x);
local_trace.push_back(data_point_cumul);
}
// new point
data_point_cumul.x = key;
data_point_cumul.y = accumulated_scans[key];
}
}
else
{
data_point_cumul.y += accumulated_scans[key];
}
}
else
{
// flush
if(data_point_cumul.y > 0)
{
// intensity normalization
data_point_cumul.y *= 100.0 / m_accumulationTime;
// qDebug() << "raw data x=" << data_point_cumul.x;
// mz calibration
data_point_cumul.x =
mz_calibration_p->getMzFromTofIndex(data_point_cumul.x);
// qDebug() << "mz=" << data_point_cumul.x;
local_trace.push_back(data_point_cumul);
}
// new point
data_point_cumul.x = key;
data_point_cumul.y = accumulated_scans[key];
}
last_key = key;
}
// flush
if(data_point_cumul.y > 0)
{
// intensity normalization
data_point_cumul.y *= 100.0 / m_accumulationTime;
// mz calibration
data_point_cumul.x =
mz_calibration_p->getMzFromTofIndex(data_point_cumul.x);
local_trace.push_back(data_point_cumul);
}
local_trace.sortX();
qDebug();
// qDebug();
return local_trace;
}
pappso::DataPoint
Definition datapoint.h:22
pappso::DataPoint::x
pappso_double x
Definition datapoint.h:23
pappso::DataPoint::y
pappso_double y
Definition datapoint.h:24

References getMzCalibrationInterfaceSPtr(), pappso::MzCalibrationInterface::getMzFromTofIndex(), m_accumulationTime, pappso::Trace::sortX(), pappso::DataPoint::x, and pappso::DataPoint::y.

## getVoltageTransformation()

double pappso::TimsFrameBase::getVoltageTransformation | ( | std::size_t | scanNum | ) | const

get voltage for a given scan number

Parameters

  scanNum | scan number in the frame in the order it lies in binary file, from 0 to N-1

Returns
  double volt measure

Definition at line 271 of file timsframebase.cpp.

{
double v = m_timsDvStart +
m_timsSlope * ((double)scanNum - m_timsTtrans - m_timsNdelay);
if(v < m_timsVmin)
{
throw pappso::PappsoException(
QObject::tr("ERROR in TimsFrame::getVoltageTransformation invalid tims "
"calibration, v < m_timsVmin"));
}
if(v > m_timsVmax)
{
throw pappso::PappsoException(
QObject::tr("ERROR in TimsFrame::getVoltageTransformation invalid tims "
"calibration, v > m_timsVmax"));
}
return v;
}
pappso::TimsFrameBase::m_timsVmax
double m_timsVmax
Definition timsframebase.h:298
pappso::TimsFrameBase::m_timsVmin
double m_timsVmin
Definition timsframebase.h:297

References m_timsDvStart, m_timsNdelay, m_timsSlope, m_timsTtrans, m_timsVmax, and m_timsVmin.

Referenced by getOneOverK0Transformation().

## hasSameCalibrationData()

bool pappso::TimsFrameBase::hasSameCalibrationData | ( | const TimsFrameBase & | other | ) | const

virtual

tells if 2 tims frame has the same calibration data Usefull to know if raw data can be handled between frames

Definition at line 318 of file timsframebase.cpp.

{
if((m_timsDvStart == other.m_timsDvStart) &&
(m_timsTtrans == other.m_timsTtrans) &&
(m_timsNdelay == other.m_timsNdelay) && (m_timsVmin == other.m_timsVmin) &&
(m_timsVmax == other.m_timsVmax) && (m_timsC6 == other.m_timsC6) &&
(m_timsC7 == other.m_timsC7) && (m_timsSlope == other.m_timsSlope))
{
return true;
}
return false;
}

References m_timsC6, m_timsC7, m_timsDvStart, m_timsNdelay, m_timsSlope, m_timsTtrans, m_timsVmax, and m_timsVmin.

## setAccumulationTime()

void pappso::TimsFrameBase::setAccumulationTime | ( | double | accumulation_time_ms | ) |

Definition at line 56 of file timsframebase.cpp.

{
m_accumulationTime = accumulation_time_ms;
}

References m_accumulationTime.

## setMsMsType()

void pappso::TimsFrameBase::setMsMsType | ( | quint8 | type | ) |

Definition at line 213 of file timsframebase.cpp.

{
qDebug() << " m_msMsType=" << type;
m_msMsType = type;
}

References m_msMsType.

## setMzCalibration()

void pappso::TimsFrameBase::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
| ) |  |

Definition at line 63 of file timsframebase.cpp.

{
/* MzCalibrationModel1 mzCalibration(temperature_correction,
digitizerTimebase,
digitizerDelay,
C0,
C1,
C2,
C3,
C4);
*/
msp_mzCalibration = std::make_shared<MzCalibrationModel1>(T1_frame,
T2_frame,
digitizerTimebase,
digitizerDelay,
C0,
C1,
C2,
C3,
C4,
T1_ref,
T2_ref,
dC1,
dC2);
}

References msp_mzCalibration.

## setMzCalibrationInterfaceSPtr()

void pappso::TimsFrameBase::setMzCalibrationInterfaceSPtr | ( | MzCalibrationInterfaceSPtr | mzCalibration | ) |

Definition at line 488 of file timsframebase.cpp.

{
if(mzCalibration == nullptr)
{
throw pappso::PappsoException(
QObject::tr("ERROR in %1, %2, %3 msp_mzCalibration is null")
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}
msp_mzCalibration = mzCalibration;
}

References msp_mzCalibration.

## setTime()

void pappso::TimsFrameBase::setTime | ( | double | time | ) |

Definition at line 207 of file timsframebase.cpp.

{
m_time = time;
}

References m_time.

## setTimsCalibration()

void pappso::TimsFrameBase::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
| ) |  |

Definition at line 240 of file timsframebase.cpp.

{
if(tims_model_type != 2)
{
throw pappso::PappsoException(QObject::tr(
"ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
}
m_timsDvStart = C2; // C2 from TimsCalibration
m_timsTtrans = C4; // C4 from TimsCalibration
m_timsNdelay = C0; // C0 from TimsCalibration
m_timsVmin = C8; // C8 from TimsCalibration
m_timsVmax = C9; // C9 from TimsCalibration
m_timsC6 = C6;
m_timsC7 = C7;
m_timsSlope =
(C3 - m_timsDvStart) / C1; // //C3 from TimsCalibration // C2 from
// TimsCalibration // C1 from TimsCalibration
}

References m_timsC6, m_timsC7, m_timsDvStart, m_timsNdelay, m_timsSlope, m_timsTtrans, m_timsVmax, and m_timsVmin.

## Member Data Documentation

## m_accumulationTime

double pappso::TimsFrameBase::m_accumulationTime = 0

protected

accumulation time in milliseconds

Definition at line 283 of file timsframebase.h.

Referenced by pappso::TimsFrame::cumulateScansToTrace(), pappso::TimsFrame::cumulateScansToTraceMzDownResolution(), pappso::TimsFrame::cumulateScansToTraceMzDownResolution2(), pappso::TimsFrame::cumulateSingleScanIntensities(), getDriftTime(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::TimsFrame::getRawTraceSPtr(), pappso::TimsFrameType1::getRawTraceSPtr(), getTraceFromCumulatedScans(), getTraceFromCumulatedScansBuiltinCentroid(), and setAccumulationTime().

## m_msMsType

quint8 pappso::TimsFrameBase::m_msMsType = 0

protected

Definition at line 285 of file timsframebase.h.

Referenced by getMsLevel(), and setMsMsType().

## m_scanNumber

quint32 pappso::TimsFrameBase::m_scanNumber

protected

total number of scans contained in this frame

Definition at line 273 of file timsframebase.h.

Referenced by pappso::TimsFrame::TimsFrame(), TimsFrameBase(), pappso::TimsFrameType1::TimsFrameType1(), checkScanNum(), pappso::TimsFrameType1::copyAndLzfDecompress(), pappso::TimsFrame::extractTimsXicListInRtRange(), getDriftTime(), getIonMobilityTraceByMzIndexRange(), getMaximumRawMassIndex(), pappso::TimsFrame::getNbrPeaks(), and getTotalNumberOfScans().

## m_time

double pappso::TimsFrameBase::m_time = 0

protected

retention time

Definition at line 289 of file timsframebase.h.

Referenced by pappso::TimsFrame::extractTimsXicListInRtRange(), getTime(), and setTime().

## m_timsC6

double pappso::TimsFrameBase::m_timsC6 = 0

protected

Definition at line 299 of file timsframebase.h.

Referenced by getOneOverK0Transformation(), getScanNumFromOneOverK0(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsC7

double pappso::TimsFrameBase::m_timsC7 = 0

protected

Definition at line 300 of file timsframebase.h.

Referenced by getOneOverK0Transformation(), getScanNumFromOneOverK0(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsDvStart

double pappso::TimsFrameBase::m_timsDvStart = 0

protected

Definition at line 291 of file timsframebase.h.

Referenced by getScanNumFromOneOverK0(), getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsId

std::size_t pappso::TimsFrameBase::m_timsId

protected

Tims frame database id (the SQL identifier of this frame)

Warning
  in sqlite, there is another field called TimsId : this is not that, because it is in fact an offset in bytes in the binary file.

Definition at line 279 of file timsframebase.h.

Referenced by pappso::TimsFrame::TimsFrame(), TimsFrameBase(), pappso::TimsFrameType1::TimsFrameType1(), getId(), and pappso::TimsFrameType1::lzfDecompressScan().

## m_timsNdelay

double pappso::TimsFrameBase::m_timsNdelay = 0

protected

Definition at line 296 of file timsframebase.h.

Referenced by getScanNumFromOneOverK0(), getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsSlope

double pappso::TimsFrameBase::m_timsSlope

protected

Initial value:
=
0

Definition at line 292 of file timsframebase.h.

Referenced by getScanNumFromOneOverK0(), getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsTtrans

double pappso::TimsFrameBase::m_timsTtrans = 0

protected

Definition at line 295 of file timsframebase.h.

Referenced by getScanNumFromOneOverK0(), getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsVmax

double pappso::TimsFrameBase::m_timsVmax = 0

protected

Definition at line 298 of file timsframebase.h.

Referenced by getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## m_timsVmin

double pappso::TimsFrameBase::m_timsVmin = 0

protected

Definition at line 297 of file timsframebase.h.

Referenced by getVoltageTransformation(), hasSameCalibrationData(), and setTimsCalibration().

## msp_mzCalibration

MzCalibrationInterfaceSPtr pappso::TimsFrameBase::msp_mzCalibration = nullptr

protected

Definition at line 302 of file timsframebase.h.

Referenced by getMzCalibrationInterfaceSPtr(), setMzCalibration(), and setMzCalibrationInterfaceSPtr().

The documentation for this class was generated from the following files:

- pappsomspp/vendors/tims/timsframebase.h
- pappsomspp/vendors/tims/timsframebase.cpp