libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::TimsFrameBase Class Reference

#include <timsframebase.h>

Inheritance diagram for pappso::TimsFrameBase:
pappso::TimsFrame pappso::TimsFrameType1

Classes

struct  TofIndexIntensityPair
 

Public Member Functions

 TimsFrameBase (std::size_t frameId, quint32 scanCount)
 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 getScanPeakCount (std::size_t scanIndex) 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 scan_index) const
 get Mass spectrum with peaks for this scan index need the binary file
 
virtual pappso::MassSpectrumCstSPtr getMassSpectrumCstSPtr (std::size_t scan_index) const final
 get the mass spectrum corresponding to a scan index
 
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 respect to the frame accumulation time
 
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 respect to the frame accumulation time to leverage computing performance, this function decreases the mz resolution
 
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 respect to the frame accumulation time to leverage computing performance, this function decreases the mz resolution
 
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
 
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 respect to the frame accumulation time
 
virtual void combineScansInTofIndexIntensityMap (TimsDataFastMap &tof_index_intensity_map, std::size_t scan_index_begin, std::size_t scan_index_end, quint32 tof_index_begin, quint32 tof_index_end) 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 cumulateScanIntensities (std::size_t scan_index) const
 
virtual quint64 cumulateScanRangeIntensities (std::size_t scan_index_begin, std::size_t scan_index_end) const
 
bool checkScanNum (std::size_t scanNum) const
 check that this scan number exists
 
void setAcqDurationInMilliseconds (double acquisition_duration_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 setRtInSeconds (double time)
 
void setMsMsType (quint8 type)
 
unsigned int getMsLevel () const
 
double getRtInSeconds () const
 
std::size_t getId () const
 
double getDriftTimeInMilliseconds (std::size_t scan_index) const
 get drift time of a scan number in milliseconds
 
double getOneOverK0Transformation (std::size_t scan_index) const
 get 1/K0 value of a given scan (mobility value)
 
std::size_t getScanIndexFromOneOverK0 (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 getTraceFromTofIndexIntensityMap (TimsDataFastMap &accumulated_scans) const
 transform accumulation of raw scans into a real mass spectrum
 
virtual const MzCalibrationInterfaceSPtrgetMzCalibrationInterfaceSPtr () const final
 get the MzCalibration model to compute mz and TOF for this frame
 
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
 
virtual Trace getIonMobilityTraceByTofIndexRange (std::size_t tof_index_begin, std::size_t tof_index_end, 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
 

Protected Member Functions

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.
 

Protected Attributes

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)
 
double m_acqDurationInMilliseconds = 0
 acquisition duration in milliseconds
 
quint8 m_msMsType = 0
 
double m_rtInSeconds = 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 48 of file timsframebase.h.

Constructor & Destructor Documentation

◆ TimsFrameBase() [1/2]

pappso::TimsFrameBase::TimsFrameBase ( std::size_t frameId,
quint32 scanCount )

constructor for binary independant tims frame

Parameters
timsIdtims frame identifier in the database
scanCountthe number of scans in this frame

Definition at line 39 of file timsframebase.cpp.

40{
41 qDebug() << frame_id;
42 m_frameId = frame_id;
43
44 m_scanCount = scanCount;
45}
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)

References m_frameId, and m_scanCount.

◆ TimsFrameBase() [2/2]

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

Copy constructor

Parameters
otherTODO

Definition at line 47 of file timsframebase.cpp.

48{
49}

◆ ~TimsFrameBase()

pappso::TimsFrameBase::~TimsFrameBase ( )
virtual

Destructor

Definition at line 51 of file timsframebase.cpp.

52{
53}

Member Function Documentation

◆ checkScanNum()

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

check that this scan number exists

Parameters
scanNumscan 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.

104{
105 if(scanNum >= m_scanCount)
106 {
108 QObject::tr("Invalid scan number : scanNum %1 > m_scanNumber %2")
109 .arg(scanNum)
110 .arg(m_scanCount));
111 }
112
113 return true;
114}

References m_scanCount.

