libpappsomspp
Library for mass spectrometry
pappso::TracePeak Class Reference

#include <tracepeak.h>

Public Member Functions

 TracePeak ()
 
 TracePeak (std::vector< DataPoint >::const_iterator it_begin, std::vector< DataPoint >::const_iterator it_end)
 construct a peak given a trace, begin and end x coordinate More...
 
 TracePeak (std::vector< DataPoint >::const_iterator it_begin, std::vector< DataPoint >::const_iterator it_end, bool remove_base)
 construct a peak given a trace, begin and end x coordinate More...
 
 TracePeak (const TracePeak &other)
 
 ~TracePeak ()
 
TracePeakCstSPtr makeTracePeakCstSPtr () const
 
DataPointgetMaxXicElement ()
 
const DataPointgetMaxXicElement () const
 
void setMaxXicElement (const DataPoint &max)
 
DataPointgetLeftBoundary ()
 
const DataPointgetLeftBoundary () const
 
void setLeftBoundary (const DataPoint &left)
 
DataPointgetRightBoundary ()
 
const DataPointgetRightBoundary () const
 
void setRightBoundary (const DataPoint &right)
 
pappso_double getArea () const
 
void setArea (pappso_double area)
 
bool containsRt (pappso::pappso_double rt) const
 
bool operator== (const TracePeak &other) const
 
TracePeakoperator= (const TracePeak &other)
 

Protected Attributes

pappso_double m_area = 0
 
DataPoint m_max
 
DataPoint m_left
 
DataPoint m_right
 

Detailed Description

@/brief Xic Peak stores peak boudaries detected from a Xic

Definition at line 39 of file tracepeak.h.

Constructor & Destructor Documentation

◆ TracePeak() [1/4]

pappso::TracePeak::TracePeak ( )

Definition at line 31 of file tracepeak.cpp.

32 {
33 }

◆ TracePeak() [2/4]

pappso::TracePeak::TracePeak ( std::vector< DataPoint >::const_iterator  it_begin,
std::vector< DataPoint >::const_iterator  it_end 
)

construct a peak given a trace, begin and end x coordinate

Definition at line 35 of file tracepeak.cpp.

37 {
38 
39  m_left = *it_begin;
40  m_right = *(it_end - 1);
41  m_max = *maxYDataPoint(it_begin, it_end);
42  m_area = areaTrace(it_begin, it_end);
43 }
DataPoint m_left
Definition: tracepeak.h:90
DataPoint m_max
Definition: tracepeak.h:89
DataPoint m_right
Definition: tracepeak.h:91
pappso_double m_area
Definition: tracepeak.h:88
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:180
double areaTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the area of a trace
Definition: trace.cpp:309

References pappso::areaTrace(), m_area, m_left, m_max, m_right, and pappso::maxYDataPoint().

◆ TracePeak() [3/4]

pappso::TracePeak::TracePeak ( std::vector< DataPoint >::const_iterator  it_begin,
std::vector< DataPoint >::const_iterator  it_end,
bool  remove_base 
)

construct a peak given a trace, begin and end x coordinate

Parameters
it_beginbegining of trace
it_endend of trace
remove_baseif true, remove the base peak signal

Definition at line 45 of file tracepeak.cpp.

48 {
49 
50  m_left = *it_begin;
51  m_right = *(it_end - 1);
52  m_max = *maxYDataPoint(it_begin, it_end);
53  m_area = areaTrace(it_begin, it_end);
54  if(remove_base)
55  {
56  // remove the base of this peak
57  m_area -= std::min(m_left.y, m_right.y) * (m_right.x - m_left.x);
58  if(m_area < 0)
59  m_area = 0;
60  }
61 }
pappso_double x
Definition: datapoint.h:23
pappso_double y
Definition: datapoint.h:24

References pappso::areaTrace(), m_area, m_left, m_max, m_right, pappso::maxYDataPoint(), pappso::DataPoint::x, and pappso::DataPoint::y.

◆ TracePeak() [4/4]

pappso::TracePeak::TracePeak ( const TracePeak other)

Definition at line 63 of file tracepeak.cpp.

64 {
65  m_area = other.m_area;
66  m_left = other.m_left;
67  m_right = other.m_right;
68  m_max = other.m_max;
69 }

References m_area, m_left, m_max, and m_right.

◆ ~TracePeak()

pappso::TracePeak::~TracePeak ( )

Definition at line 71 of file tracepeak.cpp.

72 {
73 }

Member Function Documentation

◆ containsRt()

bool pappso::TracePeak::containsRt ( pappso::pappso_double  rt) const

