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 "xiccoordtims.h"
32 #include "../../exception/exceptionnotpossible.h"
33 
34 
35 namespace pappso
36 {
37 
39 {
40  scanNumBegin = other.scanNumBegin;
41  scanNumEnd = other.scanNumEnd;
42 }
43 
44 
46 {
47 }
48 
49 
52 {
53 
54  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
55 
56  xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
57 
58  return xic_coord_sp;
59 }
60 
61 
64 {
65  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
66 
67  XicCoordTims *toadd = dynamic_cast<XicCoordTims *>(to_add.get());
68 
69  if(toadd == nullptr)
70  {
72  QObject::tr("XicCoord to add is of a different type"));
73  }
74 
75  // xic_coord_sp.get()->xicSptr = xic_coord_sp.get()->xicSptr;
76 
77  xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
78  xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
79  xic_coord_sp.get()->scanNumBegin += toadd->scanNumBegin;
80  xic_coord_sp.get()->scanNumEnd += toadd->scanNumEnd;
81 
82  qDebug() << "xic_coord_sp.get()->scanNumBegin="
83  << xic_coord_sp.get()->scanNumBegin;
84  qDebug() << "xic_coord_sp.get()->scanNumEnd="
85  << xic_coord_sp.get()->scanNumEnd;
86  return xic_coord_sp;
87 }
88 
89 
91 XicCoordTims::multiplyBy(double number) const
92 {
93  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
94 
95  // xic_coord_sp.get()->xicSptr = nullptr;
96 
97  xic_coord_sp.get()->rtTarget *= number;
98  xic_coord_sp.get()->mzRange *= number;
99 
100  xic_coord_sp.get()->scanNumBegin *= number;
101  xic_coord_sp.get()->scanNumEnd *= number;
102 
103  return xic_coord_sp;
104 }
105 
107 XicCoordTims::divideBy(double number) const
108 {
109 
110  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
111 
112  // xic_coord_sp.get()->xicSptr = nullptr;
113 
114  xic_coord_sp.get()->rtTarget /= number;
115  xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
116 
117  xic_coord_sp.get()->scanNumBegin /= number;
118  xic_coord_sp.get()->scanNumEnd /= number;
119 
120  qDebug() << "xic_coord_sp.get()->scanNumBegin="
121  << xic_coord_sp.get()->scanNumBegin;
122  qDebug() << "xic_coord_sp.get()->scanNumEnd="
123  << xic_coord_sp.get()->scanNumEnd;
124  return xic_coord_sp;
125 }
126 
127 
128 void
130 {
131 
132  xicSptr = nullptr;
133 
134  rtTarget = 0;
135  mzRange = MzRange(0.0, 0.0);
136  scanNumBegin = 0;
137  scanNumEnd = 0;
138 }
139 
140 QString
142 {
143  return QString("%1 begin=%2 end=%3")
144  .arg(XicCoord::toString())
145  .arg(scanNumBegin)
146  .arg(scanNumEnd);
147 }
148 
149 } // namespace pappso
150 
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:38
std::shared_ptr< XicCoord > XicCoordSPtr
Definition: xiccoord.h:41
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.