Referenced by pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::TimsFrame::getScanIntensityList(), pappso::TimsFrameType1::getScanIntensityList(), pappso::TimsFrame::getScanPeakCount(), pappso::TimsFrame::getScanTofIndexList(), and pappso::TimsFrameType1::getScanTofIndexList().

◆ combineScansInTofIndexIntensityMap() [1/2]

void pappso::TimsFrameBase::combineScansInTofIndexIntensityMap ( TimsDataFastMap & tof_index_intensity_map,
std::size_t scan_index_begin,
std::size_t scan_index_end ) 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
tof_index_intensity_mapsimple map of integers to cumulate raw counts
scan_index_beginscan index in the frame in the order it lies in binary file, from 0 to N-1
scan_index_endscan index in the frame in the order it lies in binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame.

Definition at line 206 of file timsframebase.cpp.

210{
211 throw PappsoException(
212 QObject::tr(
213 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
214 "number begin %1 end %2")
215 .arg(scanNumBegin)
216 .arg(scanNumEnd));
217}

◆ combineScansInTofIndexIntensityMap() [2/2]

void pappso::TimsFrameBase::combineScansInTofIndexIntensityMap ( TimsDataFastMap & tof_index_intensity_map,
std::size_t scan_index_begin,
std::size_t scan_index_end,
quint32 tof_index_begin,
quint32 tof_index_end ) 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
tof_index_intensity_mapsimple map of integers to cumulate raw counts
scan_index_beginscan index in the frame in the order it lies in binary file, from 0 to N-1
scan_index_endscan index in the frame in the order it lies in binary file, from 0 to N-1
tof_index_begin
tof_index_end

Reimplemented in pappso::TimsFrame.

Definition at line 221 of file timsframebase.cpp.

227{
228 throw PappsoException(
229 QObject::tr(
230 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
231 "number begin %1 end %2, tof index begin %3, tof index end %4")
232 .arg(scanNumBegin)
233 .arg(scanNumEnd)
234 .arg(tof_index_begin)
235 .arg(tof_index_end));
236}

◆ combineScansToTraceWithDowngradedMzResolution()

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

cumulate spectrum given a scan index 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
tof_index_merge_windowwidth of the TOF index window used to merge all intensities into a single point. This results in faster computing.
scanIndexBeginscan index in the frame in the order it lies in binary file, from 0 to N-1
scanIndexEndscan index in the frame in the order it lies in binary file, from 0 to N-1
minimum_tof_index_outreport the minimum mz index contained in the resulting trace
maximum_tof_index_outreport the maximum mz index contained in the resulting trace

Reimplemented in pappso::TimsFrame.

Definition at line 160 of file timsframebase.cpp.

166{
167 throw PappsoException(QObject::tr("Non implemented function %1 %2 %3")
168 .arg(__FILE__)
169 .arg(__FUNCTION__)
170 .arg(__LINE__));
171}

◆ combineScansToTraceWithDowngradedMzResolution2()

Trace pappso::TimsFrameBase::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
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_windowwidth of the mzindex window used to merge all intensities into a single point. This results in faster computing.
mz_range_begin
mz_range_end
scanNumBeginscan number in the frame in the order it lies in binary file, from 0 to N-1
scanNumEndscan number in the frame in the order it lies in binary file, from 0 to N-1
mz_minimum_indexreport the minimum mz index contained in the resulting trace (constrained by the mz_range_begin)
mz_maximum_indexreport the maximum mz index contained in the resulting trace (constrained by the mz_range_end)

Reimplemented in pappso::TimsFrame.

Definition at line 174 of file timsframebase.cpp.

182{
183 throw PappsoException(QObject::tr("Non implemented function %1 %2 %3")
184 .arg(__FILE__)
185 .arg(__FUNCTION__)
186 .arg(__LINE__));
187}

◆ cumulateScanIntensities()

quint64 pappso::TimsFrameBase::cumulateScanIntensities ( std::size_t scan_index) const
virtual

Reimplemented in pappso::TimsFrame.

