libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsframetype1.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/vendors/tims/timsframetype1.h
3 * \date 3/10/2021
4 * \author Olivier Langella
5 * \brief handle a single Bruker's TimsTof frame type 1 compression
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2021 Olivier Langella <Olivier.Langella@u-psud.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28#pragma once
29
30#include "timsframe.h"
31
32namespace pappso
33{
34/**
35 * @todo write docs
36 */
38{
39 public:
40 /**
41 * @param timsId tims frame id
42 * @param scanNum total number of scans in this frame
43 * @param p_bytes pointer on the decompressed binary buffer
44 * @param len size of the decompressed binary buffer
45 */
46 TimsFrameType1(std::size_t timsId,
47 quint32 scanNum,
48 char *p_bytes,
49 std::size_t len);
50
51 /**
52 * Copy constructor
53 *
54 * @param other TODO
55 */
56 TimsFrameType1(const TimsFrameType1 &other);
57
58 /**
59 * Destructor
60 */
61 virtual ~TimsFrameType1();
62
63
64 virtual std::size_t getNbrPeaks(std::size_t scanNum) const override;
65
66
67 /** @brief get raw index list for one given scan
68 * index are not TOF nor m/z, just index on digitizer
69 */
70 virtual std::vector<quint32>
71 getScanIndexList(std::size_t scanNum) const override;
72
73 /** @brief get raw intensities without transformation from one scan
74 * it needs intensity normalization
75 */
76 virtual std::vector<quint32>
77 getScanIntensities(std::size_t scanNum) const override;
78
79 /** @brief get the mass spectrum corresponding to a scan number
80 * @param scanNum the scan number to retrieve
81 * */
82
84 getMassSpectrumSPtr(std::size_t scanNum) const override;
85
86
87 protected:
88 /** @brief cumulate a scan into a map
89 *
90 * @param scanNum scan number 0 to (m_scanNumber-1)
91 */
92 virtual void cumulateScan(std::size_t scanNum,
93 TimsDataFastMap &accumulate_into) const override;
94
95 virtual void
96 cumulateScan2(std::size_t scanNum,
97 TimsDataFastMap &accumulate_into,
98 quint32 accepted_tof_index_range_begin,
99 quint32 accepted_tof_index_range_end) const override;
100
101 /** @brief get the raw index tof_index and intensities (normalized)
102 *
103 * @param scanNum the scan number to extract
104 * @return trace vector
105 *
106 */
107 virtual pappso::TraceSPtr getRawTraceSPtr(std::size_t scanNum) const override;
108
109
110 /** @brief get the raw index tof_index and intensities (normalized)
111 *
112 * @param scanNum the scan number to extract
113 * @param accepted_tof_index_range_begin mz index begin
114 * @param accepted_tof_index_range_end mz index end
115 * @return vector of RawValuePair
116 *
117 */
118 virtual std::vector<RawValuePair>
119 getRawValuePairList(std::size_t scanNum,
120 quint32 accepted_tof_index_range_begin,
121 quint32 accepted_tof_index_range_end) const override;
122
123 private:
124 /** @brief copy buffer header and lzf decompress each scan for tims
125 * compression type 1
126 * @param src raw data buffer containing scan offsets and LZF compressed scans
127 * @param len length of the data buffer
128 */
129 void copyAndLzfDecompress(const char *src, std::size_t len);
130
131 /** @brief decompress a single LZF compressed scan buffer
132 * @param src pointer on the LZF compressed buffer
133 * @param src_len length of the source buffer
134 * @param dest pointer to the destination buffer (in the qbyte array)
135 * @param dest_len length of the destination buffer (max possible in the
136 * qbytearray)
137 * @return scan decompressed size
138 */
139 unsigned int lzfDecompressScan(const char *src,
140 unsigned int src_len,
141 char *dest,
142 unsigned int dest_len);
143
144 private:
145 std::vector<std::size_t> m_scanOffsetList;
146 std::vector<std::size_t> m_scanSizeList;
147};
148} // namespace pappso
virtual void cumulateScan2(std::size_t scanNum, TimsDataFastMap &accumulate_into, quint32 accepted_tof_index_range_begin, quint32 accepted_tof_index_range_end) const override
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
std::vector< std::size_t > m_scanSizeList
void copyAndLzfDecompress(const char *src, std::size_t len)
copy buffer header and lzf decompress each scan for tims compression type 1
virtual std::vector< RawValuePair > getRawValuePairList(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)
virtual std::size_t getNbrPeaks(std::size_t scanNum) const override
get the number of peaks in this spectrum need the binary file
unsigned int lzfDecompressScan(const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
decompress a single LZF compressed scan buffer
virtual pappso::MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const override
get the mass spectrum corresponding to a scan number
virtual std::vector< quint32 > getScanIntensities(std::size_t scanNum) const override
get raw intensities without transformation from one scan it needs intensity normalization
virtual void cumulateScan(std::size_t scanNum, TimsDataFastMap &accumulate_into) const override
cumulate a scan into a map
std::vector< std::size_t > m_scanOffsetList
virtual pappso::TraceSPtr getRawTraceSPtr(std::size_t scanNum) const override
get the raw index tof_index and intensities (normalized)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< Trace > TraceSPtr
Definition trace.h:135
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
replacement for std::map
handle a single Bruker's TimsTof frame