Loading...
Searching...
No Matches
pappso::MzIntegrationParams Class Reference

The MzIntegrationParams class provides the parameters definining how m/z ! More...

`#include <mzintegrationparams.h>`

## Public Member Functions

Q_INVOKABLE | MzIntegrationParams ()
Q_INVOKABLE | MzIntegrationParams (pappso::pappso_double minMz, pappso::pappso_double maxMz, BinningType binningType, int decimalPlaces, pappso::PrecisionPtr precisionPtr, int binSizeDivisor, bool removeZeroValDataPoints)
Q_INVOKABLE | MzIntegrationParams (const MzIntegrationParams &other)
virtual | ~MzIntegrationParams ()
MzIntegrationParams & | operator= (const MzIntegrationParams &other)
Q_INVOKABLE void | setSmallestMz (pappso::pappso_double value)
Q_INVOKABLE void | updateSmallestMz (pappso::pappso_double value)
pappso::pappso_double | getSmallestMz () const
Q_INVOKABLE void | setGreatestMz (pappso::pappso_double value)
Q_INVOKABLE void | updateGreatestMz (pappso::pappso_double value)
Q_INVOKABLE pappso::pappso_double | getGreatestMz () const
Q_INVOKABLE void | setBinningType (BinningType binningType)
Q_INVOKABLE BinningType | getBinningType () const
Q_INVOKABLE void | setDecimalPlaces (int decimal_places)
Q_INVOKABLE int | getDecimalPlaces () const
Q_INVOKABLE void | setPrecision (pappso::PrecisionPtr precisionPtr)
Q_INVOKABLE pappso::PrecisionPtr | getPrecision () const
void | setBinSizeDivisor (int divisor)
int | getBinSizeDivisor () const
Q_INVOKABLE void | setRemoveZeroValDataPoints (bool removeOrNot=true)
Q_INVOKABLE bool | isRemoveZeroValDataPoints () const
Q_INVOKABLE void | reset ()
| Reset the instance to default values.
Q_INVOKABLE bool | isValid () const
Q_INVOKABLE bool | hasValidMzRange () const
Q_INVOKABLE std::vector< pappso::pappso_double > | createBins ()
Q_INVOKABLE std::vector< pappso::pappso_double > | createBins (pappso::MassSpectrumCstSPtr mass_spectrum_csp)
Q_INVOKABLE QString | toString (int offset=0, const QString &spacer=QString()) const

## Private Member Functions

std::vector< double > | createArbitraryBins ()
std::vector< double > | createDataBasedBins (pappso::MassSpectrumCstSPtr massSpectrum)

## Private Attributes

pappso::pappso_double | m_smallestMz = std::numeric_limits<double>::max()
pappso::pappso_double | m_greatestMz = std::numeric_limits<double>::min()
BinningType | m_binningType = BinningType::NONE
int | m_decimalPlaces = -1
pappso::PrecisionPtr | mp_precision
int | m_binSizeDivisor = 1
bool | m_removeZeroValDataPoints = true

## Detailed Description

The MzIntegrationParams class provides the parameters definining how m/z !

Depending on the various mass spectrometer vendors, the mass spectrometry data files are structured in different ways and the software for mass data format conversion from raw files to mzML or mzXML produce mass data characterized by different behaviours.

The different characteristics of mass spectrometry data set are:

The size of the various mass spectra in the file is constant or variable;

The first m/z value of the various spectra is identical or not (that is, the spectra are root in a constant or variable root m/z value);

The m/z delta between two consecutive m/z values of a given spectrum are constant or variable;

The spectra contain or not 0-value m/z data points;

Definition at line 85 of file mzintegrationparams.h.

## Constructor & Destructor Documentation

## MzIntegrationParams() [1/3]

pappso::MzIntegrationParams::MzIntegrationParams | ( |  | ) |

Definition at line 73 of file mzintegrationparams.cpp.