Definition at line 239 of file timsframebase.cpp.

240{
241 throw PappsoException(
242 QObject::tr(
243 "ERROR unable to cumulateSingleScanIntensities in TimsFrameBase for scan "
244 "number %1.")
245 .arg(scanNum));
246
247 return 0;
248}

◆ cumulateScanRangeIntensities()

quint64 pappso::TimsFrameBase::cumulateScanRangeIntensities ( std::size_t scan_index_begin,
std::size_t scan_index_end ) const
virtual

Reimplemented in pappso::TimsFrame.

Definition at line 252 of file timsframebase.cpp.

254{
255 throw PappsoException(
256 QObject::tr(
257 "ERROR unable to cumulateScansInRawMap in TimsFrameBase for scan "
258 "number begin %1 end %2")
259 .arg(scanNumBegin)
260 .arg(scanNumEnd));
261
262 return 0;
263}

◆ cumulateScansToTrace()

Trace pappso::TimsFrameBase::cumulateScansToTrace ( std::size_t scanIndexBegin,
std::size_t scanIndexEnd ) 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
scanIndexBeginscan index in the frame in the order it lies in the frame in the binary file, from 0 to N-1
scanIndexEndscan number in the frame in the order it lies in the frame in the binary file, from 0 to N-1

Reimplemented in pappso::TimsFrame.

Definition at line 149 of file timsframebase.cpp.

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

◆ downgradeResolutionOfTofIndexIntensityPairList()

std::vector< TimsFrameBase::TofIndexIntensityPair > & pappso::TimsFrameBase::downgradeResolutionOfTofIndexIntensityPairList ( std::size_t tof_index_merge_window,
std::vector< TofIndexIntensityPair > & spectrum ) const
protectedvirtual

Downgrade the TOF index resolution to lower the number of real m/z computations.

This function merges together into a single TOF index bin all the TOF

indices contained in the tof_index_merge_window. Then the window is shifted and the operation is performed again. When all the list of \l{TofIndexIntensityPair}s has been gone through, the resolution of the data has effectively been downgrade by a factor corresponding to tof_index_merge_window.

 @param tof_index_merge_window width of the TOF index window used to merge

all intensities into a single point. This results in faster computing.

Parameters
rawSpectrumthe spectrum to shrink

Definition at line 566 of file timsframebase.cpp.

569{
570
571 qDebug() << rawSpectrum.size();
572 std::vector<TimsFrameBase::TofIndexIntensityPair> new_spectrum;
573
574 TimsFrameBase::TofIndexIntensityPair current_point;
575 current_point.intensity_index = 0;
576 current_point.tof_index = 0;
577 for(auto &pair_mz_intensity : rawSpectrum)
578 {
579 quint32 mzkey = (pair_mz_intensity.tof_index / mzindex_merge_window);
580 mzkey = (mzkey * mzindex_merge_window) + (mzindex_merge_window / 2);
581
582 if(current_point.tof_index != mzkey)
583 {
584 if(current_point.tof_index > 0)
585 {
586 new_spectrum.push_back(current_point);
587 }
588
589 current_point.intensity_index = pair_mz_intensity.intensity_index;
590 current_point.tof_index = mzkey;
591 }
592 else
593 {
594 current_point.intensity_index += pair_mz_intensity.intensity_index;
595 }
596 }
597
598 if(current_point.tof_index > 0)
599 {
600 new_spectrum.push_back(current_point);
601 }
602 rawSpectrum = new_spectrum;
603 qDebug() << rawSpectrum.size();
604 return rawSpectrum;
605}

References pappso::TimsFrameBase::TofIndexIntensityPair::intensity_index, and pappso::TimsFrameBase::TofIndexIntensityPair::tof_index.

Referenced by pappso::TimsFrame::getMobilityScan().

◆ getDriftTimeInMilliseconds()

double pappso::TimsFrameBase::getDriftTimeInMilliseconds ( std::size_t scan_index) const

get drift time of a scan number in milliseconds

Parameters
scanNumscan 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 356 of file timsframebase.cpp.

