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
33#include "xiccoordtims.h"
34#include "../../exception/exceptionnotpossible.h"
35
36
37namespace pappso
38{
39
41{
43 scanNumEnd = other.scanNumEnd;
44}
45
46
48{
49}
50
51
54{
55
56 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
57
58 xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
59
60 return xic_coord_sp;
61}
62
63
66{
67 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
68
69 XicCoordTims *toadd = dynamic_cast<XicCoordTims *>(to_add.get());
70
71 if(toadd == nullptr)
72 {
74 QObject::tr("XicCoord to add is of a different type"));
75 }
76
77 // xic_coord_sp.get()->xicSptr = xic_coord_sp.get()->xicSptr;
78
79 xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
80 xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
81 xic_coord_sp.get()->scanNumBegin += toadd->scanNumBegin;
82 xic_coord_sp.get()->scanNumEnd += toadd->scanNumEnd;
83
84 qDebug() << "xic_coord_sp.get()->scanNumBegin="
85 << xic_coord_sp.get()->scanNumBegin;
86 qDebug() << "xic_coord_sp.get()->scanNumEnd="
87 << xic_coord_sp.get()->scanNumEnd;
88 return xic_coord_sp;
89}
90
91
93XicCoordTims::multiplyBy(double number) const
94{
95 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
96
97 // xic_coord_sp.get()->xicSptr = nullptr;
98
99 xic_coord_sp.get()->rtTarget *= number;
100 xic_coord_sp.get()->mzRange *= number;
101
102 xic_coord_sp.get()->scanNumBegin *= number;
103 xic_coord_sp.get()->scanNumEnd *= number;
104
105 return xic_coord_sp;
106}
107
109XicCoordTims::divideBy(double number) const
110{
111
112 XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
113
114 // xic_coord_sp.get()->xicSptr = nullptr;
115
116 xic_coord_sp.get()->rtTarget /= number;
117 xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
118
119 xic_coord_sp.get()->scanNumBegin /= number;
120 xic_coord_sp.get()->scanNumEnd /= number;
121
122 qDebug() << "xic_coord_sp.get()->scanNumBegin="
123 << xic_coord_sp.get()->scanNumBegin;
124 qDebug() << "xic_coord_sp.get()->scanNumEnd="
125 << xic_coord_sp.get()->scanNumEnd;
126 return xic_coord_sp;
127}
128
129
130void
132{
133
134 xicSptr = nullptr;
135
136 rtTarget = 0;
137 mzRange = MzRange(0.0, 0.0);
138 scanNumBegin = 0;
139 scanNumEnd = 0;
140}
141
142QString
144{
145 return QString("%1 begin=%2 end=%3")
146 .arg(XicCoord::toString())
147 .arg(scanNumBegin)
148 .arg(scanNumEnd);
149}
150
151} // namespace pappso
152
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
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
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:91
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:87
virtual QString toString() const override
get a description of the XIC coordinate in a string
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:54
XicSPtr xicSptr
extracted xic
Definition: xiccoord.h:113
double rtTarget
the targeted retention time to extract around intended in seconds, and related to one msrun....
Definition: xiccoord.h:109
MzRange mzRange
the mass to extract
Definition: xiccoord.h:103
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition: xiccoord.cpp:115
XIC coordinate in a Tims MSrun.