libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsdiaslices.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/vendors/tims/timsdiaslices.h
3 * \date 02/07/2024
4 * \brief handle specific data for DIA MS runs
5 */
6
7/*******************************************************************************
8 * Copyright (c) 2024 Olivier Langella <Olivier.Langella@u-psud.fr>.
9 *
10 * This file is part of the PAPPSOms++ library.
11 *
12 * PAPPSOms++ is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * PAPPSOms++ is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
24 *
25 ******************************************************************************/
26
27#pragma once
28#include "timsdata.h"
30
31namespace pappso
32{
33
34/**
35 * @todo write docs
36 */
38{
39 public:
40 /**
41 * Default constructor
42 */
43 TimsDiaSlices(QSqlQuery &query, TimsData *tims_data_origin);
44
45 /**
46 * Destructor
47 */
49
51 {
52 /** @brief tell if given mz is in range for this window
53 */
54 bool isMzInRange(double mz) const;
55
56 std::size_t SliceIndex = 0;
57 std::size_t WindowGroup;
58 std::size_t ScanNumBegin;
59 std::size_t ScanNumEnd;
63 };
64
65 struct MsMsWindowGroup : std::vector<MsMsWindow>
66 {
67 std::size_t WindowGroup;
68 };
69
70 struct MsMsWindowGroupList : std::vector<MsMsWindowGroup *>
71 {
73
74 void addInGroup(const MsMsWindow &window);
76 getWindowGroupPtrByGroupId(std::size_t window_group_id) const;
77 };
78
80
81 const std::map<std::size_t, MsMsWindowGroup *> &
83
84 std::size_t getGlobalSliceIndexBeginByFrameId(std::size_t frame_id) const;
85
86 std::size_t getFrameIdByGlobalSliceIndex(std::size_t global_slice_id) const;
87
88
89 /** @brief get the number of DIA MS2 slices analyzed by PASEF
90 */
91 std::size_t getTotalSlicesCount() const;
92
93
94 const MsMsWindow &
95 getMsMsWindowByGlobalSliceIndex(std::size_t global_slice_index) const;
96
97
99 getCombinedMs2ScansByGlobalSliceIndex(std::size_t global_slice_index) const;
100
101
103 const MsRunIdCstSPtr &msrun_id,
104 QualifiedMassSpectrum &mass_spectrum,
105 std::size_t global_slice_index,
106 bool want_binary_data) const;
107
108
109 /** @brief get MS1 spectrum corresponding to the given slice
110 * extract MS1 mz range and mobility range corresponding to a global slice
111 * @param msrun_id
112 * @param mass_spectrum
113 * @param global_slice_index
114 * @param want_binary_data
115 * @param rt_position relative MS1 frame retention time : 0 latest MS1 frame,
116 * +1 next MS1 frame, -1 previous MS1 frame
117 */
119 const MsRunIdCstSPtr &msrun_id,
120 QualifiedMassSpectrum &mass_spectrum,
121 std::size_t global_slice_index,
122 bool want_binary_data,
123 int rt_position = 0) const;
124
125 std::size_t getLastMs1FrameIdByMs2FrameId(std::size_t frame_id) const;
126
127 private:
129 {
130 std::size_t frame_id;
133 };
134
135 const FrameSliceRange &
136 getFrameSliceRangeByGlobalSliceIndex(std::size_t global_slice_index) const;
137
138 private:
141 std::map<std::size_t, MsMsWindowGroup *> m_mapFrame2WindowGroupPtr;
142 std::vector<std::size_t> m_frameId2GlobalSliceIndexBegin;
143 std::vector<std::size_t> m_ms2frameId2Ms1FrameId;
144 std::vector<std::size_t> m_ms1frameIdList;
145 std::vector<FrameSliceRange> m_frameSliceRangeList;
146
147 /** @brief enable builtin centroid on raw tims integers by default
148 */
150
152};
153} // namespace pappso
Class representing a fully specified mass spectrum.
replacement for std::map
std::vector< std::size_t > m_ms2frameId2Ms1FrameId
TimsDataFastMap & getCombinedMs2ScansByGlobalSliceIndex(std::size_t global_slice_index) const
std::size_t getGlobalSliceIndexBeginByFrameId(std::size_t frame_id) const
std::size_t getLastMs1FrameIdByMs2FrameId(std::size_t frame_id) const
const FrameSliceRange & getFrameSliceRangeByGlobalSliceIndex(std::size_t global_slice_index) const
MsMsWindowGroupList m_msMsWindowGroupList
const MsMsWindow & getMsMsWindowByGlobalSliceIndex(std::size_t global_slice_index) const
bool m_builtinMs2Centroid
enable builtin centroid on raw tims integers by default
std::vector< std::size_t > m_ms1frameIdList
std::map< std::size_t, MsMsWindowGroup * > m_mapFrame2WindowGroupPtr
std::size_t m_totalSlicesCount
std::size_t getFrameIdByGlobalSliceIndex(std::size_t global_slice_id) const
std::vector< std::size_t > m_frameId2GlobalSliceIndexBegin
void getMs2QualifiedSpectrumByGlobalSliceIndex(const MsRunIdCstSPtr &msrun_id, QualifiedMassSpectrum &mass_spectrum, std::size_t global_slice_index, bool want_binary_data) const
const std::map< std::size_t, MsMsWindowGroup * > & getMapFrame2WindowGroupPtr() const
void getMs1QualifiedSpectrumByGlobalSliceIndex(const MsRunIdCstSPtr &msrun_id, QualifiedMassSpectrum &mass_spectrum, std::size_t global_slice_index, bool want_binary_data, int rt_position=0) const
get MS1 spectrum corresponding to the given slice extract MS1 mz range and mobility range correspondi...
TimsDiaSlices(QSqlQuery &query, TimsData *tims_data_origin)
std::vector< FrameSliceRange > m_frameSliceRangeList
std::size_t getTotalSlicesCount() const
get the number of DIA MS2 slices analyzed by PASEF
const MsMsWindowGroupList & getMsMsWindowGroupList() const
#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< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
MsMsWindowGroup * getWindowGroupPtrByGroupId(std::size_t window_group_id) const
void addInGroup(const MsMsWindow &window)
bool isMzInRange(double mz) const
tell if given mz is in range for this window