libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsddaprecursors.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/vendors/tims/timsddaprecursors.h
3 * \date 30/06/2024
4 * \brief handle specific data for DDA 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"
29
30namespace pappso
31{
32/**
33 * @todo TimsData helper that stores all related DDA informations
34 */
36{
37 friend TimsData;
38
39 public:
40 /**
41 * Default constructor
42 */
43 TimsDdaPrecursors(QSqlQuery &query, TimsData *tims_data_origin);
44
45 /**
46 * Destructor
47 */
49
50
51 /** @brief get the number of precursors analyzed by PASEF
52 */
53 std::size_t getTotalPrecursorCount() const;
54
55
56 XicCoordTims getXicCoordTimsFromPrecursorId(std::size_t precursor_id,
57 PrecisionPtr precision_ptr);
58
59
61 {
62 std::size_t parent_frame = 0;
63 std::size_t precursor_id = 0;
64 std::size_t scan_mobility_start = 0;
65 std::size_t scan_mobility_end = 0;
66 std::size_t ms1_index = 0;
67 std::size_t ms2_index = 0;
68 double isolationMz = 0;
69 double isolationWidth = 0;
70 float collisionEnergy = 0;
71 std::vector<std::size_t> tims_frame_list;
73 };
74
75
76 /** @brief get an intermediate structure describing a spectrum
77 */
79 getSpectrumDescrWithPrecursorId(std::size_t precursor_id) const;
80
81 /** @brief get a list of TimsDdaPrecursors::SpectrumDescr for a frame
82 * @param frame_id the frame_id
83 */
84 std::vector<TimsDdaPrecursors::SpectrumDescr>
85 getSpectrumDescrListByFrameId(std::size_t frame_id) const;
86
87 // FIXME NAMING: identical to above
88 // Not used in i2mcq
89 void getQualifiedMs2MassSpectrumBySpectrumDescr(
90 const MsRunIdCstSPtr &msrun_id,
91 QualifiedMassSpectrum &mass_spectrum,
92 const SpectrumDescr &spectrum_descr,
93 bool want_binary_data);
94
95 // FIXME NAMING: identical to above
96 // Not used in i2mcq
97 void getQualifiedMs1MassSpectrumBySpectrumDescr(
98 const MsRunIdCstSPtr &msrun_id,
99 QualifiedMassSpectrum &mass_spectrum,
100 const SpectrumDescr &spectrum_descr,
101 bool want_binary_data);
102
103
104 /** @brief filter interface to apply just after raw MS2 specturm extraction
105 * the filter can be a list of filters inside a FilterSuite object
106 */
107 void setMs2FilterCstSPtr(pappso::FilterInterfaceCstSPtr &filter);
108
109 /** @brief filter interface to apply just after raw MS1 specturm extraction
110 * the filter can be a list of filters inside a FilterSuite object
111 */
112 void setMs1FilterCstSPtr(pappso::FilterInterfaceCstSPtr &filter);
113
114
115 /** @brief enable or disable simple centroid filter on raw tims data for MS2
116 */
117 void setMs2BuiltinCentroid(bool centroid);
118
119
120 /** @brief tells if simple centroid filter on raw tims data for MS2 is enabled
121 * or not
122 */
123 bool getMs2BuiltinCentroid() const;
124
125
126 /** @brief function to visit an MsRunReader and get each Spectrum in a
127 * spectrum collection handler by Ms Levels
128 *
129 * this function will retrieve processed qualified spectrum depending on each
130 * Bruker precursors
131 */
132 void ms2ReaderSpectrumCollectionByMsLevel(
133 const MsRunIdCstSPtr &msrun_id,
135 unsigned int ms_level);
136
137 /** @brief set only one is_mono_thread to true
138 *
139 * this avoid to use qtconcurrent
140 */
141 void setMonoThread(bool is_mono_thread);
142
143
144 /** @brief function to visit an MsRunReader and get each raw Spectrum in a
145 * spectrum collection handler by Ms Levels
146 *
147 * this function will retrieve every scans as a qualified mass spectrum
148 */
149 void rawReaderSpectrumCollectionByMsLevel(
150 const MsRunIdCstSPtr &msrun_id,
152 unsigned int ms_level);
153
154
155 /** @brief guess possible precursor ids given a charge, m/z, retention time
156 * and k0
157 * @return a list of possible precursor ids
158 */
159 std::vector<std::size_t> getPrecursorsByMzRtCharge(int charge,
160 double mz_val,
161 double rt_sec,
162 double k0);
163
164 // FIXME: TO THROW AWAY
165 [[deprecated("This function will be removed")]] std::vector<std::size_t>
166 getMatchPrecursorIdByKo(std::vector<std::vector<double>> ids,
167 double ko_value);
168
169 /** @todo documentation
170 */
171 // FIXME: TO THROW AWAY
172 [[deprecated("This function will be removed")]] std::vector<std::size_t>
173 getClosestPrecursorIdByMz(std::vector<std::vector<double>> ids,
174 double mz_value);
175
176
177 /** @brief get cumulated raw signal for a given
178 * precursorCMakeLists.txt.userCMakeLists.txt.userCMakeLists.txt.user only to
179 * use to see the raw signal
180 *
181 * @param precursor_index precursor index to extract signal from
182 * @result a map of integers, x=time of flights, y= intensities
183 */
184 // Not used in i2mcq
185 TimsDataFastMap &getCombinedMs2ScansByPrecursorId(std::size_t precursor_id);
186
187 protected:
188 // FIXME NAMING: identical to above
189 // Not used in i2mcq
190 SpectrumDescr getSpectrumDescrWithScanCoordinates(
191 const std::pair<std::size_t, std::size_t> &scan_coordinates);
192
193 private:
194 void ms2ReaderGenerateMS1MS2Spectrum(
195 const MsRunIdCstSPtr &msrun_id,
196 std::vector<QualifiedMassSpectrum> &qualified_mass_spectrum_list,
198 const SpectrumDescr &spectrum_descr,
199 unsigned int ms_level);
200
201 void fillSpectrumDescriptionWithSqlRecord(SpectrumDescr &spectrum_descr,
202 QSqlQuery &qprecursor_list);
203
204 private:
206
208
209
210 std::map<std::size_t, QSqlRecord> m_mapXicCoordRecord;
211
212
213 pappso::FilterInterfaceCstSPtr mcsp_ms2Filter = nullptr;
214 pappso::FilterInterfaceCstSPtr mcsp_ms1Filter = nullptr;
215
216 /** @brief enable builtin centroid on raw tims integers by default
217 */
218 bool m_builtinMs2Centroid = true;
219
220 bool m_isMonoThread = false;
221
222 QMutex m_mutex;
223};
224} // namespace pappso
Class representing a fully specified mass spectrum.
interface to collect spectrums from the MsRunReader class
replacement for std::map
std::map< std::size_t, QSqlRecord > m_mapXicCoordRecord
#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
std::shared_ptr< const FilterInterface > FilterInterfaceCstSPtr
std::vector< std::size_t > tims_frame_list
coordinates of the XIC to extract and the resulting XIC after extraction
main Tims data handler