libpappsomspp
Library for mass spectrometry
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
34using namespace pappso;
35
37 : mzRange(pappso_double(1), PrecisionFactory::getPpmInstance(10.0)), rtTarget(0)
38{
39}
40
41
43{
44 xicSptr = other.xicSptr;
45}
46
50
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
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
77XicCoord::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
90pappso::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
103void
105{
106
107 xicSptr = nullptr;
108
109 rtTarget = 0;
110 mzRange = MzRange(0.0, 0.0);
111}
112
113QString
115{
116 return QString("mz=%1 rt=%2").arg(mzRange.toString()).arg(rtTarget);
117}
118
119
120const QVariant
121pappso::XicCoord::getParam(XicCoordParam param [[maybe_unused]]) const
122{
123 return QVariant();
124}
125
126void
127pappso::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}
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
XicCoordParam
Definition xiccoord.h:51
double pappso_double
A type definition for doubles.
Definition types.h:61
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
XicSPtr xicSptr
extracted xic
Definition xiccoord.h:135
virtual XicCoordSPtr initializeAndClone() const
intialize the XIC and make a deep copy of object
Definition xiccoord.cpp:52
virtual XicCoordSPtr multiplyBy(double number) const
compute a new xic coord as a product by
Definition xiccoord.cpp:77
virtual XicCoordSPtr addition(const XicCoordSPtr &to_add) const
compute a new XIC coord as the sum of the given one
Definition xiccoord.cpp:63
double rtTarget
the targeted retention time to extract around intended in seconds, and related to one msrun....
Definition xiccoord.h:131
virtual void reset()
reset to zero
Definition xiccoord.cpp:104
virtual ~XicCoord()
Definition xiccoord.cpp:47
virtual XicCoordSPtr divideBy(double number) const
compute a new xic coord as a division by
Definition xiccoord.cpp:90
virtual const QVariant getParam(XicCoordParam param) const
get a specific XIC coordinate parameter
Definition xiccoord.cpp:121
MzRange mzRange
the mass to extract
Definition xiccoord.h:125
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition xiccoord.cpp:114
virtual void writeCborStream(QCborStreamWriter &cbor_writer) const
writes xic coordinates in a cbor stream
Definition xiccoord.cpp:127