libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
timsmsrunreaderbase.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/private/timsmsrunreaderbase.cpp
3 * \date 15/07/2024
4 * \author Olivier Langella
5 * \brief Base class for all tims ms run reader objects
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2024 Olivier Langella
10 *<Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
32#include <QDebug>
33#include "../../obo/obopsims.h"
35
36namespace pappso
37{
42
44 : MsRunReader(msrun_reader_base.getMsRunId()), msp_timsData(msrun_reader_base.msp_timsData)
45{
46 initialize();
47}
48
49
55
56void
58{
59 if(msp_timsData == nullptr)
60 msp_timsData = std::make_shared<TimsData>(mcsp_msRunId.get()->getFileName());
61
62 if(msp_timsData.get() == nullptr)
63 {
64 throw PappsoException(QObject::tr("ERROR in TimsMsRunReaderBase::initialize "
65 "msp_timsData is null for MsRunId %1")
66 .arg(mcsp_msRunId.get()->toString()));
67 }
68}
69
70
71bool
72TimsMsRunReaderBase::accept(const QString &file_name) const
73{
74 qDebug() << file_name;
75 return true;
76}
77
78bool
80{
81 return false;
82}
83
84
85bool
87{
88 msp_timsData = nullptr;
89 return true;
90}
91
92bool
94{
95 if(msp_timsData == nullptr)
96 {
97 initialize();
98 }
99 return true;
100}
101
108
109
110Trace
112{
113 // Use the Sqlite database to fetch the total ion current chromatogram (TIC
114 // chromatogram).
115
117
118 // The time unit here is seconds, not minutes!!!
119 return msp_timsData->getTicChromatogram();
120}
121
122
123std::vector<double>
125{
126 return msp_timsData.get()->getRetentionTimeLineInSeconds();
127}
128
129
131TimsMsRunReaderBase::newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index [[maybe_unused]],
132 pappso::PrecisionPtr precision
133 [[maybe_unused]]) const
134{
136 QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
137}
138
141 const pappso::QualifiedMassSpectrum &mass_spectrum [[maybe_unused]],
142 pappso::PrecisionPtr precision [[maybe_unused]]) const
143{
145 QObject::tr("Not implemented %1 %2 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
146}
147
148
149} // namespace pappso
150
153{
154
156
157 pappso::OboPsiMs psims_file(psims_map);
158
160
161 term = psims_map.getOboPsiModTermWithAccession("MS:1003123");
162 /*
163 * [Term]
164 id: MS:1003123
165 name: Bruker Daltonics timsTOF series
166 def: "Bruker Daltonics timsTOF series" [PSI:MS]
167 is_a: MS:1000122 ! Bruker Daltonics instrument model
168 */
169 /*
170 *
171[Term]
172id: MS:1003124
173name: timsTOF fleX
174def: "Bruker Daltonics' timsTOF fleX" [PSI:MS]
175is_a: MS:1003123 ! Bruker Daltonics timsTOF series
176
177[Term]
178id: MS:1003229
179name: timsTOF
180def: "Bruker Daltonics' timsTOF." [PSI:MS]
181is_a: MS:1003123 ! Bruker Daltonics timsTOF series
182
183[Term]
184id: MS:1003230
185name: timsTOF Pro 2
186def: "Bruker Daltonics' timsTOF Pro 2." [PSI:MS]
187is_a: MS:1003123 ! Bruker Daltonics timsTOF series
188
189[Term]
190id: MS:1003231
191name: timsTOF SCP
192def: "Bruker Daltonics' timsTOF SCP." [PSI:MS]
193is_a: MS:1003123 ! Bruker Daltonics timsTOF series
194
195[Term]
196id: MS:1003383
197name: timsTOF Ultra
198def: "Bruker Daltonics' timsTOF Ultra." [PSI:MS]
199is_a: MS:1003123 ! Bruker Daltonics timsTOF series
200
201
202[Term]
203id: MS:1003397
204name: timsTOF fleX MALDI-2
205def: "Bruker Daltonics' timsTOF fleX MALDI-2." [PSI:MS]
206is_a: MS:1003123 ! Bruker Daltonics timsTOF series
207
208
209[Term]
210id: MS:1003404
211name: timsTOF HT
212def: "Bruker Daltonics' timsTOF HT." [PSI:MS]
213is_a: MS:1003123 ! Bruker Daltonics timsTOF series
214
215
216[Term]
217id: MS:1003412
218name: timsTOF Ultra 2
219def: "Bruker Daltonics timsTOF Ultra 2." [PSI:MS]
220is_a: MS:1003123 ! Bruker Daltonics timsTOF series
221*/
222 QStringList timstof_list;
223 timstof_list << "MS:1003005"
224 << "MS:1003412"
225 << "MS:1003404"
226 << "MS:1003397"
227 << "MS:1003383"
228 << "MS:1003231"
229 << "MS:1003230"
230 << "MS:1003229"
231 << "MS:1003124";
232
233 QString instrument_name = msp_timsData.get()->getGlobalMetadataValue("InstrumentName").toString();
234
235 for(auto &accession : timstof_list)
236 {
237 pappso::OboPsiModTerm test_term = psims_map.getOboPsiModTermWithAccession(accession);
238 if(test_term.m_name == instrument_name)
239 {
240 term = test_term;
241 break;
242 }
243 }
244 return term;
245}
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const
MsRunIdCstSPtr mcsp_msRunId
MsRunReader(const MsRunIdCstSPtr &ms_run_id)
const MsRunIdCstSPtr & getMsRunId() const
Class representing a fully specified mass spectrum.
TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
virtual Trace getTicChromatogram() override
get a TIC chromatogram
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
virtual void initialize() override
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override
get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: i...
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
virtual std::vector< double > getRetentionTimeLine() override
retention timeline get retention times along the MSrun in seconds
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
virtual bool acquireDevice() override
acquire data back end device
virtual bool accept(const QString &file_name) const override
tells if the reader is able to handle this file must be implemented by private MS run reader,...
virtual TimsDataSp getTimsDataSPtr()
give an access to the underlying raw data pointer
A simple container of DataPoint instances.
Definition trace.h:148
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< TimsData > TimsDataSp
shared pointer on a TimsData object
Definition timsdata.h:54
const PrecisionBase * PrecisionPtr
Definition precision.h:122
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44