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