Definition at line 130 of file tracepeak.cpp.

131 {
132  if((rt >= m_left.x) && (rt <= m_right.x))
133  {
134  return (true);
135  }
136  return (false);
137 }

References m_left, m_right, pappso::rt, and pappso::DataPoint::x.

◆ getArea()

pappso_double pappso::TracePeak::getArea ( ) const

Definition at line 119 of file tracepeak.cpp.

120 {
121  return m_area;
122 };

References m_area.

◆ getLeftBoundary() [1/2]

DataPoint & pappso::TracePeak::getLeftBoundary ( )

Definition at line 93 of file tracepeak.cpp.

94 {
95  return m_left;
96 };

References m_left.

Referenced by pappso::QCPXic::drawXicPeakBorders().

◆ getLeftBoundary() [2/2]

const DataPoint & pappso::TracePeak::getLeftBoundary ( ) const

Definition at line 147 of file tracepeak.cpp.

148 {
149  return m_left;
150 }

References m_left.

◆ getMaxXicElement() [1/2]

DataPoint & pappso::TracePeak::getMaxXicElement ( )

Definition at line 83 of file tracepeak.cpp.

84 {
85  return m_max;
86 };

References m_max.

Referenced by pappso::QCPXic::drawXicPeakBorders().

◆ getMaxXicElement() [2/2]

const DataPoint & pappso::TracePeak::getMaxXicElement ( ) const

Definition at line 141 of file tracepeak.cpp.

142 {
143  return m_max;
144 }

References m_max.

◆ getRightBoundary() [1/2]

DataPoint & pappso::TracePeak::getRightBoundary ( )

Definition at line 104 of file tracepeak.cpp.

105 {
106  return m_right;
107 };

References m_right.

Referenced by pappso::QCPXic::drawXicPeakBorders().

◆ getRightBoundary() [2/2]

const DataPoint & pappso::TracePeak::getRightBoundary ( ) const

Definition at line 109 of file tracepeak.cpp.

110 {
111  return m_right;
112 };

References m_right.

◆ makeTracePeakCstSPtr()

TracePeakCstSPtr pappso::TracePeak::makeTracePeakCstSPtr ( ) const

Definition at line 77 of file tracepeak.cpp.

78 {
79  return std::make_shared<const TracePeak>(*this);
80 }

◆ operator=()

TracePeak & pappso::TracePeak::operator= ( const TracePeak other)

Definition at line 161 of file tracepeak.cpp.

162 {
163  if(this == &other)
164  return *this;
165 
166  m_area = other.m_area;
167  m_max = other.m_max;
168  m_left = other.m_left;
169  m_right = other.m_right;
170 
171  return *this;
172 }

References m_area, m_left, m_max, and m_right.

◆ operator==()

bool pappso::TracePeak::operator== ( const TracePeak other) const

Definition at line 154 of file tracepeak.cpp.

155 {
156  return ((m_area == other.m_area) && (m_max == other.m_max) &&
157  (m_left == other.m_left) && (m_right == other.m_right));
158 }

References m_area, m_left, m_max, and m_right.

◆ setArea()

void pappso::TracePeak::setArea ( pappso_double  area)

Definition at line 124 of file tracepeak.cpp.

125 {
126  m_area = area;
127 };

References m_area.

◆ setLeftBoundary()

void pappso::TracePeak::setLeftBoundary ( const DataPoint left)

Definition at line 98 of file tracepeak.cpp.

99 {
100  m_left = left;
101 };

References m_left.

◆ setMaxXicElement()

void pappso::TracePeak::setMaxXicElement ( const DataPoint max)

Definition at line 88 of file tracepeak.cpp.

89 {
90  m_max = max;
91 };
@ max
maximum of intensities

References m_max, and pappso::max.

◆ setRightBoundary()

void pappso::TracePeak::setRightBoundary ( const DataPoint right)

Definition at line 114 of file tracepeak.cpp.

115 {
116  m_right = right;
117 };

References m_right.

Member Data Documentation

◆ m_area

pappso_double pappso::TracePeak::m_area = 0
protected

Definition at line 88 of file tracepeak.h.

Referenced by TracePeak(), getArea(), operator=(), operator==(), and setArea().

◆ m_left

DataPoint pappso::TracePeak::m_left
protected

◆ m_max

DataPoint pappso::TracePeak::m_max
protected

Definition at line 89 of file tracepeak.h.

Referenced by TracePeak(), getMaxXicElement(), operator=(), operator==(), and setMaxXicElement().

◆ m_right

DataPoint pappso::TracePeak::m_right
protected

The documentation for this class was generated from the following files: