libpappsomspp
Library for mass spectrometry
pappso::MassSpectrumCombiner Class Reference

#include <massspectrumcombiner.h>

Inheritance diagram for pappso::MassSpectrumCombiner:
pappso::MassDataCombinerInterface pappso::MassSpectrumMinusCombiner pappso::MassSpectrumPlusCombiner

Public Member Functions

 MassSpectrumCombiner ()
 Construct an uninitialized instance. More...
 
 MassSpectrumCombiner (int decimal_places)
 
 MassSpectrumCombiner (std::vector< pappso_double > bins, int decimalPlaces=-1)
 
 MassSpectrumCombiner (MassSpectrumCombinerCstSPtr other)
 
 MassSpectrumCombiner (const MassSpectrumCombiner &other)
 
 MassSpectrumCombiner (const MassSpectrumCombiner &&other)
 
virtual ~MassSpectrumCombiner ()
 Destruct the instance. More...
 
void setBins (std::vector< pappso_double > bins)
 
const std::vector< pappso_double > & getBins () const
 
std::size_t binCount () const
 
QString binsAsString () const
 
- Public Member Functions inherited from pappso::MassDataCombinerInterface
 MassDataCombinerInterface (int decimal_places=-1)
 
virtual ~MassDataCombinerInterface ()
 
void setDecimalPlaces (int value)
 
int getDecimalPlaces () const
 
virtual MapTracecombine (MapTrace &map_trace, Iterator begin, Iterator end)
 
virtual MapTracecombine (MapTrace &map_trace, const Trace &trace) const =0
 
virtual MapTracecombine (MapTrace &map_trace_out, const MapTrace &map_trace_in) const =0
 

Protected Member Functions

std::vector< pappso_double >::iterator findBin (pappso_double mz)
 Find the bin that will contain mz. More...
 

Protected Attributes

std::vector< pappso_doublem_bins
 
- Protected Attributes inherited from pappso::MassDataCombinerInterface
int m_decimalPlaces = -1
 Number of decimals to use for the keys (x values) More...
 

Additional Inherited Members

- Public Types inherited from pappso::MassDataCombinerInterface
using Iterator = std::vector< const Trace * >::const_iterator
 

Detailed Description

Definition at line 28 of file massspectrumcombiner.h.

Constructor & Destructor Documentation

◆ MassSpectrumCombiner() [1/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( )

Construct an uninitialized instance.

Definition at line 28 of file massspectrumcombiner.cpp.

29 {
30 }

◆ MassSpectrumCombiner() [2/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( int  decimal_places)

Definition at line 33 of file massspectrumcombiner.cpp.

34  : MassDataCombinerInterface(decimal_places)
35 {
36 }

◆ MassSpectrumCombiner() [3/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( std::vector< pappso_double bins,
int  decimalPlaces = -1 
)

Definition at line 39 of file massspectrumcombiner.cpp.

41  : MassDataCombinerInterface(decimalPlaces)
42 {
43  m_bins.assign(bins.begin(), bins.end());
44 }
std::vector< pappso_double > m_bins

References m_bins.

◆ MassSpectrumCombiner() [4/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( MassSpectrumCombinerCstSPtr  other)

Definition at line 67 of file massspectrumcombiner.cpp.

68  : MassDataCombinerInterface(other->m_decimalPlaces)
69 {
70  m_bins.assign(other->m_bins.begin(), other->m_bins.end());
71 }

References m_bins.

◆ MassSpectrumCombiner() [5/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( const MassSpectrumCombiner other)

Definition at line 47 of file massspectrumcombiner.cpp.

48  : MassDataCombinerInterface(other.m_decimalPlaces)
49 {
50  m_bins.assign(other.m_bins.begin(), other.m_bins.end());
51 
52  //QString debug_string = QString(
53  //"Number of bins: %1\n"
54  //"First bins: %2 %3 %4 -- Last bins: %5 %6 %7\n")
55  //.arg(m_bins.size())
56  //.arg(m_bins[0], 0, 'f', 6)
57  //.arg(m_bins[1], 0, 'f', 6)
58  //.arg(m_bins[2], 0, 'f', 6)
59  //.arg(m_bins[m_bins.size() - 3], 0, 'f', 6)
60  //.arg(m_bins[m_bins.size() - 2], 0, 'f', 6)
61  //.arg(m_bins[m_bins.size() - 1], 0, 'f', 6);
62 
63  //qDebug().noquote() << debug_string;
64 }

References m_bins.

◆ MassSpectrumCombiner() [6/6]

pappso::MassSpectrumCombiner::MassSpectrumCombiner ( const MassSpectrumCombiner &&  other)

◆ ~MassSpectrumCombiner()

pappso::MassSpectrumCombiner::~MassSpectrumCombiner ( )
virtual

Destruct the instance.

Definition at line 75 of file massspectrumcombiner.cpp.

76 {
77  m_bins.clear();
78 }

References m_bins.

Member Function Documentation

◆ binCount()

std::size_t pappso::MassSpectrumCombiner::binCount ( ) const

Definition at line 109 of file massspectrumcombiner.cpp.

110 {
111  return m_bins.size();
112 }

References m_bins.

◆ binsAsString()

QString pappso::MassSpectrumCombiner::binsAsString ( ) const

Definition at line 126 of file massspectrumcombiner.cpp.

127 {
128  QString text;
129 
130  for(auto &bin : m_bins)
131  text += QString("%1\n").arg(bin, 0, 'f', 6);
132 
133  text += "\n";
134 
135  return text;
136 }

References m_bins.

◆ findBin()

std::vector< pappso_double >::iterator pappso::MassSpectrumCombiner::findBin ( pappso_double  mz)
protected

Find the bin that will contain mz.

Definition at line 117 of file massspectrumcombiner.cpp.

118 {
119  return std::find_if(m_bins.begin(), m_bins.end(), [mz](pappso_double bin) {
120  return (mz <= bin);
121  });
122 }
double pappso_double
A type definition for doubles.
Definition: types.h:49

References m_bins, and pappso::mz.

◆ getBins()

const std::vector< pappso_double > & pappso::MassSpectrumCombiner::getBins ( ) const

Definition at line 102 of file massspectrumcombiner.cpp.

103 {
104  return m_bins;
105 }

References m_bins.

◆ setBins()

void pappso::MassSpectrumCombiner::setBins ( std::vector< pappso_double bins)

Definition at line 82 of file massspectrumcombiner.cpp.

83 {
84  m_bins.assign(bins.begin(), bins.end());
85 
86  //QString debug_string = QString(
87  //"Number of bins: %1\n"
88  //"First bins: %2 %3 %4 -- Last bins: %5 %6 %7\n")
89  //.arg(m_bins.size())
90  //.arg(m_bins[0], 0, 'f', 6)
91  //.arg(m_bins[1], 0, 'f', 6)
92  //.arg(m_bins[2], 0, 'f', 6)
93  //.arg(m_bins[m_bins.size() - 3], 0, 'f', 6)
94  //.arg(m_bins[m_bins.size() - 2], 0, 'f', 6)
95  //.arg(m_bins[m_bins.size() - 1], 0, 'f', 6);
96 
97  //qDebug().noquote() << debug_string;
98 }

References m_bins.

Member Data Documentation

◆ m_bins


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