libpappsomspp
Library for mass spectrometry
xiccoordtims.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/xiccoord/xiccoordtims.cpp
3 * \date 22/04/2021
4 * \author Olivier Langella
5 * \brief XIC coordinate in a Tims 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 <QObject>
32#include <QVariant>
33
34#include "xiccoordtims.h"
35#include "../../exception/exceptionnotpossible.h"
36
37
38namespace pappso
39{
40
42{
44 scanNumEnd = other.scanNumEnd;
45}
46
47
49{
50}
51
52
55{
56
57 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
58
59 xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
60
61 return xic_coord_sp;
62}
63
64
67{
68 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
69
70 XicCoordTims *toadd = dynamic_cast<XicCoordTims *>(to_add.get());
71
72 if(toadd == nullptr)
73 {
75 QObject::tr("XicCoord to add is of a different type"));
76 }
77
78 // xic_coord_sp.get()->xicSptr = xic_coord_sp.get()->xicSptr;
79
80 xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
81 xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
82 xic_coord_sp.get()->scanNumBegin += toadd->scanNumBegin;
83 xic_coord_sp.get()->scanNumEnd += toadd->scanNumEnd;
84
85 qDebug() << "xic_coord_sp.get()->scanNumBegin="
86 << xic_coord_sp.get()->scanNumBegin;
87 qDebug() << "xic_coord_sp.get()->scanNumEnd="
88 << xic_coord_sp.get()->scanNumEnd;
89 return xic_coord_sp;
90}
91
92
94XicCoordTims::multiplyBy(double number) const
95{
96 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
97
98 // xic_coord_sp.get()->xicSptr = nullptr;
99
100 xic_coord_sp.get()->rtTarget *= number;
101 xic_coord_sp.get()->mzRange *= number;
102
103 xic_coord_sp.get()->scanNumBegin *= number;
104 xic_coord_sp.get()->scanNumEnd *= number;
105
106 return xic_coord_sp;
107}
108
110XicCoordTims::divideBy(double number) const
111{
112
113 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
114
115 // xic_coord_sp.get()->xicSptr = nullptr;
116
117 xic_coord_sp.get()->rtTarget /= number;
118 xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
119
120 xic_coord_sp.get()->scanNumBegin /= number;
121 xic_coord_sp.get()->scanNumEnd /= number;
122
123 qDebug() << "xic_coord_sp.get()->scanNumBegin="
124 << xic_coord_sp.get()->scanNumBegin;
125 qDebug() << "xic_coord_sp.get()->scanNumEnd="
126 << xic_coord_sp.get()->scanNumEnd;
127 return xic_coord_sp;
128}
129
130
131void
133{
134
135 xicSptr = nullptr;
136
137 rtTarget = 0;
138 mzRange = MzRange(0.0, 0.0);
139 scanNumBegin = 0;
140 scanNumEnd = 0;
141}
142
143QString
145{
146 return QString("%1 begin=%2 end=%3")
147 .arg(XicCoord::toString())
148 .arg(scanNumBegin)
149 .arg(scanNumEnd);
150}
151
152
153const QVariant
155{
156 switch(param)
157 {
159 return QVariant((quint64)scanNumBegin);
160 break;
162 return QVariant((quint64)scanNumEnd);
163 break;
164 default:
165 return QVariant();
166 }
167}
168void
169XicCoordTims::scanNumBeginRangeCorrection(long start_dev, long stop_dev)
170{
171 long begin = scanNumBegin + start_dev;
172 long end = scanNumEnd + stop_dev;
173 if(begin < 0)
174 scanNumBegin = 0;
175 else
176 scanNumBegin = begin;
177 if(end < 0)
178 scanNumEnd = 0;
179 else
180 scanNumEnd = end;
181}
182} // namespace pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
XicCoordParam
Definition: xiccoord.h:50
std::shared_ptr< XicCoordTims > XicCoordTimsSPtr
Definition: xiccoordtims.h:40
std::shared_ptr< XicCoord > XicCoordSPtr
Definition: xiccoord.h:43
coordinates of the XIC to extract and the resulting XIC after extraction
Definition: xiccoordtims.h:51
void scanNumBeginRangeCorrection(long start_dev, long stop_dev)
virtual XicCoordSPtr initializeAndClone() const override
intialize the XIC and make a deep copy of object
std::size_t scanNumEnd
mobility index end
Definition: xiccoordtims.h:96
virtual XicCoordSPtr addition(XicCoordSPtr &to_add) const override
compute a new XIC coord as the sum of the given one
std::size_t scanNumBegin
mobility index begin
Definition: xiccoordtims.h:92
virtual QString toString() const override
get a description of the XIC coordinate in a string
virtual const QVariant getParam(XicCoordParam param) const override
get a specific XIC coordinate parameter
virtual void reset() override
reset to zero
virtual XicCoordSPtr divideBy(double number) const override
compute a new xic coord as a division by
virtual XicCoordSPtr multiplyBy(double number) const override
compute a new xic coord as a product by
coordinates of the XIC to extract and the resulting XIC after extraction
Definition: xiccoord.h:67
XicSPtr xicSptr
extracted xic
Definition: xiccoord.h:130
double rtTarget
the targeted retention time to extract around intended in seconds, and related to one msrun....
Definition: xiccoord.h:126
MzRange mzRange
the mass to extract
Definition: xiccoord.h:120
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition: xiccoord.cpp:116
XIC coordinate in a Tims MSrun.