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