357{
358 return (m_acqDurationInMilliseconds / (double)m_scanCount) *
359 ((double)scanNum);
360}
double m_acqDurationInMilliseconds
acquisition duration in milliseconds

References m_acqDurationInMilliseconds, and m_scanCount.

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), and pappso::TimsMsRunReader::readSpectrumCollection2().

◆ getId()

◆ getIonMobilityTraceByTofIndexRange()

Trace pappso::TimsFrameBase::getIonMobilityTraceByTofIndexRange ( std::size_t tof_index_begin,
std::size_t tof_index_end,
XicExtractMethod method,
std::size_t scan_index_begin,
std::size_t scan_index_end ) const
virtual

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

Parameters
tof_index_beginraw mass index lower bound
tof_index_endraw mass index upper bound
methodmax or sum intensities
scan_index_beginfirst mobility scan to integrate
scan_index_endlast mobility scan to integrate

Definition at line 498 of file timsframebase.cpp.

504{
505 Trace im_trace;
506 DataPoint data_point;
507 if(scan_index_end > m_scanCount)
508 scan_index_end = m_scanCount;
509 for(quint32 i = scan_index_begin; i < (scan_index_end + 1); i++)
510 {
511 data_point.x = i;
512 data_point.y = 0;
513 qDebug() << "m_scanNumber=" << m_scanCount << " i=" << i;
514 std::vector<quint32> index_list = getScanTofIndexList(i);
515 auto it_lower = std::find_if(index_list.begin(),
516 index_list.end(),
517 [tof_index_begin](quint32 to_compare) {
518 if(to_compare < tof_index_begin)
519 {
520 return false;
521 }
522 return true;
523 });
524
525
526 if(it_lower == index_list.end())
527 {
528 }
529 else
530 {
531
532
533 auto it_upper = std::find_if(index_list.begin(),
534 index_list.end(),
535 [tof_index_end](quint32 to_compare) {
536 if(tof_index_end >= to_compare)
537 {
538 return false;
539 }
540 return true;
541 });
542 std::vector<quint32> intensity_list = getScanIntensityList(i);
543 for(int j = std::distance(index_list.begin(), it_lower);
544 j < std::distance(index_list.begin(), it_upper);
545 j++)
546 {
547 if(method == XicExtractMethod::sum)
548 {
549 data_point.y += intensity_list[j];
550 }
551 else
552 {
553 data_point.y =
554 std::max((double)intensity_list[j], data_point.y);
555 }
556 }
557 }
558 im_trace.push_back(data_point);
559 }
560 qDebug();
561 return im_trace;
562}
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
@ sum
sum of intensities

References getScanIntensityList(), getScanTofIndexList(), m_scanCount, pappso::sum, pappso::DataPoint::x, and pappso::DataPoint::y.

◆ getMassSpectrumCstSPtr()

pappso::MassSpectrumCstSPtr pappso::TimsFrameBase::getMassSpectrumCstSPtr ( std::size_t scan_index) const
finalvirtual

get the mass spectrum corresponding to a scan index

Parameters
scan_indexthe scan index of the mass spectrum to retrieve

Definition at line 142 of file timsframebase.cpp.

143{
144 // qDebug();
145
146 return getMassSpectrumSPtr(scanNum);
147}
virtual MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scan_index) const
get Mass spectrum with peaks for this scan index need the binary file

References getMassSpectrumSPtr().

◆ getMassSpectrumSPtr()

MassSpectrumSPtr pappso::TimsFrameBase::getMassSpectrumSPtr ( std::size_t scan_index) const
virtual

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

Parameters
scan_indexscan index in the frame in the order it lies in binary file, from 0 to N-1 (this is the mobility index)

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

Definition at line 132 of file timsframebase.cpp.

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

Referenced by getMassSpectrumCstSPtr().

◆ getMaximumRawMassIndex()

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

get the maximum raw mass index contained in this frame

Definition at line 462 of file timsframebase.cpp.

