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"
32
33namespace pappso
34{
35/**
36 * @todo write docs
37 */
39{
40 public:
41 /**
42 * @param timsId tims frame id
43 * @param scanNum total number of scans in this frame
44 * @param p_bytes pointer on the decompressed binary buffer
45 * @param len size of the decompressed binary buffer
46 */
47 TimsFrameType1(std::size_t timsId,
48 quint32 scanNum,
49 char *p_bytes,
50 std::size_t len);
51
52 /**
53 * Copy constructor
54 *
55 * @param other TODO
56 */
57 TimsFrameType1(const TimsFrameType1 &other);
58
59 /**
60 * Destructor
61 */
62 virtual ~TimsFrameType1();
63
64
65 virtual std::size_t getScanPeakCount(std::size_t scanNum) const override;
66
67
68 /** @brief get raw index list for one given scan
69 * index are not TOF nor m/z, just index on digitizer
70 */
71 virtual std::vector<quint32>
72 getScanTofIndexList(std::size_t scanNum) const override;
73
74 /** @brief get raw intensities without transformation from one scan
75 * it needs intensity normalization
76 */
77 virtual std::vector<quint32>
78 getScanIntensityList(std::size_t scanNum) const override;
79
80 /** @brief get the mass spectrum corresponding to a scan number
81 * @param scanNum the scan number to retrieve
82 * */
83
85 getMassSpectrumSPtr(std::size_t scanNum) const override;
86
87
88 protected:
89 /** @brief cumulate a scan into a map
90 *
91 * @param scanNum scan number 0 to (m_scanNumber-1)
92 */
93 virtual void cumulateScan(std::size_t scanNum,
94 TimsDataFastMap &accumulate_into) const override;
95
96 virtual void
97 cumulateScan2(std::size_t scanNum,
98 TimsDataFastMap &accumulate_into,
99 quint32 accepted_tof_index_range_begin,
100 quint32 accepted_tof_index_range_end) const override;
101
102 /** @brief get the raw index tof_index and intensities (normalized)
103 *
104 * @param scanNum the scan number to extract
105 * @return trace vector
106 *
107 */
108 virtual pappso::TraceSPtr getRawTraceSPtr(std::size_t scanNum) const override;
109
110
111 /** @brief get the raw index tof_index and intensities (normalized)
112 *
113 * @param scanNum the scan number to extract
114 * @param accepted_tof_index_range_begin mz index begin
115 * @param accepted_tof_index_range_end mz index end
116 * @return vector of RawValuePair
117 *
118 */
119 virtual std::vector<TofIndexIntensityPair>
120 getRawValuePairList(std::size_t scanNum,
121 quint32 accepted_tof_index_range_begin,
122 quint32 accepted_tof_index_range_end) const override;
123
124 private:
125 /** @brief copy buffer header and lzf decompress each scan for tims
126 * compression type 1
127 * @param src raw data buffer containing scan offsets and LZF compressed scans
128 * @param len length of the data buffer
129 */
130 void copyAndLzfDecompress(const char *src, std::size_t len);
131
132 /** @brief decompress a single LZF compressed scan buffer
133 * @param src pointer on the LZF compressed buffer
134 * @param src_len length of the source buffer
135 * @param dest pointer to the destination buffer (in the qbyte array)
136 * @param dest_len length of the destination buffer (max possible in the
137 * qbytearray)
138 * @return scan decompressed size
139 */
140 unsigned int lzfDecompressScan(const char *src,
141 unsigned int src_len,
142 char *dest,
143 unsigned int dest_len);
144
145 private:
146 std::vector<std::size_t> m_scanOffsetList;
147 std::vector<std::size_t> m_scanSizeList;
148};
149} // namespace pappso
replacement for std::map
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::size_t getScanPeakCount(std::size_t scanNum) const override
get the number of peaks in this spectrum need the binary file
virtual std::vector< quint32 > getScanIntensityList(std::size_t scanNum) const override
get raw intensities without transformation from one scan it needs intensity normalization
std::vector< std::size_t > m_scanSizeList
TimsFrameType1(std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
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< quint32 > getScanTofIndexList(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
unsigned int lzfDecompressScan(const char *src, unsigned int src_len, char *dest, unsigned int dest_len)
decompress a single LZF compressed scan buffer
virtual std::vector< TofIndexIntensityPair > 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 pappso::MassSpectrumSPtr getMassSpectrumSPtr(std::size_t scanNum) const override
get the mass spectrum corresponding to a scan number
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)
TimsFrame(std::size_t timsId, quint32 scanNum, char *p_bytes, std::size_t len)
Definition timsframe.cpp:60
#define PMSPP_LIB_DECL
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