{
m_binningType = BinningType::NONE;
mp_precision = pappso::PrecisionFactory::getPpmInstance(20);
}
pappso::MzIntegrationParams::m_binningType
BinningType m_binningType
Definition mzintegrationparams.h:148
pappso::MzIntegrationParams::mp_precision
pappso::PrecisionPtr mp_precision
Definition mzintegrationparams.h:156
pappso::PrecisionFactory::getPpmInstance
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition precision.cpp:150
pappso::BinningType::NONE
@ NONE
< no binning

References pappso::PrecisionFactory::getPpmInstance(), m_binningType, mp_precision, and pappso::NONE.

## MzIntegrationParams() [2/3]

pappso::MzIntegrationParams::MzIntegrationParams | ( | pappso::pappso_double | minMz,
|  | pappso::pappso_double | maxMz,
|  | BinningType | binningType,
|  | int | decimalPlaces,
|  | pappso::PrecisionPtr | precisionPtr,
|  | int | binSizeDivisor,
|  | bool | removeZeroValDataPoints
| ) |  |

Definition at line 80 of file mzintegrationparams.cpp.

: m_smallestMz(minMz),
m_greatestMz(maxMz),
m_binningType(binningType),
m_decimalPlaces(decimalPlaces),
mp_precision(precisionPtr),
m_binSizeDivisor(binSizeDivisor),
m_removeZeroValDataPoints(removeZeroValDataPoints)
{
if(mp_precision == nullptr)
mp_precision = pappso::PrecisionFactory::getPpmInstance(20);
// qDebug() << "mp_precision:" << mp_precision->toString();
}
pappso::MzIntegrationParams::m_smallestMz
pappso::pappso_double m_smallestMz
Definition mzintegrationparams.h:142
pappso::MzIntegrationParams::m_greatestMz
pappso::pappso_double m_greatestMz
Definition mzintegrationparams.h:146
pappso::MzIntegrationParams::m_binSizeDivisor
int m_binSizeDivisor
Definition mzintegrationparams.h:159
pappso::MzIntegrationParams::m_decimalPlaces
int m_decimalPlaces
Definition mzintegrationparams.h:152
pappso::MzIntegrationParams::m_removeZeroValDataPoints
bool m_removeZeroValDataPoints
Definition mzintegrationparams.h:161

References pappso::PrecisionFactory::getPpmInstance(), and mp_precision.

## MzIntegrationParams() [3/3]

pappso::MzIntegrationParams::MzIntegrationParams | ( | const MzIntegrationParams & | other | ) |

Definition at line 102 of file mzintegrationparams.cpp.

: m_smallestMz(other.m_smallestMz),
m_greatestMz(other.m_greatestMz),
m_binningType(other.m_binningType),
m_decimalPlaces(other.m_decimalPlaces),
mp_precision(other.mp_precision),
m_binSizeDivisor(other.m_binSizeDivisor),
m_removeZeroValDataPoints(other.m_removeZeroValDataPoints)
{
if(mp_precision == nullptr)
mp_precision = pappso::PrecisionFactory::getResInstance(40000);
// qDebug() << "mp_precision:" << mp_precision->toString();
}
pappso::PrecisionFactory::getResInstance
static PrecisionPtr getResInstance(pappso_double value)
get a resolution precision pointer
Definition precision.cpp:177

References pappso::PrecisionFactory::getResInstance(), and mp_precision.

## ~MzIntegrationParams()

pappso::MzIntegrationParams::~MzIntegrationParams | ( |  | ) |

virtual

Definition at line 118 of file mzintegrationparams.cpp.

{
}

## Member Function Documentation

## createArbitraryBins()

std::vector< double > pappso::MzIntegrationParams::createArbitraryBins | ( |  | ) |

private

Definition at line 382 of file mzintegrationparams.cpp.

