libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
xiccoord.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/msrun/xiccoord/xiccoord.cpp
3
* \date 22/04/2021
4
* \author Olivier Langella
5
* \brief XIC coordinate in MSrun
6
*/
7
8
9
/*******************************************************************************
10
* Copyright (c) 2021 Olivier Langella
11
*<Olivier.Langella@universite-paris-saclay.fr>.
12
*
13
* This file is part of the PAPPSOms++ library.
14
*
15
* PAPPSOms++ is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License as published by
17
* the Free Software Foundation, either version 3 of the License, or
18
* (at your option) any later version.
19
*
20
* PAPPSOms++ is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU General Public License for more details.
24
*
25
* You should have received a copy of the GNU General Public License
26
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
27
*
28
******************************************************************************/
29
30
31
#include "
xiccoord.h
"
32
#include <QVariant>
33
34
using namespace
pappso
;
35
36
pappso::XicCoord::XicCoord
()
37
:
mzRange
(
pappso_double
(1),
PrecisionFactory
::getPpmInstance(10.0)),
rtTarget
(0)
38
{
39
}
40
41
42
XicCoord::XicCoord
(
const
XicCoord
&other) :
mzRange
(other.
mzRange
),
rtTarget
(other.
rtTarget
)
43
{
44
xicSptr
= other.
xicSptr
;
45
}
46
47
XicCoord::~XicCoord
()
48
{
49
}
50
51
pappso::XicCoordSPtr
52
pappso::XicCoord::initializeAndClone
()
const
53
{
54
XicCoordSPtr
xic_coord_sp = std::make_shared<XicCoord>(*
this
);
55
56
xic_coord_sp.get()->
xicSptr
= std::make_shared<Xic>();
57
58
return
xic_coord_sp;
59
}
60
61
62
pappso::XicCoordSPtr
63
pappso::XicCoord::addition
(
const
XicCoordSPtr
&to_add)
const
64
{
65
XicCoordSPtr
xic_coord_sp = std::make_shared<XicCoord>(*
this
);
66
67
// xic_coord_sp.get()->xicSptr = nullptr;
68
69
xic_coord_sp.get()->
rtTarget
+= to_add.get()->
rtTarget
;
70
71
xic_coord_sp.get()->
mzRange
+= to_add.get()->
mzRange
;
72
73
return
xic_coord_sp;
74
}
75
76
XicCoordSPtr
77
XicCoord::multiplyBy
(
double
number)
const
78
{
79
XicCoordSPtr
xic_coord_sp = std::make_shared<XicCoord>(*
this
);
80
81
// xic_coord_sp.get()->xicSptr = nullptr;
82
83
xic_coord_sp.get()->
rtTarget
*= number;
84
xic_coord_sp.get()->
mzRange
*= number;
85
86
return
xic_coord_sp;
87
}
88
89
pappso::XicCoordSPtr
90
pappso::XicCoord::divideBy
(
double
number)
const
91
{
92
XicCoordSPtr
xic_coord_sp = std::make_shared<XicCoord>(*
this
);
93
94
// xic_coord_sp.get()->xicSptr = nullptr;
95
96
xic_coord_sp.get()->
rtTarget
/= number;
97
xic_coord_sp.get()->
mzRange
*= (double)((
double
)1 / number);
98
99
return
xic_coord_sp;
100
}
101
102
103
void
104
pappso::XicCoord::reset
()
105
{
106
107
xicSptr
=
nullptr
;
108
109
rtTarget
= 0;
110
mzRange
=
MzRange
(0.0, 0.0);
111
}
112
113
QString
114
pappso::XicCoord::toString
()
const
115
{
116
return
QString(
"mz=%1 rt=%2"
).arg(
mzRange
.toString()).arg(
rtTarget
);
117
}
118
119
120
const
QVariant
121
pappso::XicCoord::getParam
(
XicCoordParam
param [[maybe_unused]])
const
122
{
123
return
QVariant();
124
}
125
126
void
127
pappso::XicCoord::writeCborStream
(QCborStreamWriter &cbor_writer)
const
128
{
129
cbor_writer.append(QLatin1String(
"xic_coord"
));
130
cbor_writer.startMap(2);
131
cbor_writer.append(QLatin1String(
"mz_range"
));
132
cbor_writer.startArray(2);
133
cbor_writer.append(
mzRange
.lower());
134
cbor_writer.append(
mzRange
.upper());
135
cbor_writer.endArray();
136
137
cbor_writer.append(QLatin1String(
"rt"
));
138
cbor_writer.append(
rtTarget
);
139
140
cbor_writer.endMap();
141
}
pappso::MzRange
Definition
mzrange.h:46
pappso::PrecisionFactory
Definition
precision.h:127
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::XicCoordParam
XicCoordParam
Definition
xiccoord.h:51
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition
xiccoord.h:44
pappso::XicCoord::xicSptr
XicSPtr xicSptr
extracted xic
Definition
xiccoord.h:135
pappso::XicCoord::initializeAndClone
virtual XicCoordSPtr initializeAndClone() const
intialize the XIC and make a deep copy of object
Definition
xiccoord.cpp:52
pappso::XicCoord::multiplyBy
virtual XicCoordSPtr multiplyBy(double number) const
compute a new xic coord as a product by
Definition
xiccoord.cpp:77
pappso::XicCoord::addition
virtual XicCoordSPtr addition(const XicCoordSPtr &to_add) const
compute a new XIC coord as the sum of the given one
Definition
xiccoord.cpp:63
pappso::XicCoord::rtTarget
double rtTarget
the targeted retention time to extract around intended in seconds, and related to one msrun....
Definition
xiccoord.h:131
pappso::XicCoord::reset
virtual void reset()
reset to zero
Definition
xiccoord.cpp:104
pappso::XicCoord::~XicCoord
virtual ~XicCoord()
Definition
xiccoord.cpp:47
pappso::XicCoord::divideBy
virtual XicCoordSPtr divideBy(double number) const
compute a new xic coord as a division by
Definition
xiccoord.cpp:90
pappso::XicCoord::getParam
virtual const QVariant getParam(XicCoordParam param) const
get a specific XIC coordinate parameter
Definition
xiccoord.cpp:121
pappso::XicCoord::XicCoord
XicCoord()
Definition
xiccoord.cpp:36
pappso::XicCoord::mzRange
MzRange mzRange
the mass to extract
Definition
xiccoord.h:125
pappso::XicCoord::toString
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition
xiccoord.cpp:114
pappso::XicCoord::writeCborStream
virtual void writeCborStream(QCborStreamWriter &cbor_writer) const
writes xic coordinates in a cbor stream
Definition
xiccoord.cpp:127
xiccoord.h
pappsomspp
core
msrun
xiccoord
xiccoord.cpp
Generated on
for libpappsomspp by
1.17.0