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 
36  : XicCoord(other)
37 {
38  scanNumBegin = other.scanNumBegin;
39  scanNumEnd = other.scanNumEnd;
40 }
41 
43 {
44 }
45 
48 {
49 
50  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
51 
52  xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
53 
54  return xic_coord_sp;
55 }
56 
57 
60 {
61  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
62 
63  XicCoordTims *toadd = dynamic_cast<XicCoordTims *>(to_add.get());
64 
65  if(toadd == nullptr)
66  {
68  QObject::tr("XicCoord to add is of a different type"));
69  }
70 
71  // xic_coord_sp.get()->xicSptr = xic_coord_sp.get()->xicSptr;
72 
73  xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
74  xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
75  xic_coord_sp.get()->scanNumBegin += toadd->scanNumBegin;
76  xic_coord_sp.get()->scanNumEnd += toadd->scanNumEnd;
77 
78  qDebug() << "xic_coord_sp.get()->scanNumBegin="
79  << xic_coord_sp.get()->scanNumBegin;
80  qDebug() << "xic_coord_sp.get()->scanNumEnd="
81  << xic_coord_sp.get()->scanNumEnd;
82  return xic_coord_sp;
83 }
84 
85 
88 {
89  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
90 
91  // xic_coord_sp.get()->xicSptr = nullptr;
92 
93  xic_coord_sp.get()->rtTarget *= number;
94  xic_coord_sp.get()->mzRange *= number;
95 
96  xic_coord_sp.get()->scanNumBegin *= number;
97  xic_coord_sp.get()->scanNumEnd *= number;
98 
99  return xic_coord_sp;
100 }
101 
103 pappso::XicCoordTims::divideBy(double number) const
104 {
105 
106  XicCoordTimsSPtr xic_coord_sp = std::make_shared<XicCoordTims>(*this);
107 
108  // xic_coord_sp.get()->xicSptr = nullptr;
109 
110  xic_coord_sp.get()->rtTarget /= number;
111  xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
112 
113  xic_coord_sp.get()->scanNumBegin /= number;
114  xic_coord_sp.get()->scanNumEnd /= number;
115 
116  qDebug() << "xic_coord_sp.get()->scanNumBegin="
117  << xic_coord_sp.get()->scanNumBegin;
118  qDebug() << "xic_coord_sp.get()->scanNumEnd="
119  << xic_coord_sp.get()->scanNumEnd;
120  return xic_coord_sp;
121 }
122 
123 
124 void
126 {
127 
128  xicSptr = nullptr;
129 
130  rtTarget = 0;
131  mzRange = MzRange(0.0, 0.0);
132  scanNumBegin = 0;
133  scanNumEnd = 0;
134 }
135 
136 QString
138 {
139  return QString("%1 begin=%2 end=%3")
140  .arg(XicCoord::toString())
141  .arg(scanNumBegin)
142  .arg(scanNumEnd);
143 }
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 multiplyBy(double number) const override
compute a new xic coord as a product by
std::size_t scanNumEnd
mobility index end
Definition: xiccoordtims.h:91
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 addition(XicCoordSPtr &to_add) const override
compute a new XIC coord as the sum of the given one
virtual XicCoordSPtr initializeAndClone() const override
intialize the XIC and make a deep copy of object
coordinates of the XIC to extract and the resulting XIC after extraction
Definition: xiccoord.h:54
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition: xiccoord.cpp:115
XIC coordinate in a Tims MSrun.