463{
464 quint32 max_value = 0;
465 for(quint32 i = 0; i < m_scanCount; i++)
466 {
467 qDebug() << "m_scanNumber=" << m_scanCount << " i=" << i;
468 std::vector<quint32> index_list = getScanTofIndexList(i);
469 auto it = std::max_element(index_list.begin(), index_list.end());
470 if(it != index_list.end())
471 {
472 max_value = std::max(max_value, *it);
473 }
474 }
475 return max_value;
476}

References getScanTofIndexList(), and m_scanCount.

◆ getMobilityScan()

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

get a single mobility scan m/z + intensities

Parameters
scanIndexscan number in the frame in the order it lies in binary file, from 0 to N-1
tof_index_merge_windowwidth of the TOF index window used to merge all intensities into a single point. This results in faster computing.
mz_range_begin
mz_range_end
mz_minimum_indexreport the minimum mz index contained in the resulting trace (constrained by the mz_range_begin)
mz_maximum_indexreport the maximum mz index contained in the resulting trace (constrained by the mz_range_end)

Reimplemented in pappso::TimsFrame.

Definition at line 190 of file timsframebase.cpp.

198{
199 throw PappsoException(QObject::tr("Non implemented function %1 %2 %3")
200 .arg(__FILE__)
201 .arg(__FUNCTION__)
202 .arg(__LINE__));
203}

◆ getMsLevel()

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

◆ getMzCalibrationInterfaceSPtr()

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

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

Definition at line 429 of file timsframebase.cpp.

430{
431 if(msp_mzCalibration == nullptr)
432 {
433
435 QObject::tr("ERROR in %1, %2, %3 msp_mzCalibration is null")
436 .arg(__FILE__)
437 .arg(__FUNCTION__)
438 .arg(__LINE__));
439 }
440 return msp_mzCalibration;
441}
MzCalibrationInterfaceSPtr msp_mzCalibration

References msp_mzCalibration.

Referenced by pappso::TimsFrame::XicComputeStructure::XicComputeStructure(), pappso::TimsFrame::combineScansToTraceWithDowngradedMzResolution(), pappso::TimsFrame::combineScansToTraceWithDowngradedMzResolution2(), pappso::TimsFrame::cumulateScansToTrace(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), and getTraceFromTofIndexIntensityMap().

◆ getOneOverK0Transformation()

double pappso::TimsFrameBase::getOneOverK0Transformation ( std::size_t scan_index) const

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

Parameters
scanNumscan number in the frame in the order it lies in binary file, from 0 to N-1

Definition at line 363 of file timsframebase.cpp.

364{
365 return 1 / (m_timsC6 + (m_timsC7 / getVoltageTransformation(scanNum)));
366}
double getVoltageTransformation(std::size_t scanNum) const
get voltage for a given scan number

References getVoltageTransformation(), m_timsC6, and m_timsC7.

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), and pappso::TimsMsRunReader::readSpectrumCollection2().

◆ getRtInSeconds()

◆ getScanIndexFromOneOverK0()

std::size_t pappso::TimsFrameBase::getScanIndexFromOneOverK0 ( double one_over_k0) const

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

Parameters
one_over_k0the 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 370 of file timsframebase.cpp.

371{
372 double temp = 1 / one_over_k0;
373 temp = temp - m_timsC6;
374 temp = temp / m_timsC7;
375 temp = 1 / temp;
376 temp = temp - m_timsDvStart;
377 temp = temp / m_timsSlope + m_timsTtrans + m_timsNdelay;
378 return (std::size_t)std::round(temp);
379}

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

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), and pappso::TimsMsRunReader::readSpectrumCollection2().

◆ getScanIntensityList()

std::vector< quint32 > pappso::TimsFrameBase::getScanIntensityList ( std::size_t scan_index) const
virtual

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

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

Definition at line 489 of file timsframebase.cpp.

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

Referenced by getIonMobilityTraceByTofIndexRange().

◆ getScanPeakCount()

std::size_t pappso::TimsFrameBase::getScanPeakCount ( std::size_t scanIndex) const
virtual

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