{
// Now starts the tricky stuff. Depending on how the binning has been
// configured, we need to take diverse actions.
// qDebug() << "Bin size specification:" << mp_precision->toString();
pappso::pappso_double min_mz = m_smallestMz;
pappso::pappso_double max_mz = m_greatestMz;
// qDebug() << "m_smallestMz:" << m_smallestMz
//<< "m_greatestMz:" << m_greatestMz;
// qDebug() << QString::asprintf("min_mz: %.6f\n", min_mz)
//<< QString::asprintf("max_mz: %.6f\n", max_mz);
pappso::pappso_double binSize;
if(mp_precision->unit() == PrecisionUnit::res)
{
double resolution_based_bin_size = mp_precision->delta(min_mz);
binSize = resolution_based_bin_size / m_binSizeDivisor;
// qDebug() << "With res-based bin size, the uncorrected bin size:"
//<< resolution_based_bin_size
//<< "and the final binSize:" << binSize;
}
else
binSize = mp_precision->delta(min_mz);
// qDebug() << QString::asprintf(
//"binSize is the precision delta for min_mz: %.6f\n", binSize);
// Only compute the decimal places if they were not configured already.
if(m_decimalPlaces == -1)
{
// qDebug() << "Now checking how many decimal places are needed.";
// We want as many decimal places as there are 0s between the integral
// part of the double and the first non-0 cipher. For example, if
// binSize is 0.004, zero decimals is 2 and m_decimalPlaces is set to 3,
// because we want decimals up to 4 included.
m_decimalPlaces = pappso::Utils::zeroDecimalsInValue(binSize) + 1;
// qDebug() << "With binSize" << binSize
//<< " m_decimalPlaces was computed to be:" << m_decimalPlaces;
}
// else
// qDebug() << "m_decimalPlaces: " << m_decimalPlaces;
// Now that we have defined the value of m_decimalPlaces, let's use that
// value.
double first_mz = ceil((min_mz * std::pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
double last_mz =
ceil((max_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
// qDebug() << "After having accounted for the decimals, new min/max values:"
//<< QString::asprintf("Very first data point: %.6f\n", first_mz)
//<< QString::asprintf("Very last data point to reach: %.6f\n",
// last_mz);
// Instanciate the vector of mz double_s that we'll feed with the bins.
std::vector<pappso::pappso_double> bins;
// Store that very first value for later use in the loop.
// The bins are notking more than:
//
// 1. The first mz (that is the smallest mz value found in all the spectra
// 2. A sequence of mz values corresponding to that first mz value
// incremented by the bin size.
// Seed the root of the bin vector with the first mz value rounded above as
// requested.
pappso::pappso_double previous_mz_bin = first_mz;
bins.push_back(previous_mz_bin);
// Now continue adding mz values until we have reached the end of the
// spectrum, that is the max_mz value, as converted using the decimals to
// last_mz.
// debugCount value used below for debugging purposes.
// int debugCount = 0;
while(previous_mz_bin <= last_mz)
{
// qDebug() << "Now starting the bin creation loop.";
// Calculate dynamically the precision delta according to the current mz
// value.
// double precision_delta = mp_precision->delta(previous_mz_bin);
// qDebug() << "precision_delta: " << precision_delta;
// In certain circumstances, the bin size is not enough to properly render
// hyper-high resolution data (like the theoretical isotopic cluster data
// generated in silico). In that case, the bin size, computed using the
// precision object, is divided by the m_binSizeDivisor, which normally is
// set to 1 as the default, that is, it has no effect.
double current_mz;
if(mp_precision->unit() == PrecisionUnit::res)
current_mz = previous_mz_bin +
(mp_precision->delta(previous_mz_bin) / m_binSizeDivisor);
else
current_mz = previous_mz_bin + mp_precision->delta(previous_mz_bin);
// qDebug() << QString::asprintf(
//"previous_mzBin: %.6f and current_mz: %.6f\n",
// previous_mz_bin,
// current_mz);
// Now apply on the obtained mz value the decimals that were either set
// or computed earlier.
double current_rounded_mz =
ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
// qDebug() << QString::asprintf(
//"current_mz: %.6f and current_rounded_mz: %.6f and previous_mzBin "
//": % .6f\n ",
// current_mz,
// current_rounded_mz,
// previous_mz_bin);
// If rounding makes the new value identical to the previous one, then
// that means that we need to decrease roughness.
if(current_rounded_mz == previous_mz_bin)
{
++m_decimalPlaces;
current_rounded_mz =
ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
// qDebug().noquote()
//<< "Had to increment decimal places by one while creating the bins "
//"in BinningType::ARBITRARY mode..";
}
bins.push_back(current_rounded_mz);
// Use the local_mz value for the storage of the previous mz bin.
previous_mz_bin = current_rounded_mz;
}
#if 0
QString fileName = "/tmp/massSpecArbitraryBins.txt-at-" +
QDateTime::currentDateTime().toString("yyyyMMdd-HH-mm-ss");
qDebug() << "Writing the list of bins setup in the "
"mass spectrum in file "
<< fileName;
QFile file(fileName);
file.open(QIODevice::WriteOnly);
QTextStream fileStream(&file);
for(auto &&bin : bins)
fileStream << QString("%1\n").arg(bin, 0, 'f', 10);
fileStream.flush();
file.close();
#endif
// qDebug() << "Prepared bins with " << bins.size() << "elements."
//<< "starting with mz" << bins.front() << "ending with mz"
//<< bins.back();
return bins;
}
pappso::PrecisionBase::delta
virtual pappso_double delta(pappso_double value) const =0
pappso::PrecisionBase::unit
virtual PrecisionUnit unit() const =0
pappso::Utils::zeroDecimalsInValue
static int zeroDecimalsInValue(pappso_double value)
0.11 would return 0 (no empty decimal) 2.001 would return 2 1000.0001254 would return 3
Definition utils.cpp:82
pappso::PrecisionUnit::res
@ res
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50

References pappso::PrecisionBase::delta(), m_binSizeDivisor, m_decimalPlaces, m_greatestMz, m_smallestMz, mp_precision, pappso::res, pappso::PrecisionBase::unit(), and pappso::Utils::zeroDecimalsInValue().

Referenced by createBins(), and createBins().

## createBins() [1/2]

std::vector< double > pappso::MzIntegrationParams::createBins | ( |  | ) |

Definition at line 322 of file mzintegrationparams.cpp.

{
// qDebug() << "mp_precision:" << mp_precision->toString();
std::vector<double> bins;
if(m_binningType == BinningType::NONE)
{
// If no binning is to be performed, fine.
return bins;
}
else if(m_binningType == BinningType::ARBITRARY)
{
// Use only data in the MzIntegrationParams member data.
return createArbitraryBins();
}
else if(m_binningType == BinningType::DATA_BASED)
{
// qDebug();
qFatal("Programming error.");
}
return bins;
}
pappso::MzIntegrationParams::createArbitraryBins
std::vector< double > createArbitraryBins()
Definition mzintegrationparams.cpp:382
pappso::BinningType::DATA_BASED
@ DATA_BASED
binning based on mass spectral data
pappso::BinningType::ARBITRARY
@ ARBITRARY
binning based on arbitrary bin size value

References pappso::ARBITRARY, createArbitraryBins(), pappso::DATA_BASED, m_binningType, and pappso::NONE.

## createBins() [2/2]

std::vector< double > pappso::MzIntegrationParams::createBins | ( | pappso::MassSpectrumCstSPtr | mass_spectrum_csp | ) |

Definition at line 351 of file mzintegrationparams.cpp.

{
// qDebug();
std::vector<double> bins;
if(m_binningType == BinningType::NONE)
{
// If no binning is to be performed, fine.
return bins;
}
else if(m_binningType == BinningType::ARBITRARY)
{
// Use only data in the MzIntegrationParams member data.
return createArbitraryBins();
}
else if(m_binningType == BinningType::DATA_BASED)
{
// qDebug();
// Use the first spectrum to perform the data-based bins
return createDataBasedBins(mass_spectrum_csp);
}
return bins;
}
pappso::MzIntegrationParams::createDataBasedBins
std::vector< double > createDataBasedBins(pappso::MassSpectrumCstSPtr massSpectrum)
Definition mzintegrationparams.cpp:568

References pappso::ARBITRARY, createArbitraryBins(), createDataBasedBins(), pappso::DATA_BASED, m_binningType, and pappso::NONE.

## createDataBasedBins()

std::vector< double > pappso::MzIntegrationParams::createDataBasedBins | ( | pappso::MassSpectrumCstSPtr | massSpectrum | ) |

private

Definition at line 568 of file mzintegrationparams.cpp.

{
// qDebug();
// The bins in *this mass spectrum must be calculated starting from the
// data in the mass_spectrum_csp parameter.
// Instanciate the vector of mz double_s that we'll feed with the bins.
std::vector<pappso::pappso_double> bins;
if(mass_spectrum_csp->size() < 2)
return bins;
// Make sure the spectrum is sorted, as this functions takes for granted
// that the DataPoint instances are sorted in ascending x (== mz) value
// order.
pappso::MassSpectrum local_mass_spectrum = *mass_spectrum_csp;
local_mass_spectrum.sortMz();
pappso::pappso_double min_mz = m_smallestMz;
// qDebug() << "The min_mz:" << min_mz;
if(m_decimalPlaces != -1)
min_mz = ceil((min_mz * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
// Two values for the definition of a MassSpectrumBin.
// The first value of the mz range that defines the bin. This value is part
// of the bin.
pappso::pappso_double start_mz_in = min_mz;
// The second value of the mz range that defines the bin. This value is
// *not* part of the bin.
pappso::pappso_double end_mz_out;
std::vector<pappso::DataPoint>::const_iterator it =
local_mass_spectrum.begin();
pappso::pappso_double prev_mz = it->x;
if(m_decimalPlaces != -1)
prev_mz = ceil((prev_mz * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
++it;
while(it != local_mass_spectrum.end())
{
pappso::pappso_double next_mz = it->x;
if(m_decimalPlaces != -1)
next_mz = ceil((next_mz * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
pappso::pappso_double step = next_mz - prev_mz;
end_mz_out = start_mz_in + step;
if(m_decimalPlaces != -1)
end_mz_out = ceil((end_mz_out * pow(10, m_decimalPlaces)) - 0.49) /
pow(10, m_decimalPlaces);
// The data point that is crafted has a 0 y-value. The binning must
// indeed not create artificial intensity data.
// qDebug() << "Pushing back bin:" << start_mz_in << end_mz_out;
bins.push_back(start_mz_in);
// Prepare next bin
start_mz_in = end_mz_out;
// Update prev_mz to be the current one for next iteration.
prev_mz = next_mz;
// Now got the next DataPoint instance.
++it;
}
#if 0
QString fileName = "/tmp/massSpecDataBasedBins.txt";
qDebug() << "Writing the list of bins setup in the "
"mass spectrum in file "
<< fileName;
QFile file(fileName);
file.open(QIODevice::WriteOnly);
QTextStream fileStream(&file);
for(auto &&bin : m_bins)
fileStream << QString("[%1-%2]\n")
.arg(bin.startMzIn, 0, 'f', 10)
.arg(bin.endMzOut, 0, 'f', 10);
fileStream.flush();
file.close();
qDebug() << "elements."
<< "starting with mz" << m_bins.front().startMzIn << "ending with mz"
<< m_bins.back().endMzOut;
#endif
return bins;
}
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:73
pappso::MassSpectrum::sortMz
void sortMz()
Sort the DataPoint instances of this spectrum.
Definition massspectrum.cpp:207

References m_decimalPlaces, m_smallestMz, and pappso::MassSpectrum::sortMz().

Referenced by createBins().

## getBinningType()

BinningType pappso::MzIntegrationParams::getBinningType | ( |  | ) | const

Definition at line 197 of file mzintegrationparams.cpp.

{
return m_binningType;
}

References m_binningType.

## getBinSizeDivisor()

int pappso::MzIntegrationParams::getBinSizeDivisor | ( |  | ) | const

Definition at line 240 of file mzintegrationparams.cpp.

{
return m_binSizeDivisor;
}

References m_binSizeDivisor.

## getDecimalPlaces()

int pappso::MzIntegrationParams::getDecimalPlaces | ( |  | ) | const

Definition at line 211 of file mzintegrationparams.cpp.

{
return m_decimalPlaces;
}

References m_decimalPlaces.

## getGreatestMz()

pappso::pappso_double pappso::MzIntegrationParams::getGreatestMz | ( |  | ) | const

Definition at line 183 of file mzintegrationparams.cpp.

{
return m_greatestMz;
}

References m_greatestMz.

## getPrecision()

pappso::PrecisionPtr pappso::MzIntegrationParams::getPrecision | ( |  | ) | const

Definition at line 226 of file mzintegrationparams.cpp.

{
return mp_precision;
}

References mp_precision.

## getSmallestMz()

pappso::pappso_double pappso::MzIntegrationParams::getSmallestMz | ( |  | ) | const

Definition at line 162 of file mzintegrationparams.cpp.

{
return m_smallestMz;
}

References m_smallestMz.

## hasValidMzRange()

bool pappso::MzIntegrationParams::hasValidMzRange | ( |  | ) | const

Definition at line 314 of file mzintegrationparams.cpp.

{
return (m_smallestMz != std::numeric_limits<double>::max()) &&
(m_greatestMz != std::numeric_limits<double>::min());
}

References m_greatestMz, and m_smallestMz.

## isRemoveZeroValDataPoints()

bool pappso::MzIntegrationParams::isRemoveZeroValDataPoints | ( |  | ) | const

Definition at line 254 of file mzintegrationparams.cpp.

{
return m_removeZeroValDataPoints;
}

References m_removeZeroValDataPoints.

## isValid()

bool pappso::MzIntegrationParams::isValid | ( |  | ) | const

Definition at line 277 of file mzintegrationparams.cpp.

{
int errors = 0;
if(!m_binSizeDivisor)
errors += 1;
if(m_binningType != BinningType::NONE)
{
// qDebug() << "m_smallestMz:" << m_smallestMz;
// qDebug() << "smallest is max:" << (m_smallestMz ==
// std::numeric_limits<double>::max());
errors += (m_smallestMz == std::numeric_limits<double>::max() ? 1 : 0);
// qDebug() << "m_greatestMz:" << m_greatestMz;
// qDebug() << "greatest is min:" << (m_greatestMz ==
// std::numeric_limits<double>::min());
errors += (m_greatestMz == std::numeric_limits<double>::min() ? 1 : 0);
// if(mp_precision != nullptr)
// qDebug() << mp_precision->toString();
errors += (mp_precision == nullptr ? 1 : 0);
}
if(errors)
{
qDebug()
<< "The m/z integration parameters are not valid or do not apply...";
}
return !errors;
}

References m_binningType, m_binSizeDivisor, m_greatestMz, m_smallestMz, mp_precision, and pappso::NONE.

## operator=()

MzIntegrationParams & pappso::MzIntegrationParams::operator= | ( | const MzIntegrationParams & | other | ) |

Definition at line 124 of file mzintegrationparams.cpp.

{
if(this == &other)
return *this;
m_smallestMz = other.m_smallestMz;
m_greatestMz = other.m_greatestMz;
m_binningType = other.m_binningType;
m_decimalPlaces = other.m_decimalPlaces;
mp_precision = other.mp_precision;
if(mp_precision == nullptr)
mp_precision = pappso::PrecisionFactory::getPpmInstance(20);
m_binSizeDivisor = other.m_binSizeDivisor;
m_removeZeroValDataPoints = other.m_removeZeroValDataPoints;
return *this;
}

References pappso::PrecisionFactory::getPpmInstance(), m_binningType, m_binSizeDivisor, m_decimalPlaces, m_greatestMz, m_removeZeroValDataPoints, m_smallestMz, and mp_precision.

## reset()

void pappso::MzIntegrationParams::reset | ( |  | ) |

Reset the instance to default values.

Definition at line 262 of file mzintegrationparams.cpp.

{
m_smallestMz = std::numeric_limits<double>::min();
m_greatestMz = std::numeric_limits<double>::min();
m_binningType = BinningType::NONE;
// Special case for this member datum
mp_precision = pappso::PrecisionFactory::getPpmInstance(20);
m_binSizeDivisor = 1;
m_removeZeroValDataPoints = false;
}

References pappso::PrecisionFactory::getPpmInstance(), m_binningType, m_binSizeDivisor, m_greatestMz, m_removeZeroValDataPoints, m_smallestMz, mp_precision, and pappso::NONE.

## setBinningType()

void pappso::MzIntegrationParams::setBinningType | ( | BinningType | binningType | ) |

Definition at line 190 of file mzintegrationparams.cpp.

{
m_binningType = binningType;
}

References m_binningType.

## setBinSizeDivisor()

void pappso::MzIntegrationParams::setBinSizeDivisor | ( | int | divisor | ) |

Definition at line 233 of file mzintegrationparams.cpp.

{
m_binSizeDivisor = divisor;
}

References m_binSizeDivisor.

## setDecimalPlaces()

void pappso::MzIntegrationParams::setDecimalPlaces | ( | int | decimal_places | ) |

Definition at line 204 of file mzintegrationparams.cpp.

{
m_decimalPlaces = decimal_places;
}

References m_decimalPlaces.

## setGreatestMz()

void pappso::MzIntegrationParams::setGreatestMz | ( | pappso::pappso_double | value | ) |

Definition at line 169 of file mzintegrationparams.cpp.

{
m_greatestMz = value;
}

References m_greatestMz.

## setPrecision()

void pappso::MzIntegrationParams::setPrecision | ( | pappso::PrecisionPtr | precisionPtr | ) |

Definition at line 217 of file mzintegrationparams.cpp.

{
mp_precision = precisionPtr;
if(mp_precision == nullptr)
mp_precision = pappso::PrecisionFactory::getDaltonInstance(0.05);
}
pappso::PrecisionFactory::getDaltonInstance
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
Definition precision.cpp:130

References pappso::PrecisionFactory::getDaltonInstance(), and mp_precision.

## setRemoveZeroValDataPoints()

void pappso::MzIntegrationParams::setRemoveZeroValDataPoints | ( | bool | removeOrNot = `true` | ) |

Definition at line 247 of file mzintegrationparams.cpp.

{
m_removeZeroValDataPoints = removeOrNot;
}

References m_removeZeroValDataPoints.

## setSmallestMz()

void pappso::MzIntegrationParams::setSmallestMz | ( | pappso::pappso_double | value | ) |

Definition at line 148 of file mzintegrationparams.cpp.

{
m_smallestMz = value;
}

References m_smallestMz.

## toString()

QString pappso::MzIntegrationParams::toString | ( | int | offset = `0`,
|  | const QString & | spacer = `QString()`
| ) |  | const

Definition at line 683 of file mzintegrationparams.cpp.

{
QString lead;
for(int iter = 0; iter < offset; ++iter)
lead += spacer;
QString text = lead;
text += "m/z integration parameters:\n";
text += lead;
text += spacer;
if(m_smallestMz != std::numeric_limits<double>::max())
text.append(
QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
text += lead;
text += spacer;
if(m_greatestMz != std::numeric_limits<double>::min())
text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
text += lead;
text += spacer;
text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
std::map<BinningType, QString>::iterator it;
it = binningTypeMap.find(m_binningType);
if(it == binningTypeMap.end())
qFatal("Programming error.");
text += lead;
text += spacer;
text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
// Only provide the details relative to the ARBITRARY binning type.
if(m_binningType == BinningType::ARBITRARY)
{
text += lead;
text += spacer;
text += spacer;
text.append(QString("Bin nominal size: %1\n")
.arg(mp_precision->getNominal(), 0, 'f', 6));
text += lead;
text += spacer;
text += spacer;
text.append(QString("Bin size: %2\n")
.arg(mp_precision->toString().toLatin1().data()));
text += lead;
text += spacer;
text += spacer;
text.append(QString("Bin size divisor: %2\n").arg(m_binSizeDivisor));
}
// Now other data that are independent of the bin settings.
text += lead;
text += spacer;
text += QString("Remove 0-val data points: %1\n")
.arg(m_removeZeroValDataPoints ? "true" : "false");
return text;
}
pappso::PrecisionBase::toString
virtual QString toString() const =0
pappso::PrecisionBase::getNominal
virtual pappso_double getNominal() const final
Definition precision.cpp:65
pappso::binningTypeMap
std::map< BinningType, QString > binningTypeMap
Map relating the BinningType to a textual representation.
Definition mzintegrationparams.cpp:67

References pappso::ARBITRARY, pappso::binningTypeMap, pappso::PrecisionBase::getNominal(), m_binningType, m_binSizeDivisor, m_decimalPlaces, m_greatestMz, m_removeZeroValDataPoints, m_smallestMz, mp_precision, and pappso::PrecisionBase::toString().

## updateGreatestMz()

void pappso::MzIntegrationParams::updateGreatestMz | ( | pappso::pappso_double | value | ) |

Definition at line 176 of file mzintegrationparams.cpp.

{
m_greatestMz = m_greatestMz < value ? value : m_greatestMz;
}

References m_greatestMz.

## updateSmallestMz()

void pappso::MzIntegrationParams::updateSmallestMz | ( | pappso::pappso_double | value | ) |

Definition at line 155 of file mzintegrationparams.cpp.

{
m_smallestMz = m_smallestMz > value ? value : m_smallestMz;
}

References m_smallestMz.

## Member Data Documentation

## m_binningType

BinningType pappso::MzIntegrationParams::m_binningType = BinningType::NONE

private

Definition at line 148 of file mzintegrationparams.h.

Referenced by MzIntegrationParams(), createBins(), createBins(), getBinningType(), isValid(), operator=(), reset(), setBinningType(), and toString().

## m_binSizeDivisor

int pappso::MzIntegrationParams::m_binSizeDivisor = 1

private

Definition at line 159 of file mzintegrationparams.h.

Referenced by createArbitraryBins(), getBinSizeDivisor(), isValid(), operator=(), reset(), setBinSizeDivisor(), and toString().

## m_decimalPlaces

int pappso::MzIntegrationParams::m_decimalPlaces = -1

private

Definition at line 152 of file mzintegrationparams.h.

Referenced by createArbitraryBins(), createDataBasedBins(), getDecimalPlaces(), operator=(), setDecimalPlaces(), and toString().

## m_greatestMz

pappso::pappso_double pappso::MzIntegrationParams::m_greatestMz = std::numeric_limits<double>::min()

private

Definition at line 146 of file mzintegrationparams.h.

Referenced by createArbitraryBins(), getGreatestMz(), hasValidMzRange(), isValid(), operator=(), reset(), setGreatestMz(), toString(), and updateGreatestMz().

## m_removeZeroValDataPoints

bool pappso::MzIntegrationParams::m_removeZeroValDataPoints = true

private

Definition at line 161 of file mzintegrationparams.h.

Referenced by isRemoveZeroValDataPoints(), operator=(), reset(), setRemoveZeroValDataPoints(), and toString().

## m_smallestMz

pappso::pappso_double pappso::MzIntegrationParams::m_smallestMz = std::numeric_limits<double>::max()

private

Definition at line 142 of file mzintegrationparams.h.

Referenced by createArbitraryBins(), createDataBasedBins(), getSmallestMz(), hasValidMzRange(), isValid(), operator=(), reset(), setSmallestMz(), toString(), and updateSmallestMz().

## mp_precision

pappso::PrecisionPtr pappso::MzIntegrationParams::mp_precision

private

Initial value:
=
pappso::PrecisionFactory::getDaltonInstance(0.05)

Definition at line 156 of file mzintegrationparams.h.

Referenced by MzIntegrationParams(), MzIntegrationParams(), MzIntegrationParams(), createArbitraryBins(), getPrecision(), isValid(), operator=(), reset(), setPrecision(), and toString().

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

- pappsomspp/processing/combiners/mzintegrationparams.h
- pappsomspp/processing/combiners/mzintegrationparams.cpp