libpappsomspp
Library for mass spectrometry
trace.cpp
Go to the documentation of this file.
1 #include <numeric>
2 #include <limits>
3 #include <vector>
4 #include <map>
5 #include <cmath>
6 #include <algorithm>
7 
8 #include <QDebug>
9 
10 #include "trace.h"
11 #include "maptrace.h"
12 #include "../processing/combiners/tracepluscombiner.h"
13 #include "../processing/combiners/traceminuscombiner.h"
14 #include "../types.h"
15 #include "../pappsoexception.h"
16 #include "../exception/exceptionoutofrange.h"
17 #include "../exception/exceptionnotpossible.h"
18 #include "../processing/filters/filterresample.h"
19 #include "../processing/filters/filterpass.h"
20 
21 
22 int traceMetaTypeId = qRegisterMetaType<pappso::Trace>("pappso::Trace");
23 int tracePtrMetaTypeId = qRegisterMetaType<pappso::Trace *>("pappso::Trace *");
24 
25 
26 namespace pappso
27 {
28 
29 std::vector<DataPoint>::iterator
30 findFirstEqualOrGreaterX(std::vector<DataPoint>::iterator begin,
31  std::vector<DataPoint>::iterator end,
32  const double &value)
33 {
34  return std::find_if(begin, end, [value](const DataPoint &to_compare) {
35  if(to_compare.x < value)
36  {
37  return false;
38  }
39  return true;
40  });
41 }
42 
43 std::vector<DataPoint>::const_iterator
44 findFirstEqualOrGreaterX(std::vector<DataPoint>::const_iterator begin,
45  std::vector<DataPoint>::const_iterator end,
46  const double &value)
47 {
48  return std::find_if(begin, end, [value](const DataPoint &to_compare) {
49  if(to_compare.x < value)
50  {
51  return false;
52  }
53  return true;
54  });
55 }
56 
57 std::vector<DataPoint>::iterator
58 findFirstGreaterX(std::vector<DataPoint>::iterator begin,
59  std::vector<DataPoint>::iterator end,
60  const double &value)
61 {
62  return std::find_if(begin, end, [value](const DataPoint &to_compare) {
63  if(to_compare.x > value)
64  {
65  return true;
66  }
67  return false;
68  });
69 }
70 
71 std::vector<DataPoint>::const_iterator
72 findFirstGreaterX(std::vector<DataPoint>::const_iterator begin,
73  std::vector<DataPoint>::const_iterator end,
74  const double &value)
75 {
76  return std::find_if(begin, end, [value](const DataPoint &to_compare) {
77  if(to_compare.x > value)
78  {
79  return true;
80  }
81  return false;
82  });
83 }
84 
85 
86 std::vector<DataPoint>::iterator
87 findDifferentYvalue(std::vector<DataPoint>::iterator begin,
88  std::vector<DataPoint>::iterator end,
89  const double &y_value)
90 {
91  return std::find_if(begin, end, [y_value](const DataPoint &to_compare) {
92  if(to_compare.y != y_value)
93  {
94  return true;
95  }
96  return false;
97  });
98 }
99 
100 std::vector<DataPoint>::const_iterator
101 findDifferentYvalue(std::vector<DataPoint>::const_iterator begin,
102  std::vector<DataPoint>::const_iterator end,
103  const double &y_value)
104 {
105  return std::find_if(begin, end, [y_value](const DataPoint &to_compare) {
106  if(to_compare.y != y_value)
107  {
108  return true;
109  }
110  return false;
111  });
112 }
113 
114 
115 std::vector<DataPoint>::const_iterator
116 minYDataPoint(std::vector<DataPoint>::const_iterator begin,
117  std::vector<DataPoint>::const_iterator end)
118 {
119  return std::min_element(
120  begin, end, [](const DataPoint &a, const DataPoint &b) {
121  return a.y < b.y;
122  });
123 }
124 
125 
126 std::vector<DataPoint>::iterator
127 minYDataPoint(std::vector<DataPoint>::iterator begin,
128  std::vector<DataPoint>::iterator end)
129 {
130  return std::min_element(
131  begin, end, [](const DataPoint &a, const DataPoint &b) {
132  return a.y < b.y;
133  });
134 }
135 
136 
137 std::vector<DataPoint>::const_iterator
138 maxYDataPoint(std::vector<DataPoint>::const_iterator begin,
139  std::vector<DataPoint>::const_iterator end)
140 {
141  return std::max_element(
142  begin, end, [](const DataPoint &a, const DataPoint &b) {
143  return a.y < b.y;
144  });
145 }
146 
147 
148 std::vector<DataPoint>::iterator
149 maxYDataPoint(std::vector<DataPoint>::iterator begin,
150  std::vector<DataPoint>::iterator end)
151 {
152  return std::max_element(
153  begin, end, [](const DataPoint &a, const DataPoint &b) {
154  return a.y < b.y;
155  });
156 }
157 
158 
159 std::vector<DataPoint>::const_iterator
161  std::vector<DataPoint>::const_iterator begin)
162 {
163  if(begin == trace.end())
164  return begin;
165  auto it = begin + 1;
166  auto result = begin;
167  while((it != trace.end()) && (it->y <= result->y))
168  {
169  it++;
170  result++;
171  }
172  return result;
173 }
174 
175 std::vector<DataPoint>::const_iterator
177  std::vector<DataPoint>::const_iterator begin)
178 {
179  if(begin == trace.begin())
180  return begin;
181  auto it = begin - 1;
182  auto result = begin;
183  while((it != trace.begin()) && (it->y <= result->y))
184  {
185  it--;
186  result--;
187  }
188  return result;
189 }
190 
191 
192 double
193 sumYTrace(std::vector<DataPoint>::const_iterator begin,
194  std::vector<DataPoint>::const_iterator end,
195  double init)
196 {
197  return std::accumulate(
198  begin, end, init, [](double a, const DataPoint &b) { return a + b.y; });
199 }
200 
201 double
202 meanYTrace(std::vector<DataPoint>::const_iterator begin,
203  std::vector<DataPoint>::const_iterator end)
204 {
205  pappso_double nb_element = distance(begin, end);
206  if(nb_element == 0)
207  throw ExceptionOutOfRange(
208  QObject::tr("unable to compute mean on a trace of size 0"));
209  return (sumYTrace(begin, end, 0) / nb_element);
210 }
211 
212 double
213 medianYTrace(std::vector<DataPoint>::const_iterator begin,
214  std::vector<DataPoint>::const_iterator end)
215 {
216  pappso_double nb_element = distance(begin, end);
217  if(nb_element == 0)
218  throw ExceptionOutOfRange(
219  QObject::tr("unable to compute median on a trace of size 0"));
220 
221  std::vector<DataPoint> data(begin, end);
222  std::nth_element(
223  data.begin(),
224  data.begin() + data.size() / 2,
225  data.end(),
226  [](const DataPoint &a, const DataPoint &b) { return a.y < b.y; });
227  return data[data.size() / 2].y;
228 }
229 
230 double
231 areaTrace(std::vector<DataPoint>::const_iterator begin,
232  std::vector<DataPoint>::const_iterator end)
233 {
234 
235  if(begin == end)
236  return 0;
237  auto previous = begin;
238  auto next = begin + 1;
239  double area = 0;
240  while(next != end)
241  {
242  area += ((next->x - previous->x) * (previous->y + next->y)) / (double)2;
243  previous++;
244  next++;
245  }
246  return area;
247 }
248 
249 
250 Trace
251 flooredLocalMaxima(std::vector<DataPoint>::const_iterator begin,
252  std::vector<DataPoint>::const_iterator end,
253  double y_floor)
254 {
255  Trace local_maxima_trace;
256 
257  Trace single_peak_trace;
258 
259  DataPoint previous_data_point;
260 
261  for(auto iter = begin; iter != end; ++iter)
262  {
263  DataPoint iterated_data_point(iter->x, iter->y);
264 
265  // qDebug().noquote() << "Current data point:"
266  //<< iterated_data_point.toString();
267 
268  if(iterated_data_point.y < y_floor)
269  {
270  // qDebug() << "under the floor";
271 
272  if(single_peak_trace.size())
273  {
274  // qDebug() << "There was a single peak trace cooking";
275 
276  local_maxima_trace.push_back(single_peak_trace.maxYDataPoint());
277 
278  // qDebug().noquote() << "pushed back local maximum point:"
279  //<< local_maxima_trace.back().toString();
280 
281  // Clean and set the context.
282  single_peak_trace.clear();
283 
284  previous_data_point = iterated_data_point;
285 
286  continue;
287  }
288  else
289  {
290  // qDebug() << "no single peak trace cooking";
291 
292  previous_data_point = iterated_data_point;
293 
294  continue;
295  }
296  }
297  else
298  {
299  // qDebug() << "over the floor";
300 
301  // The iterated value is greater than the y_floor value, so we need to
302  // handle it.
303 
304  if(iterated_data_point.y == previous_data_point.y)
305  {
306  // We are in a flat region, no need to change anything to the
307  // context, just skip the point.
308  continue;
309  }
310  else if(iterated_data_point.y > previous_data_point.y)
311  {
312  // qDebug().noquote() << "ascending in a peak";
313 
314  // The previously iterated y value was smaller than the presently
315  // iterated one, so we are ascending in a peak.
316 
317  // All we need to do is set the context.
318 
319  single_peak_trace.push_back(iterated_data_point);
320 
321  // qDebug().noquote() << "pushed back normal point:"
322  //<< single_peak_trace.back().toString();
323 
324  previous_data_point = iterated_data_point;
325 
326  continue;
327  }
328  else
329  {
330  // qDebug().noquote() << "started descending in a peak";
331 
332  // No, the currently iterated y value is less than the previously
333  // iterated value.
334 
335  single_peak_trace.push_back(iterated_data_point);
336 
337  // qDebug().noquote() << "pushed back normal point:"
338  //<< single_peak_trace.back().toString();
339 
340  previous_data_point = iterated_data_point;
341 
342  continue;
343  }
344  }
345  }
346  // End of
347  // for(auto iter = begin; iter != end; ++iter)
348 
349  // Attention, we might arrive here with a peak being created, we need to get
350  // its maximum if that peak is non-empty;
351 
352  if(single_peak_trace.size())
353  {
354 
355  local_maxima_trace.push_back(single_peak_trace.maxYDataPoint());
356 
357  // qDebug().noquote()
358  //<< "was cooking a peak: pushed back local maximum point:"
359  //<< local_maxima_trace.back().toString();
360  }
361 
362  return local_maxima_trace;
363 }
364 
365 
367 {
368 }
369 
370 
372  const std::vector<std::pair<pappso_double, pappso_double>> &dataPoints)
373 {
374  reserve(dataPoints.size());
375 
376  for(auto &dataPoint : dataPoints)
377  {
378  push_back(DataPoint(dataPoint));
379  }
380 
381  std::sort(begin(), end(), [](const DataPoint &a, const DataPoint &b) {
382  return (a.y < b.y);
383  });
384 }
385 
386 
387 Trace::Trace(const std::vector<DataPoint> &dataPoints)
388  : std::vector<DataPoint>(dataPoints)
389 {
390 }
391 
392 
393 Trace::Trace(const std::vector<DataPoint> &&dataPoints)
394  : std::vector<DataPoint>(std::move(dataPoints))
395 {
396  // This constructor used by the MassSpectrum && constructor.
397 }
398 
399 
400 Trace::Trace(const MapTrace &map_trace)
401 {
402  for(auto &&item : map_trace)
403  push_back(DataPoint(item.first, item.second));
404 }
405 
406 Trace::Trace(const Trace &other) : std::vector<DataPoint>(other)
407 {
408 }
409 
410 
411 Trace::Trace(const Trace &&other) : std::vector<DataPoint>(std::move(other))
412 {
413  // This constructor used by the MassSpectrum && constructor.
414 }
415 
416 
418 {
419  // Calls the destructor for each DataPoint object in the vector.
420  clear();
421 }
422 
423 
424 size_t
425 Trace::initialize(const std::vector<pappso_double> &xVector,
426  const std::vector<pappso_double> &yVector)
427 {
428  // Sanity check
429  if(xVector.size() != yVector.size())
430  throw ExceptionNotPossible(
431  "trace.cpp -- ERROR xVector and yVector must have the same size.");
432 
433  // Do not force the release of the all the vector space, because we prefer
434  // resizing. clear();
435 
436  resize(xVector.size());
437 
438  for(std::size_t iter = 0; iter < xVector.size(); ++iter)
439  {
440  push_back(DataPoint(xVector.at(iter), yVector.at(iter)));
441  }
442 
443  return size();
444 }
445 
446 
447 size_t
448 Trace::initialize(const std::map<pappso_double, pappso_double> &map)
449 {
450 
451  // Do not force the release of the all the vector space, because we prefer
452  // resizing. clear(false);
453 
454  resize(map.size());
455 
456  for(auto &&item : map)
457  {
458  push_back(DataPoint(item.first, item.second));
459  }
460 
461  return size();
462 }
463 
464 
465 size_t
467 {
468  *this = other;
469 
470  return size();
471 }
472 
473 
474 Trace &
475 Trace::operator=(const Trace &other)
476 {
477  assign(other.begin(), other.end());
478 
479  return *this;
480 }
481 
482 
483 Trace &
485 {
486  vector<DataPoint>::operator=(std::move(other));
487  return *this;
488 }
489 
490 
491 TraceSPtr
493 {
494  return std::make_shared<Trace>(*this);
495 }
496 
497 
500 {
501  return std::make_shared<const Trace>(*this);
502 }
503 
504 
505 std::vector<pappso_double>
507 {
508  std::vector<pappso_double> vector;
509 
510  for(auto &&dataPoint : *this)
511  vector.push_back(dataPoint.x);
512 
513  return vector;
514 }
515 
516 
517 std::vector<pappso_double>
519 {
520  std::vector<pappso_double> vector;
521 
522  for(auto &&dataPoint : *this)
523  vector.push_back(dataPoint.y);
524 
525  return vector;
526 }
527 
528 
529 std::map<pappso_double, pappso_double>
531 {
532  std::map<pappso_double, pappso_double> map;
533 
534  std::pair<std::map<pappso_double, pappso_double>::iterator, bool> ret;
535 
536  for(auto &&dataPoint : *this)
537  {
538  ret = map.insert(
539  std::pair<pappso_double, pappso_double>(dataPoint.x, dataPoint.y));
540 
541  if(ret.second == false)
542  {
543  qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"
544  << "It is odd that the Trace contains multiple same keys.";
545 
546  // No insertion, then increment the y value.
547  ret.first->second += dataPoint.y;
548  }
549  }
550 
551  return map;
552 }
553 
554 
555 // const DataPoint &
556 // Trace::dataPointWithX(pappso_double value) const
557 //{
558 // auto iterator =
559 // std::find_if(begin(), end(), [value](const DataPoint &dataPoint) {
560 // return (dataPoint.x == value);
561 //});
562 
563 // if(iterator != end())
564 //{
565 //// The returned data point is valid.
566 // return *iterator;
567 //}
568 // else
569 //{
570 //// The returned data point is invalid because it is not initialized.
571 // return DataPoint();
572 //}
573 //}
574 
575 
576 std::vector<DataPoint>::iterator
578 {
579  auto iterator =
580  std::find_if(begin(), end(), [value](const DataPoint &dataPoint) {
581  return (dataPoint.x == value);
582  });
583 
584  return iterator;
585 }
586 
587 
588 std::vector<DataPoint>::const_iterator
590 {
591  auto iterator =
592  std::find_if(begin(), end(), [value](const DataPoint &dataPoint) {
593  return (dataPoint.x == value);
594  });
595 
596  return iterator;
597 }
598 
599 
600 std::size_t
602 {
603  std::vector<DataPoint>::const_iterator iterator =
605 
606  if(iterator != end())
607  return std::distance(begin(), iterator);
608 
609  return std::numeric_limits<std::size_t>::max();
610 }
611 
612 
613 DataPoint
614 Trace::containsX(pappso_double value, PrecisionPtr precision_p) const
615 {
616  auto iterator = std::find_if(
617  begin(), end(), [value, precision_p](const DataPoint &data_point) {
618  if(precision_p)
619  {
620  pappso_double delta = precision_p->delta(value);
621 
622  if(data_point.x >= (value - delta) && data_point.x <= (value + delta))
623  return true;
624  else
625  return false;
626  }
627  else
628  {
629  return (data_point.x == value);
630  }
631  });
632 
633  if(iterator != end())
634  {
635  // The returned data point is valid.
636  return *iterator;
637  }
638  else
639  {
640  // The returned data point is invalid because it is not initialized.
641  return DataPoint();
642  }
643 }
644 
645 
646 const DataPoint &
648 {
649  auto dataPoint = std::min_element(
650  begin(), end(), [](const DataPoint &a, const DataPoint &b) {
651  return (b.y < a.y);
652  });
653 
654  if(dataPoint == end())
655  {
656  throw ExceptionOutOfRange(
657  QObject::tr("unable to get min peak intensity on spectrum size %1")
658  .arg(size()));
659  }
660 
661  return (*dataPoint);
662 }
663 
664 
665 const DataPoint &
667 {
668  auto dataPoint = std::max_element(
669  begin(), end(), [](const DataPoint &a, const DataPoint &b) {
670  return (a.y < b.y);
671  });
672 
673  if(dataPoint == end())
674  {
675  throw ExceptionOutOfRange(
676  QObject::tr("unable to get max peak intensity on spectrum size %1")
677  .arg(size()));
678  }
679 
680  return (*dataPoint);
681 }
682 
683 
685 Trace::minY() const
686 {
687  return minYDataPoint().y;
688 }
689 
690 
692 Trace::maxY() const
693 {
694  return maxYDataPoint().y;
695 }
696 
697 
699 Trace::sumY() const
700 {
701  // double sum = 0;
702 
703  // for(auto &&dp : m_dataPoints)
704  // sum += dp.y;
705 
706  // qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << " ()"
707  //<< "Returning sum/tic:" << sum;
708 
709  // return sum;
710 
711  return std::accumulate(begin(),
712  end(),
713  (double)0,
714  [](pappso_double sum, const DataPoint &dataPoint) {
715  return (sum + dataPoint.y);
716  });
717 }
718 
719 
721 Trace::sumY(double mzStart, double mzEnd) const
722 {
723  auto begin_it = findFirstEqualOrGreaterX(this->begin(), this->end(), mzStart);
724  return sumYTrace(
725  begin_it, findFirstGreaterX(begin_it, this->end(), mzEnd), 0);
726 }
727 
728 
730 Trace::maxY(double mzStart, double mzEnd) const
731 {
732  std::vector<DataPoint>::const_iterator begin_it =
733  findFirstEqualOrGreaterX(this->begin(), this->end(), mzStart);
734 
735  double max_y = 0;
736 
737  while(begin_it != findFirstGreaterX(begin_it, this->end(), mzEnd))
738  {
739  if(begin_it->y > max_y)
740  max_y = begin_it->y;
741  begin_it++;
742  }
743  return max_y;
744 }
745 
746 
747 void
749 {
750  std::sort(begin(), end(), [](const DataPoint &a, const DataPoint &b) {
751  return (a.x < b.x);
752  });
753 }
754 
755 
756 void
758 {
759  auto last =
760  std::unique(begin(), end(), [](const DataPoint &a, const DataPoint &b) {
761  return (a.x == b.x);
762  });
763 
764  erase(last, end());
765 }
766 
767 
768 std::vector<pappso_double>
770 {
771  std::vector<pappso_double> values;
772 
773  for(auto &&dataPoint : *this)
774  {
775  values.push_back(dataPoint.x);
776  }
777 
778  return values;
779 }
780 
781 
782 std::vector<pappso_double>
784 {
785  std::vector<pappso_double> values;
786 
787  for(auto &&dataPoint : *this)
788  {
789  values.push_back(dataPoint.y);
790  }
791 
792  return values;
793 }
794 
795 
796 QString
798 {
799  // Even if the spectrum is empty, we should return an empty string.
800  QString text;
801 
802  for(auto &&dataPoint : *this)
803  {
804  text.append(QString("%1 %2\n")
805  .arg(dataPoint.x, 0, 'f', 10)
806  .arg(dataPoint.y, 0, 'f', 10));
807  }
808 
809  return text;
810 }
811 
812 
813 Trace &
815 {
816  return filter.filter(*this);
817 }
818 
819 } // namespace pappso
pappso::moveLowerYLeftDataPoint
std::vector< DataPoint >::const_iterator moveLowerYLeftDataPoint(const Trace &trace, std::vector< DataPoint >::const_iterator begin)
Move left to the lower value.
Definition: trace.cpp:176
pappso::Trace::yValues
std::vector< pappso_double > yValues()
Definition: trace.cpp:783
pappso::Trace::maxYDataPoint
const DataPoint & maxYDataPoint() const
Definition: trace.cpp:666
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:69
pappso::moveLowerYRigthDataPoint
std::vector< DataPoint >::const_iterator moveLowerYRigthDataPoint(const Trace &trace, std::vector< DataPoint >::const_iterator begin)
Move right to the lower value.
Definition: trace.cpp:160
pappso::Trace::xToVector
std::vector< pappso_double > xToVector() const
Definition: trace.cpp:506
pappso::DataPoint::y
pappso_double y
Definition: datapoint.h:23
pappso::Trace::dataPointCstIteratorxWithX
std::vector< DataPoint >::const_iterator dataPointCstIteratorxWithX(pappso_double value) const
Definition: trace.cpp:589
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks
Definition: aa.cpp:39
trace.h
pappso::Trace::Trace
Trace()
Definition: trace.cpp:366
pappso::Trace::toString
QString toString() const
Definition: trace.cpp:797
pappso::PeptideIonNter::a
@ a
pappso::DataPoint
Definition: datapoint.h:21
pappso::Trace::initialize
size_t initialize(const std::vector< pappso_double > &xVector, const std::vector< pappso_double > &yVector)
Definition: trace.cpp:425
pappso::Trace::~Trace
virtual ~Trace()
Definition: trace.cpp:417
pappso::MapTrace
Definition: maptrace.h:33
pappso::FilterInterface
generic interface to apply a filter on a trace
Definition: filterinterface.h:58
pappso::Trace::yToVector
std::vector< pappso_double > yToVector() const
Definition: trace.cpp:518
pappso::ExceptionNotPossible
Definition: exceptionnotpossible.h:53
tracePtrMetaTypeId
int tracePtrMetaTypeId
Definition: trace.cpp:23
pappso::Trace::filter
virtual Trace & filter(const FilterInterface &filter) final
apply a filter on this trace
Definition: trace.cpp:814
pappso::Trace::sumY
pappso_double sumY() const
Definition: trace.cpp:699
pappso::flooredLocalMaxima
Trace flooredLocalMaxima(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end, double y_floor)
Definition: trace.cpp:251
pappso::ExceptionOutOfRange
Definition: exceptionoutofrange.h:53
pappso::Trace::makeTraceCstSPtr
TraceCstSPtr makeTraceCstSPtr() const
Definition: trace.cpp:499
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:132
pappso::areaTrace
double areaTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the area of a trace
Definition: trace.cpp:231
pappso::sumYTrace
double sumYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end, double init)
calculate the sum of y value of a trace
Definition: trace.cpp:193
pappso::TraceSPtr
std::shared_ptr< Trace > TraceSPtr
Definition: trace.h:119
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:138
pappso::Trace::unique
void unique()
Definition: trace.cpp:757
pappso::Trace::toMap
std::map< pappso_double, pappso_double > toMap() const
Definition: trace.cpp:530
pappso::QualifiedMassSpectrumParameter::last
@ last
pappso::DataPoint::x
pappso_double x
Definition: datapoint.h:22
pappso::Trace::makeTraceSPtr
TraceSPtr makeTraceSPtr() const
Definition: trace.cpp:492
traceMetaTypeId
int traceMetaTypeId
Definition: trace.cpp:22
pappso::Trace::sortX
void sortX()
Definition: trace.cpp:748
pappso::Trace::operator=
virtual Trace & operator=(const Trace &x)
Definition: trace.cpp:475
pappso::PrecisionBase::delta
virtual pappso_double delta(pappso_double value) const =0
pappso::findDifferentYvalue
std::vector< DataPoint >::iterator findDifferentYvalue(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &y_value)
find the first element in which Y is different of value
Definition: trace.cpp:87
maptrace.h
pappso::PrecisionBase
Definition: precision.h:65
pappso::XicExtractMethod::sum
@ sum
sum of intensities
pappso::Trace::minY
pappso_double minY() const
Definition: trace.cpp:685
pappso::Trace::minYDataPoint
const DataPoint & minYDataPoint() const
Definition: trace.cpp:647
pappso::Trace::maxY
pappso_double maxY() const
Definition: trace.cpp:692
pappso::PeptideIonNter::b
@ b
pappso::Trace::dataPointIndexWithX
std::size_t dataPointIndexWithX(pappso_double value) const
Definition: trace.cpp:601
pappso::findFirstEqualOrGreaterX
std::vector< DataPoint >::iterator findFirstEqualOrGreaterX(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &value)
find the first element in which X is equal or greater than the value searched important : it implies ...
Definition: trace.cpp:30
pappso::medianYTrace
double medianYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the median of y value of a trace
Definition: trace.cpp:213
pappso::TraceCstSPtr
std::shared_ptr< const Trace > TraceCstSPtr
Definition: trace.h:120
pappso::Trace::xValues
std::vector< pappso_double > xValues()
Definition: trace.cpp:769
pappso::Trace::containsX
DataPoint containsX(pappso_double value, PrecisionPtr precision_p=nullptr) const
Definition: trace.cpp:614
pappso::meanYTrace
double meanYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the mean of y value of a trace
Definition: trace.cpp:202
pappso::minYDataPoint
std::vector< DataPoint >::const_iterator minYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:116
pappso::findFirstGreaterX
std::vector< DataPoint >::iterator findFirstGreaterX(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &value)
find the first element in which X is greater than the value searched important : it implies that Trac...
Definition: trace.cpp:58
pappso::Trace::dataPointIteratorxWithX
std::vector< DataPoint >::iterator dataPointIteratorxWithX(pappso_double value)
Definition: trace.cpp:577