Parameters
scanIndexscan index in the frame in the order it lies in frame's binary data, from 0 to N-1

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

Definition at line 117 of file timsframebase.cpp.

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

◆ getScanTofIndexList()

std::vector< quint32 > pappso::TimsFrameBase::getScanTofIndexList ( std::size_t scan_index) 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 479 of file timsframebase.cpp.

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

Referenced by getIonMobilityTraceByTofIndexRange(), and getMaximumRawMassIndex().

◆ 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.

127{
128 return m_scanCount;
129}

References m_scanCount.

Referenced by pappso::BaseColorMapPlotWidget::addColorMap(), pappso::TimsFramesMsRunReader::computeTicChromatogram(), pappso::TimsFramesMsRunReader::readSpectrumCollection2(), and pappso::TimsMsRunReader::readSpectrumCollection2().

◆ getTraceFromTofIndexIntensityMap()

pappso::Trace pappso::TimsFrameBase::getTraceFromTofIndexIntensityMap ( TimsDataFastMap & accumulated_scans) const

transform accumulation of raw scans into a real mass spectrum

Definition at line 397 of file timsframebase.cpp.

399{
400 qDebug();
401 // qDebug();
402 // add flanking peaks
403 pappso::Trace local_trace;
404
405 MzCalibrationInterface *mz_calibration_p =
407
408
409 DataPoint element;
410 for(quint32 tof_index : accumulated_scans.getTofIndexList())
411 {
412 // intensity normalization
413 element.y = ((double)accumulated_scans.readIntensity(tof_index)) * 100.0 /
415
416 // mz calibration
417 element.x = mz_calibration_p->getMzFromTofIndex(tof_index);
418
419 local_trace.push_back(element);
420 }
421 local_trace.sortX();
422
423 qDebug();
424 // qDebug();
425 return local_trace;
426}
virtual const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
A simple container of DataPoint instances.
Definition trace.h:148
void sortX(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1086

References getMzCalibrationInterfaceSPtr(), pappso::MzCalibrationInterface::getMzFromTofIndex(), pappso::TimsDataFastMap::getTofIndexList(), m_acqDurationInMilliseconds, pappso::TimsDataFastMap::readIntensity(), 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
scanNumscan number in the frame in the order it lies in binary file, from 0 to N-1
Returns
double volt measure

Definition at line 330 of file timsframebase.cpp.

331{
332 double v = m_timsDvStart +
333 m_timsSlope * ((double)scanNum - m_timsTtrans - m_timsNdelay);
334
335 if(v < m_timsVmin)
336 {
338 QObject::tr("ERROR in TimsFrame::getVoltageTransformation invalid tims "
339 "calibration, v < m_timsVmin %1 < %2")
340 .arg(v)
341 .arg(m_timsVmin));
342 }
343
344
345 if(v > m_timsVmax)
346 {
348 QObject::tr("ERROR in TimsFrame::getVoltageTransformation invalid tims "
349 "calibration, v > m_timsVmax %1 > %2")
350 .arg(v)
351 .arg(m_timsVmax));
352 }
353 return v;
354}

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 382 of file timsframebase.cpp.

383{
384 if((m_timsDvStart == other.m_timsDvStart) &&
385 (m_timsTtrans == other.m_timsTtrans) &&
386 (m_timsNdelay == other.m_timsNdelay) && (m_timsVmin == other.m_timsVmin) &&
387 (m_timsVmax == other.m_timsVmax) && (m_timsC6 == other.m_timsC6) &&
388 (m_timsC7 == other.m_timsC7) && (m_timsSlope == other.m_timsSlope))
389 {
390 return true;
391 }
392 return false;
393}

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

◆ setAcqDurationInMilliseconds()

void pappso::TimsFrameBase::setAcqDurationInMilliseconds ( double acquisition_duration_ms)

Definition at line 56 of file timsframebase.cpp.

57{
58 m_acqDurationInMilliseconds = acquisition_duration_ms;
59}

References m_acqDurationInMilliseconds.

