libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
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
29
#include "
pappsomspp/core/msrun/private/timsmsrunreaderbase.h
"
30
#include "
pappsomspp/core/exception/exceptionnotimplemented.h
"
31
#include "
pappsomspp/core/exception/exceptioninterrupted.h
"
32
#include <QDebug>
33
#include "
../../obo/obopsims.h
"
34
#include "
../../obo/filterobopsimodmap.h
"
35
36
namespace
pappso
37
{
38
TimsMsRunReaderBase::TimsMsRunReaderBase
(
MsRunIdCstSPtr
&msrun_id_csp) :
MsRunReader
(msrun_id_csp)
39
{
40
initialize
();
41
}
42
43
TimsMsRunReaderBase::TimsMsRunReaderBase
(
const
TimsMsRunReaderBase
&msrun_reader_base)
44
:
MsRunReader
(msrun_reader_base.
getMsRunId
()),
msp_timsData
(msrun_reader_base.
msp_timsData
)
45
{
46
initialize
();
47
}
48
49
50
TimsMsRunReaderBase::~TimsMsRunReaderBase
()
51
{
52
53
msp_timsData
=
nullptr
;
54
}
55
56
void
57
TimsMsRunReaderBase::initialize
()
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
71
bool
72
TimsMsRunReaderBase::accept
(
const
QString &file_name)
const
73
{
74
qDebug() << file_name;
75
return
true
;
76
}
77
78
bool
79
TimsMsRunReaderBase::hasScanNumbers
()
const
80
{
81
return
false
;
82
}
83
84
85
bool
86
TimsMsRunReaderBase::releaseDevice
()
87
{
88
msp_timsData
=
nullptr
;
89
return
true
;
90
}
91
92
bool
93
TimsMsRunReaderBase::acquireDevice
()
94
{
95
if
(
msp_timsData
==
nullptr
)
96
{
97
initialize
();
98
}
99
return
true
;
100
}
101
102
TimsDataSp
103
TimsMsRunReaderBase::getTimsDataSPtr
()
104
{
105
acquireDevice
();
106
return
msp_timsData
;
107
}
108
109
110
Trace
111
TimsMsRunReaderBase::getTicChromatogram
()
112
{
113
// Use the Sqlite database to fetch the total ion current chromatogram (TIC
114
// chromatogram).
115
116
acquireDevice
();
117
118
// The time unit here is seconds, not minutes!!!
119
return
msp_timsData
->getTicChromatogram();
120
}
121
122
123
std::vector<double>
124
pappso::TimsMsRunReaderBase::getRetentionTimeLine
()
125
{
126
return
msp_timsData
.get()->getRetentionTimeLineInSeconds();
127
}
128
129
130
XicCoordSPtr
131
TimsMsRunReaderBase::newXicCoordSPtrFromSpectrumIndex
(std::size_t spectrum_index [[maybe_unused]],
132
pappso::PrecisionPtr
precision
133
[[maybe_unused]])
const
134
{
135
throw
ExceptionNotImplemented
(
136
QObject::tr(
"Not implemented %1 %2 %3"
).arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
137
}
138
139
XicCoordSPtr
140
TimsMsRunReaderBase::newXicCoordSPtrFromQualifiedMassSpectrum
(
141
const
pappso::QualifiedMassSpectrum
&mass_spectrum [[maybe_unused]],
142
pappso::PrecisionPtr
precision [[maybe_unused]])
const
143
{
144
throw
ExceptionNotImplemented
(
145
QObject::tr(
"Not implemented %1 %2 %3"
).arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
146
}
147
148
149
}
// namespace pappso
150
151
const
pappso::OboPsiModTerm
152
pappso::TimsMsRunReaderBase::getOboPsiModTermInstrumentModelName
()
const
153
{
154
155
pappso::FilterOboPsiModMap
psims_map;
156
157
pappso::OboPsiMs
psims_file(psims_map);
158
159
pappso::OboPsiModTerm
term;
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]
172
id: MS:1003124
173
name: timsTOF fleX
174
def: "Bruker Daltonics' timsTOF fleX" [PSI:MS]
175
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
176
177
[Term]
178
id: MS:1003229
179
name: timsTOF
180
def: "Bruker Daltonics' timsTOF." [PSI:MS]
181
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
182
183
[Term]
184
id: MS:1003230
185
name: timsTOF Pro 2
186
def: "Bruker Daltonics' timsTOF Pro 2." [PSI:MS]
187
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
188
189
[Term]
190
id: MS:1003231
191
name: timsTOF SCP
192
def: "Bruker Daltonics' timsTOF SCP." [PSI:MS]
193
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
194
195
[Term]
196
id: MS:1003383
197
name: timsTOF Ultra
198
def: "Bruker Daltonics' timsTOF Ultra." [PSI:MS]
199
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
200
201
202
[Term]
203
id: MS:1003397
204
name: timsTOF fleX MALDI-2
205
def: "Bruker Daltonics' timsTOF fleX MALDI-2." [PSI:MS]
206
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
207
208
209
[Term]
210
id: MS:1003404
211
name: timsTOF HT
212
def: "Bruker Daltonics' timsTOF HT." [PSI:MS]
213
is_a: MS:1003123 ! Bruker Daltonics timsTOF series
214
215
216
[Term]
217
id: MS:1003412
218
name: timsTOF Ultra 2
219
def: "Bruker Daltonics timsTOF Ultra 2." [PSI:MS]
220
is_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
}
pappso::ExceptionNotImplemented
Definition
exceptionnotimplemented.h:32
pappso::FilterOboPsiModMap
Definition
filterobopsimodmap.h:38
pappso::FilterOboPsiModMap::getOboPsiModTermWithAccession
const OboPsiModTerm & getOboPsiModTermWithAccession(const QString &accession) const
Definition
filterobopsimodmap.cpp:49
pappso::MsRunReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition
msrunreader.h:194
pappso::MsRunReader::MsRunReader
MsRunReader(const MsRunIdCstSPtr &ms_run_id)
Definition
msrunreader.cpp:43
pappso::MsRunReader::getMsRunId
const MsRunIdCstSPtr & getMsRunId() const
Definition
msrunreader.cpp:55
pappso::OboPsiModTerm
Definition
obopsimodterm.h:34
pappso::OboPsiModTerm::m_name
QString m_name
Definition
obopsimodterm.h:58
pappso::OboPsiMs
Definition
obopsims.h:39
pappso::PappsoException
Definition
pappsoexception.h:41
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition
qualifiedmassspectrum.h:98
pappso::TimsMsRunReaderBase::TimsMsRunReaderBase
TimsMsRunReaderBase(MsRunIdCstSPtr &msrun_id_csp)
Definition
timsmsrunreaderbase.cpp:38
pappso::TimsMsRunReaderBase::getTicChromatogram
virtual Trace getTicChromatogram() override
get a TIC chromatogram
Definition
timsmsrunreaderbase.cpp:111
pappso::TimsMsRunReaderBase::releaseDevice
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
Definition
timsmsrunreaderbase.cpp:86
pappso::TimsMsRunReaderBase::initialize
virtual void initialize() override
Definition
timsmsrunreaderbase.cpp:57
pappso::TimsMsRunReaderBase::getOboPsiModTermInstrumentModelName
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override
get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: i...
Definition
timsmsrunreaderbase.cpp:152
pappso::TimsMsRunReaderBase::newXicCoordSPtrFromSpectrumIndex
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
Definition
timsmsrunreaderbase.cpp:131
pappso::TimsMsRunReaderBase::getRetentionTimeLine
virtual std::vector< double > getRetentionTimeLine() override
retention timeline get retention times along the MSrun in seconds
Definition
timsmsrunreaderbase.cpp:124
pappso::TimsMsRunReaderBase::msp_timsData
TimsDataSp msp_timsData
Definition
timsmsrunreaderbase.h:87
pappso::TimsMsRunReaderBase::~TimsMsRunReaderBase
virtual ~TimsMsRunReaderBase()
Definition
timsmsrunreaderbase.cpp:50
pappso::TimsMsRunReaderBase::hasScanNumbers
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
Definition
timsmsrunreaderbase.cpp:79
pappso::TimsMsRunReaderBase::newXicCoordSPtrFromQualifiedMassSpectrum
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
Definition
timsmsrunreaderbase.cpp:140
pappso::TimsMsRunReaderBase::acquireDevice
virtual bool acquireDevice() override
acquire data back end device
Definition
timsmsrunreaderbase.cpp:93
pappso::TimsMsRunReaderBase::accept
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,...
Definition
timsmsrunreaderbase.cpp:72
pappso::TimsMsRunReaderBase::getTimsDataSPtr
virtual TimsDataSp getTimsDataSPtr()
give an access to the underlying raw data pointer
Definition
timsmsrunreaderbase.cpp:103
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
exceptioninterrupted.h
exceptionnotimplemented.h
filterobopsimodmap.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::MsRunIdCstSPtr
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition
msrunid.h:46
pappso::TimsDataSp
std::shared_ptr< TimsData > TimsDataSp
shared pointer on a TimsData object
Definition
timsdata.h:54
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition
xiccoord.h:44
obopsims.h
timsmsrunreaderbase.h
pappsomspp
core
msrun
private
timsmsrunreaderbase.cpp
Generated on
for libpappsomspp by
1.17.0