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

#include <timsframetype1.h>

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

Public Member Functions

 TimsFrameType1 (std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
 
 TimsFrameType1 (const TimsFrameType1 &other)
 
virtual ~TimsFrameType1 ()
 
virtual std::size_t getNbrPeaks (std::size_t scanNum) const override
 get the number of peaks in this spectrum need the binary file
 
virtual std::vector< quint32 > getScanIndexList (std::size_t scanNum) const override
 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 override
 get raw intensities without transformation from one scan it needs intensity normalization
 
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr (std::size_t scanNum) const override
 get the mass spectrum corresponding to a scan number
 
- Public Member Functions inherited from pappso::TimsFrame
 TimsFrame (std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
 
 TimsFrame (const TimsFrame &other)
 
virtual ~TimsFrame ()
 
virtual Trace cumulateScansToTrace (std::size_t scanNumBegin, std::size_t scanNumEnd) const override
 cumulate scan list into a trace
 
virtual Trace cumulateScansToTraceMzDownResolution (std::size_t mzindex_merge_window, std::size_t scanNumBegin, std::size_t scanNumEnd, quint32 &mz_minimum_index, quint32 &mz_maximum_index) const override
 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 cumulateScansToTraceMzDownResolution2 (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 override
 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 void cumulateScansInRawMap (std::map< quint32, quint32 > &rawSpectrum, std::size_t scanNumBegin, std::size_t scanNumEnd) const override
 cumulate scan list into a trace into a raw spectrum map
 
virtual Trace getMobilityScan (std::size_t scanNum, std::size_t mz_index_merge_window, double mz_range_begin, double mz_range_end, quint32 &mz_minimum_index_out, quint32 &mz_maximum_index_out) const override
 get a single mobility scan m/z + intensities
 
virtual quint64 cumulateSingleScanIntensities (std::size_t scanNum) const override
 
virtual quint64 cumulateScansIntensities (std::size_t scanNumBegin, std::size_t scanNumEnd) const override
 ...
 
- Public Member Functions inherited from pappso::TimsFrameBase
 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 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 pappso::MassSpectrumCstSPtr getMassSpectrumCstSPtr (std::size_t scanNum) const final
 get the mass spectrum corresponding to a scan number
 
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 MzCalibrationInterfaceSPtrgetMzCalibrationInterfaceSPtr () const final
 get the MzCalibration model to compute mz and TOF for this frame
 
void setMzCalibrationInterfaceSPtr (MzCalibrationInterfaceSPtr mzCalibration)
 
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 Member Functions

virtual void cumulateScan (std::size_t scanNum, std::map< quint32, quint32 > &accumulate_into) const override
 cumulate a scan into a map
 
virtual void cumulateScan2 (std::size_t scanNum, std::map< quint32, quint32 > &accumulate_into, quint32 accepted_tof_index_range_begin, quint32 accepted_tof_index_range_end) const override
 
virtual pappso::TraceSPtr getRawTraceSPtr (std::size_t scanNum) const override
 get the raw index tof_index and intensities (normalized)
 
virtual std::vector< RawValuePairgetRawValuePairList (std::size_t scanNum, quint32 accepted_tof_index_range_begin, quint32 accepted_tof_index_range_end) const override
 get the raw index tof_index and intensities (normalized)
 
- Protected Member Functions inherited from pappso::TimsFrame
 TimsFrame (std::size_t timsId, quint32 scanNum)
 constructor for binary independant tims frame
 
void extractTimsXicListInRtRange (std::vector< XicCoordTims * >::iterator &itXicListbegin, std::vector< XicCoordTims * >::iterator &itXicListend, XicExtractMethod method) const
 
- Protected Member Functions inherited from pappso::TimsFrameBase
virtual 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 std::vector< RawValuePair > & downsizeMzRawValuePairList (std::size_t mzindex_merge_window, std::vector< RawValuePair > &spectrum) const
 downsize mz resolution to lower the number of real mz computations
 

Private Member Functions

void copyAndLzfDecompress (const char *src, std::size_t len)
 copy buffer header and lzf decompress each scan for tims compression type 1
 
unsigned int lzfDecompressScan (const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
 decompress a single LZF compressed scan buffer
 

Private Attributes

std::vector< std::size_t > m_scanOffsetList
 
std::vector< std::size_t > m_scanSizeList
 

Additional Inherited Members

- Protected Attributes inherited from pappso::TimsFrame
QByteArray m_timsDataFrame
 
- Protected Attributes inherited from pappso::TimsFrameBase
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 37 of file timsframetype1.h.

Constructor & Destructor Documentation

◆ TimsFrameType1() [1/2]

pappso::TimsFrameType1::TimsFrameType1 ( std::size_t  timsId,
quint32  scanNum,
char *  p_bytes,
std::size_t  len 
)
Parameters
timsIdtims frame id
scanNumtotal number of scans in this frame
p_bytespointer on the decompressed binary buffer
lensize of the decompressed binary buffer

Definition at line 41 of file timsframetype1.cpp.

45 : TimsFrame(timsId, scanNum)
46{
47 qDebug() << timsId;
48 m_timsDataFrame.resize(len * 2);
49
50 if(p_bytes != nullptr)
51 {
52 qDebug() << timsId;
53 copyAndLzfDecompress(p_bytes, len);
54 qDebug() << timsId;
55 }
56 else
57 {
58 if(m_scanNumber == 0)
59 {
60
62 QObject::tr(
63 "TimsFrameType1::TimsFrameType1(%1,%2,nullptr,%3) FAILED")
64 .arg(m_timsId)
65 .arg(m_scanNumber)
66 .arg(len));
67 }
68 }
69}
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)
void copyAndLzfDecompress(const char *src, std::size_t len)
copy buffer header and lzf decompress each scan for tims compression type 1
QByteArray m_timsDataFrame
Definition timsframe.h:279
TimsFrame(std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
Definition timsframe.cpp:61

References copyAndLzfDecompress(), pappso::TimsFrameBase::m_scanNumber, pappso::TimsFrame::m_timsDataFrame, and pappso::TimsFrameBase::m_timsId.

◆ TimsFrameType1() [2/2]

pappso::TimsFrameType1::TimsFrameType1 ( const TimsFrameType1 other)

Copy constructor

Parameters
otherTODO

Definition at line 71 of file timsframetype1.cpp.

71 : TimsFrame(other)
72{
73}

◆ ~TimsFrameType1()

pappso::TimsFrameType1::~TimsFrameType1 ( )
virtual

Destructor

Definition at line 75 of file timsframetype1.cpp.

76{
77}

Member Function Documentation

◆ copyAndLzfDecompress()

void pappso::TimsFrameType1::copyAndLzfDecompress ( const char *  src,
std::size_t  len 
)
private

copy buffer header and lzf decompress each scan for tims compression type 1

Parameters
srcraw data buffer containing scan offsets and LZF compressed scans
lenlength of the data buffer

Definition at line 81 of file timsframetype1.cpp.

82{
83
84 qDebug() << " m_scanNumber=" << m_scanNumber << " len=" << len;
85 // the start position offset for each scan and the length of the last scan
86 // copy first m_scanNumber*4 bytes in qbyte array
87 std::size_t count = (m_scanNumber + 2) * 4;
88
89 qDebug() << " count=" << count;
90 if(m_timsDataFrame.size() < (long)(count + count))
91 {
92 qDebug() << " m_timsDataFrame.size()=" << m_timsDataFrame.size();
93 m_timsDataFrame.resize(count + count);
94 }
95
96 /*
97 std::size_t decompressed_size =
98 lzfDecompressScan(src + 3687 - 8,
99 9,
100 m_timsDataFrame.data() + 3660,
101 m_timsDataFrame.size() - 3660);
102
103 qDebug() << "decompressed_size=" << decompressed_size;
104 */
105 // memcpy(m_timsDataFrame.data(), src, count);
106
107 qDebug() << "offset begin at last :" << count + 4;
108
109 // std::vector<std::size_t> compressed_len_list;
110 std::size_t offset;
111 std::size_t previous_offset = (*(quint32 *)(src));
112 qDebug() << "first offset= " << previous_offset;
113 std::size_t cumul_decompressed_size = 0;
114
115
116 for(quint32 i = 1; i <= m_scanNumber; i++)
117 {
118 offset = (*(quint32 *)(src + (i * 4)));
119
120 std::size_t compressed_size = offset - previous_offset;
121
122 qDebug() << "scan i=" << i << " previous_offset=" << previous_offset
123 << " offset=" << offset << " length=" << compressed_size;
124 // compressed_len_list.push_back(offset - previous_offset);
125 std::size_t remaining_size = m_timsDataFrame.size();
126
127 if(cumul_decompressed_size < remaining_size)
128 {
129 remaining_size = remaining_size - cumul_decompressed_size;
130 }
131 else
132 {
133 remaining_size = 0;
134 }
135 qDebug() << " remaining_size=" << remaining_size;
136 std::size_t decompressed_size =
137 lzfDecompressScan(src + previous_offset - 8,
138 compressed_size,
139 m_timsDataFrame.data() + cumul_decompressed_size,
140 remaining_size);
141
142
143 m_scanOffsetList.push_back(cumul_decompressed_size);
144 m_scanSizeList.push_back(decompressed_size / 4);
145 cumul_decompressed_size += decompressed_size;
146 qDebug() << " decompressed_size=" << decompressed_size;
147
148
149 previous_offset = offset;
150 }
151 /*
152 std::size_t last_offset = (*(quint32 *)(src + (m_scanNumber * 4)));
153 qDebug() << "last scan length :" << last_offset;
154
155 qDebug() << "last scan length bonus:"
156 << (*(quint32 *)(src + (m_scanNumber + 1 * 4)));
157
158 qDebug() << " m_scanOffsetList.size()=" << m_scanOffsetList.size()
159 << " m_scanNumber=" << m_scanNumber;
160 */
161 /*
162 throw PappsoException(
163 QObject::tr("ERROR reading TimsFrameType1 ").arg(m_timsId));
164 */
165}
std::vector< std::size_t > m_scanSizeList
unsigned int lzfDecompressScan(const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
decompress a single LZF compressed scan buffer
std::vector< std::size_t > m_scanOffsetList

References lzfDecompressScan(), pappso::TimsFrameBase::m_scanNumber, m_scanOffsetList, m_scanSizeList, and pappso::TimsFrame::m_timsDataFrame.

Referenced by TimsFrameType1().

◆ cumulateScan()

void pappso::TimsFrameType1::cumulateScan ( std::size_t  scanNum,
std::map< quint32, quint32 > &  accumulate_into 
) const
overrideprotectedvirtual

cumulate a scan into a map

Parameters
scanNumscan number 0 to (m_scanNumber-1)

Reimplemented from pappso::TimsFrame.

Definition at line 219 of file timsframetype1.cpp.

221{
222 if(m_timsDataFrame.size() == 0)
223 return;
224 // checkScanNum(scanNum);
225
226
227 std::size_t size = m_scanSizeList[scanNum];
228
229 std::size_t offset = m_scanOffsetList[scanNum];
230
231 // qDebug() << "begin offset=" << offset << " size=" << size;
232 qint32 value = 0;
233 qint32 tof_index = 0;
234 for(std::size_t i = 0; i < size; i++)
235 {
236 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
237 // qDebug() << " i=" << i << " value=" << value;
238
239 if(value < 0)
240 {
241 tof_index += -1 * value;
242 }
243 else
244 {
245
246 quint32 x = tof_index;
247 quint32 y = value;
248
249 auto ret = accumulate_into.insert(std::pair<quint32, quint32>(x, y));
250
251 if(ret.second == false)
252 {
253 // already existed : cumulate
254 ret.first->second += y;
255 }
256 tof_index++;
257 }
258 }
259 qDebug() << "end";
260}

References m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::x, and pappso::y.

◆ cumulateScan2()

void pappso::TimsFrameType1::cumulateScan2 ( std::size_t  scanNum,
std::map< quint32, quint32 > &  accumulate_into,
quint32  accepted_tof_index_range_begin,
quint32  accepted_tof_index_range_end 
) const
overrideprotectedvirtual

Reimplemented from pappso::TimsFrame.

Definition at line 264 of file timsframetype1.cpp.

268{
269 if(m_timsDataFrame.size() == 0)
270 return;
271 // checkScanNum(scanNum);
272
273
274 std::size_t size = m_scanSizeList[scanNum];
275
276 std::size_t offset = m_scanOffsetList[scanNum];
277
278 // qDebug() << "begin offset=" << offset << " size=" << size;
279 qint32 value = 0;
280 qint32 tof_index = 0;
281 for(std::size_t i = 0; i < size; i++)
282 {
283 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
284 // qDebug() << " i=" << i << " value=" << value;
285
286 if(value < 0)
287 {
288 tof_index += -1 * value;
289 }
290 else
291 {
292
293 quint32 x = tof_index;
294 quint32 y = value;
295
296
297 if(x < accepted_tof_index_range_begin)
298 {
299 tof_index++;
300 continue;
301 }
302 if(x > accepted_tof_index_range_end)
303 {
304 break;
305 }
306 auto ret = accumulate_into.insert(std::pair<quint32, quint32>(x, y));
307
308 if(ret.second == false)
309 {
310 // already existed : cumulate
311 ret.first->second += y;
312 }
313 tof_index++;
314 }
315 }
316 qDebug() << "end";
317}

References m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::x, and pappso::y.

◆ getMassSpectrumSPtr()

pappso::MassSpectrumSPtr pappso::TimsFrameType1::getMassSpectrumSPtr ( std::size_t  scanNum) const
overridevirtual

get the mass spectrum corresponding to a scan number

Parameters
scanNumthe scan number to retrieve

Reimplemented from pappso::TimsFrame.

Definition at line 440 of file timsframetype1.cpp.

441{
442
443 qDebug() << " scanNum=" << scanNum;
444
445 checkScanNum(scanNum);
446
447 try
448 {
449 qDebug();
450
451 pappso::MassSpectrumSPtr mass_spectrum_sptr =
452 std::make_shared<pappso::MassSpectrum>();
453 // std::vector<DataPoint>
454
455 if(m_timsDataFrame.size() == 0)
456 return mass_spectrum_sptr;
457 qDebug();
458
459 std::size_t size = m_scanSizeList[scanNum];
460
461 std::size_t offset = m_scanOffsetList[scanNum];
462
463 qDebug() << " offset=" << offset << " size=" << size;
464 if(size == 0)
465 return mass_spectrum_sptr;
466
467
468 MzCalibrationInterface *mz_calibration_p =
470
471
472 qint32 value = 0;
473 qint32 tof_index = 0;
474 // std::vector<quint32> index_list;
475 DataPoint data_point;
476 for(std::size_t i = 0; i < size; i++)
477 {
478 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
479
480 if(value < 0)
481 {
482 tof_index += -1 * value;
483 }
484 else
485 {
486 data_point.y = value;
487
488 // intensity normalization
489 data_point.y *= 100.0 / m_accumulationTime;
490
491
492 // mz calibration
493 data_point.x = mz_calibration_p->getMzFromTofIndex(tof_index);
494 mass_spectrum_sptr.get()->push_back(data_point);
495 tof_index++;
496 }
497 }
498
499
500 qDebug() << mass_spectrum_sptr.get()->toString();
501 return mass_spectrum_sptr;
502 }
503 catch(PappsoException &error)
504 {
506 QObject::tr("Error TimsFrameType1::getMassSpectrumSPtr frameId=%1 "
507 "scanNum=%2 :\n%3")
508 .arg(getId())
509 .arg(scanNum)
510 .arg(error.qwhat()));
511 }
512}
double m_accumulationTime
accumulation time in milliseconds
virtual const MzCalibrationInterfaceSPtr & getMzCalibrationInterfaceSPtr() const final
get the MzCalibration model to compute mz and TOF for this frame
bool checkScanNum(std::size_t scanNum) const
check that this scan number exists
std::size_t getId() const
std::shared_ptr< MassSpectrum > MassSpectrumSPtr

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), pappso::TimsFrameBase::getMzCalibrationInterfaceSPtr(), pappso::MzCalibrationInterface::getMzFromTofIndex(), pappso::TimsFrameBase::m_accumulationTime, m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::PappsoException::qwhat(), pappso::DataPoint::x, and pappso::DataPoint::y.

Referenced by getNbrPeaks().

◆ getNbrPeaks()

std::size_t pappso::TimsFrameType1::getNbrPeaks ( std::size_t  scanNum) const
overridevirtual

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

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

Reimplemented from pappso::TimsFrame.

Definition at line 211 of file timsframetype1.cpp.

212{
213 pappso::MassSpectrumSPtr mass_spectrum_sptr = getMassSpectrumSPtr(scanNum);
214 return mass_spectrum_sptr.get()->size();
215}
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const override
get the mass spectrum corresponding to a scan number

References getMassSpectrumSPtr().

◆ getRawTraceSPtr()

pappso::TraceSPtr pappso::TimsFrameType1::getRawTraceSPtr ( std::size_t  scanNum) const
overrideprotectedvirtual

get the raw index tof_index and intensities (normalized)

Parameters
scanNumthe scan number to extract
Returns
trace vector

Reimplemented from pappso::TimsFrame.

Definition at line 516 of file timsframetype1.cpp.

517{
518
519 // qDebug();
520
521 pappso::TraceSPtr trace_sptr = std::make_shared<pappso::Trace>();
522 // std::vector<DataPoint>
523
524 if(m_timsDataFrame.size() == 0)
525 return trace_sptr;
526 qDebug();
527
528 std::size_t size = m_scanSizeList[scanNum];
529
530 std::size_t offset = m_scanOffsetList[scanNum];
531
532 qDebug() << " offset=" << offset << " size=" << size;
533 if(size == 0)
534 return trace_sptr;
535
536 // qDebug();
537 qint32 value = 0;
538 qint32 tof_index = 0;
539
540 // std::vector<quint32> index_list;
541 DataPoint data_point;
542 for(std::size_t i = 0; i < size; i++)
543 {
544 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
545
546 if(value < 0)
547 {
548 tof_index += -1 * value;
549 }
550 else
551 {
552 data_point.y = value;
553
554 // intensity normalization
555 data_point.y *= 100.0 / m_accumulationTime;
556
557
558 // mz calibration
559 data_point.x = tof_index;
560 trace_sptr.get()->push_back(data_point);
561 tof_index++;
562 }
563 }
564
565
566 // qDebug();
567 return trace_sptr;
568}
std::shared_ptr< Trace > TraceSPtr
Definition trace.h:135

References pappso::TimsFrameBase::m_accumulationTime, m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, pappso::DataPoint::x, and pappso::DataPoint::y.

◆ getRawValuePairList()

std::vector< TimsFrameType1::RawValuePair > pappso::TimsFrameType1::getRawValuePairList ( std::size_t  scanNum,
quint32  accepted_tof_index_range_begin,
quint32  accepted_tof_index_range_end 
) const
overrideprotectedvirtual

get the raw index tof_index and intensities (normalized)

Parameters
scanNumthe scan number to extract
accepted_tof_index_range_beginmz index begin
accepted_tof_index_range_endmz index end
Returns
vector of RawValuePair

Reimplemented from pappso::TimsFrame.

Definition at line 572 of file timsframetype1.cpp.

575{
576
577 // qDebug();
578
579 std::vector<TimsFrame::RawValuePair> trace_sptr;
580 // std::vector<DataPoint>
581
582 if(m_timsDataFrame.size() == 0)
583 return trace_sptr;
584 qDebug();
585
586 std::size_t size = m_scanSizeList[scanNum];
587
588 std::size_t offset = m_scanOffsetList[scanNum];
589
590 qDebug() << " offset=" << offset << " size=" << size;
591 if(size == 0)
592 return trace_sptr;
593
594 // qDebug();
595 qint32 value = 0;
596 qint32 tof_index = 0;
597
598 // std::vector<quint32> index_list;
599 TimsFrame::RawValuePair data_point;
600 for(std::size_t i = 0; i < size; i++)
601 {
602 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
603
604 if(value < 0)
605 {
606 tof_index += -1 * value;
607 }
608 else
609 {
610 data_point.intensity_index = value;
611
612 if(data_point.intensity_index < accepted_tof_index_range_begin)
613 {
614 tof_index++;
615 continue;
616 }
617 if(data_point.intensity_index > accepted_tof_index_range_end)
618 {
619 break;
620 }
621 // intensity normalization
622 data_point.intensity_index *= 100.0 / m_accumulationTime;
623
624
625 // mz calibration
626 data_point.mz_tof_index = tof_index;
627 trace_sptr.push_back(data_point);
628 tof_index++;
629 }
630 }
631
632
633 // qDebug();
634 return trace_sptr;
635}

References pappso::TimsFrameBase::RawValuePair::intensity_index, pappso::TimsFrameBase::m_accumulationTime, m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, and pappso::TimsFrameBase::RawValuePair::mz_tof_index.

◆ getScanIndexList()

std::vector< quint32 > pappso::TimsFrameType1::getScanIndexList ( std::size_t  scanNum) const
overridevirtual

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

Reimplemented from pappso::TimsFrame.

Definition at line 320 of file timsframetype1.cpp.

321{
322 qDebug();
323 checkScanNum(scanNum);
324
325 std::vector<quint32> mzindex_values;
326
327 try
328 {
329 qDebug();
330
331
332 if(m_timsDataFrame.size() == 0)
333 return mzindex_values;
334 qDebug();
335
336 std::size_t size = m_scanSizeList[scanNum];
337
338 std::size_t offset = m_scanOffsetList[scanNum];
339
340 qDebug() << " offset=" << offset << " size=" << size;
341 if(size == 0)
342 return mzindex_values;
343
344 qint32 value = 0;
345 qint32 tof_index = 0;
346 // std::vector<quint32> index_list;
347 for(std::size_t i = 0; i < size; i++)
348 {
349 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
350
351 if(value < 0)
352 {
353 tof_index += -1 * value;
354 }
355 else
356 {
357 mzindex_values.push_back(tof_index);
358 tof_index++;
359 }
360 }
361
362
363 qDebug();
364 return mzindex_values;
365 }
366 catch(PappsoException &error)
367 {
368 throw pappso::PappsoException(QObject::tr("Error %1 frameId=%2 "
369 "scanNum=%3 :\n%4")
370 .arg(__FUNCTION__)
371 .arg(getId())
372 .arg(scanNum)
373 .arg(error.qwhat()));
374 }
375 qDebug();
376}

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, and pappso::PappsoException::qwhat().

◆ getScanIntensities()

std::vector< quint32 > pappso::TimsFrameType1::getScanIntensities ( std::size_t  scanNum) const
overridevirtual

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

Reimplemented from pappso::TimsFrame.

Definition at line 379 of file timsframetype1.cpp.

380{
381
382
383 qDebug() << " scanNum=" << scanNum;
384
385 checkScanNum(scanNum);
386
387 std::vector<quint32> int_values;
388
389 try
390 {
391 qDebug();
392
393
394 if(m_timsDataFrame.size() == 0)
395 return int_values;
396 qDebug();
397
398 std::size_t size = m_scanSizeList[scanNum];
399
400 std::size_t offset = m_scanOffsetList[scanNum];
401
402 qDebug() << " offset=" << offset << " size=" << size;
403 if(size == 0)
404 return int_values;
405
406 qint32 value = 0;
407 qint32 tof_index = 0;
408 // std::vector<quint32> index_list;
409 for(std::size_t i = 0; i < size; i++)
410 {
411 value = (*(qint32 *)(m_timsDataFrame.constData() + offset + (i * 4)));
412
413 if(value < 0)
414 {
415 tof_index += -1 * value;
416 }
417 else
418 {
419 int_values.push_back(value);
420 tof_index++;
421 }
422 }
423
424
425 qDebug();
426 return int_values;
427 }
428 catch(PappsoException &error)
429 {
430 throw pappso::PappsoException(QObject::tr("Error %1 frameId=%2 "
431 "scanNum=%3 :\n%4")
432 .arg(__FUNCTION__)
433 .arg(getId())
434 .arg(scanNum)
435 .arg(error.qwhat()));
436 }
437}

References pappso::TimsFrameBase::checkScanNum(), pappso::TimsFrameBase::getId(), m_scanOffsetList, m_scanSizeList, pappso::TimsFrame::m_timsDataFrame, and pappso::PappsoException::qwhat().

◆ lzfDecompressScan()

unsigned int pappso::TimsFrameType1::lzfDecompressScan ( const char *  src,
unsigned int  src_len,
char *  dest,
unsigned int  dest_len 
)
private

decompress a single LZF compressed scan buffer

Parameters
srcpointer on the LZF compressed buffer
src_lenlength of the source buffer
destpointer to the destination buffer (in the qbyte array)
dest_lenlength of the destination buffer (max possible in the qbytearray)
Returns
scan decompressed size

Definition at line 169 of file timsframetype1.cpp.

173{
174 qDebug() << "src=" << src << " src_len=" << src_len
175 << " dest_len=" << dest_len;
176 if(src_len == 0)
177 return 0;
178 unsigned int decompressed_size;
179 unsigned int more_space = src_len * 2;
180 decompressed_size = lzf_decompress(src, src_len, dest, dest_len);
181 while(decompressed_size == 0)
182 {
183 qDebug() << "dest_len=" << dest_len;
184 qDebug() << "decompressed_size=" << decompressed_size;
185
186 if(errno == EINVAL)
187 {
188 throw PappsoException(
189 QObject::tr("ERROR reading TimsFrameType1 %1 TIMS binary file %2: "
190 "LZF decompression error EINVAL")
191 .arg(m_timsId));
192 }
193 else if(errno == E2BIG)
194 {
195 qDebug() << " m_timsDataFrame.size()=" << m_timsDataFrame.size()
196 << " more_space=" << more_space;
197 m_timsDataFrame.resize(m_timsDataFrame.size() + more_space);
198 dest_len += more_space;
199 qDebug();
200 decompressed_size = lzf_decompress(src, src_len, dest, dest_len);
201 }
202 else
203 {
204 break;
205 }
206 }
207 return decompressed_size;
208}

References pappso::TimsFrame::m_timsDataFrame, and pappso::TimsFrameBase::m_timsId.

Referenced by copyAndLzfDecompress().

Member Data Documentation

◆ m_scanOffsetList

std::vector<std::size_t> pappso::TimsFrameType1::m_scanOffsetList
private

◆ m_scanSizeList

std::vector<std::size_t> pappso::TimsFrameType1::m_scanSizeList
private

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