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