◆ setMsMsType()

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

Definition at line 272 of file timsframebase.cpp.

273{
274
275 qDebug() << " m_msMsType=" << type;
276 m_msMsType = type;
277}

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.

76{
77
78 /* MzCalibrationModel1 mzCalibration(temperature_correction,
79 digitizerTimebase,
80 digitizerDelay,
81 C0,
82 C1,
83 C2,
84 C3,
85 C4);
86 */
87 msp_mzCalibration = std::make_shared<MzCalibrationModel1>(T1_frame,
88 T2_frame,
89 digitizerTimebase,
90 digitizerDelay,
91 C0,
92 C1,
93 C2,
94 C3,
95 C4,
96 T1_ref,
97 T2_ref,
98 dC1,
99 dC2);
100}

References msp_mzCalibration.

◆ setMzCalibrationInterfaceSPtr()

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

Definition at line 444 of file timsframebase.cpp.

446{
447
448 if(mzCalibration == nullptr)
449 {
450
452 QObject::tr("ERROR in %1, %2, %3 msp_mzCalibration is null")
453 .arg(__FILE__)
454 .arg(__FUNCTION__)
455 .arg(__LINE__));
456 }
457 msp_mzCalibration = mzCalibration;
458}

References msp_mzCalibration.

◆ setRtInSeconds()

void pappso::TimsFrameBase::setRtInSeconds ( double time)

Definition at line 266 of file timsframebase.cpp.

267{
268 m_rtInSeconds = time;
269}

References m_rtInSeconds.

◆ 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 299 of file timsframebase.cpp.

310{
311 if(tims_model_type != 2)
312 {
313 throw pappso::PappsoException(QObject::tr(
314 "ERROR in TimsFrame::setTimsCalibration tims_model_type != 2"));
315 }
316 m_timsDvStart = C2; // C2 from TimsCalibration
317 m_timsTtrans = C4; // C4 from TimsCalibration
318 m_timsNdelay = C0; // C0 from TimsCalibration
319 m_timsVmin = C8; // C8 from TimsCalibration
320 m_timsVmax = C9; // C9 from TimsCalibration
321 m_timsC6 = C6;
322 m_timsC7 = C7;
323
324
326 (C3 - m_timsDvStart) / C1; // //C3 from TimsCalibration // C2 from
327 // TimsCalibration // C1 from TimsCalibration
328}

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

Member Data Documentation

◆ m_acqDurationInMilliseconds

◆ m_frameId

std::size_t pappso::TimsFrameBase::m_frameId
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 389 of file timsframebase.h.

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

◆ m_msMsType

quint8 pappso::TimsFrameBase::m_msMsType = 0
protected

Definition at line 395 of file timsframebase.h.

Referenced by getMsLevel(), and setMsMsType().

◆ m_rtInSeconds

double pappso::TimsFrameBase::m_rtInSeconds = 0
protected

retention time

Definition at line 399 of file timsframebase.h.

Referenced by pappso::TimsFrame::extractTimsXicListInRtRange(), getRtInSeconds(), and setRtInSeconds().

◆ m_scanCount

◆ m_timsC6

double pappso::TimsFrameBase::m_timsC6 = 0
protected

◆ m_timsC7

double pappso::TimsFrameBase::m_timsC7 = 0
protected

◆ m_timsDvStart

double pappso::TimsFrameBase::m_timsDvStart = 0
protected

◆ m_timsNdelay

double pappso::TimsFrameBase::m_timsNdelay = 0
protected

◆ m_timsSlope

double pappso::TimsFrameBase::m_timsSlope
protected

◆ m_timsTtrans

double pappso::TimsFrameBase::m_timsTtrans = 0
protected

◆ m_timsVmax

double pappso::TimsFrameBase::m_timsVmax = 0
protected

◆ m_timsVmin

double pappso::TimsFrameBase::m_timsVmin = 0
protected

◆ msp_mzCalibration

MzCalibrationInterfaceSPtr pappso::TimsFrameBase::msp_mzCalibration = nullptr
protected

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