libpappsomspp
Library for mass spectrometry
pappso::MzIntegrationParams Class Reference

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

#include <mzintegrationparams.h>

Public Member Functions

 MzIntegrationParams ()
 
 MzIntegrationParams (pappso::pappso_double minMz, pappso::pappso_double maxMz, BinningType binningType, int decimalPlaces, pappso::PrecisionPtr precisionPtr, bool applyMzShift, pappso::pappso_double mzShift, bool removeZeroValDataPoints)
 
 MzIntegrationParams (const MzIntegrationParams &other)
 
virtual ~MzIntegrationParams ()
 
MzIntegrationParamsoperator= (const MzIntegrationParams &other)
 
void setSmallestMz (pappso::pappso_double value)
 
void updateSmallestMz (pappso::pappso_double value)
 
pappso::pappso_double getSmallestMz () const
 
void setGreatestMz (pappso::pappso_double value)
 
void updateGreatestMz (pappso::pappso_double value)
 
pappso::pappso_double getGreatestMz () const
 
void setBinningType (BinningType binningType)
 
BinningType getBinningType () const
 
void setDecimalPlaces (int decimal_places)
 
int getDecimalPlaces () const
 
void setPrecision (pappso::PrecisionPtr precisionPtr)
 
pappso::PrecisionPtr getPrecision () const
 
void setApplyMzShift (bool applyMzShift)
 
bool isApplyMzShift () const
 
void setMzShift (double value)
 
double getMzShift () const
 
void setRemoveZeroValDataPoints (bool removeOrNot=true)
 
bool isRemoveZeroValDataPoints () const
 
void reset ()
 Reset the instance to default values. More...
 
bool isValid () const
 
bool hasValidMzRange () const
 
std::vector< pappso::pappso_doublecreateBins ()
 
std::vector< pappso::pappso_doublecreateBins (pappso::MassSpectrumCstSPtr mass_spectrum_csp)
 
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
 
bool m_applyMzShift = false
 
pappso::pappso_double m_mzShift = 0
 
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 84 of file mzintegrationparams.h.

Constructor & Destructor Documentation

◆ MzIntegrationParams() [1/3]

pappso::MzIntegrationParams::MzIntegrationParams ( )

Definition at line 66 of file mzintegrationparams.cpp.

67 {
70 }
pappso::PrecisionPtr mp_precision
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition: precision.cpp:149
@ 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,
bool  applyMzShift,
pappso::pappso_double  mzShift,
bool  removeZeroValDataPoints 
)

Definition at line 73 of file mzintegrationparams.cpp.

81  : m_smallestMz(minMz),
82  m_greatestMz(maxMz),
83  m_binningType(binningType),
84  m_decimalPlaces(decimalPlaces),
85  mp_precision(precisionPtr),
86  m_applyMzShift(applyMzShift),
87  m_mzShift(mzShift),
88  m_removeZeroValDataPoints(removeZeroValDataPoints)
89 {
90  if(mp_precision == nullptr)
92 }
pappso::pappso_double m_smallestMz
pappso::pappso_double m_greatestMz
pappso::pappso_double m_mzShift

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

◆ MzIntegrationParams() [3/3]

pappso::MzIntegrationParams::MzIntegrationParams ( const MzIntegrationParams other)

Definition at line 95 of file mzintegrationparams.cpp.

96  : m_smallestMz(other.m_smallestMz),
97  m_greatestMz(other.m_greatestMz),
98  m_binningType(other.m_binningType),
99  m_decimalPlaces(other.m_decimalPlaces),
100  mp_precision(other.mp_precision),
101  m_applyMzShift(other.m_applyMzShift),
102  m_mzShift(other.m_mzShift),
103  m_removeZeroValDataPoints(other.m_removeZeroValDataPoints)
104 {
105  if(mp_precision == nullptr)
107 }

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

◆ ~MzIntegrationParams()

pappso::MzIntegrationParams::~MzIntegrationParams ( )
virtual

Definition at line 110 of file mzintegrationparams.cpp.

111 {
112 }

Member Function Documentation

◆ createArbitraryBins()

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

Definition at line 383 of file mzintegrationparams.cpp.

384 {
385 
386  // qDebug();
387 
388  // Now starts the tricky stuff. Depending on how the binning has been
389  // configured, we need to take diverse actions.
390 
391  // qDebug() << "Bin size:" << mp_precision->toString();
392 
395 
396  // qDebug() << QString::asprintf("min_mz: %.6f\n", min_mz)
397  //<< QString::asprintf("max_mz: %.6f\n", max_mz);
398 
399  pappso::pappso_double binSize = mp_precision->delta(min_mz);
400 
401  // qDebug() << QString::asprintf(
402  //"binSize is the precision delta for min_mz: %.6f\n", binSize);
403 
404  // Only compute the decimal places if they were not configured already.
405  if(m_decimalPlaces == -1)
406  {
407 
408  // We want as many decimal places as there are 0s between the integral
409  // part of the double and the first non-0 cipher. For example, if
410  // binSize is 0.004, zero decimals is 2 and m_decimalPlaces is set to 3,
411  // because we want decimals up to 4 included.
412 
414 
415  // qDebug() << "With the binSize m_decimalPlaces was computed to be:"
416  //<< m_decimalPlaces;
417  }
418 
419  // Now that we have defined the value of m_decimalPlaces, let's use that
420  // value.
421 
422  double first_mz = ceil((min_mz * std::pow(10, m_decimalPlaces)) - 0.49) /
423  pow(10, m_decimalPlaces);
424  double last_mz =
425  ceil((max_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
426 
427  // qDebug() << "After having accounted for the decimals, new min/max values:"
428  //<< QString::asprintf("Very first data point: %.6f\n", first_mz)
429  //<< QString::asprintf("Very last data point to reach: %.6f\n",
430  // last_mz);
431 
432  // Instanciate the vector of mz double_s that we'll feed with the bins.
433 
434  std::vector<pappso::pappso_double> bins;
435 
436  // Store that very first value for later use in the loop.
437  // The bins are notking more than:
438  //
439  // 1. The first mz (that is the smallest mz value found in all the spectra
440  // 2. A sequence of mz values corresponding to that first mz value
441  // incremented by the bin size.
442 
443  // Seed the root of the bin vector with the first mz value rounded above as
444  // requested.
445  pappso::pappso_double previous_mz_bin = first_mz;
446 
447  bins.push_back(previous_mz_bin);
448 
449  // Now continue adding mz values until we have reached the end of the
450  // spectrum, that is the max_mz value, as converted using the decimals to
451  // last_mz.
452 
453  // debugCount value used below for debugging purposes.
454  // int debugCount = 0;
455 
456  while(previous_mz_bin <= last_mz)
457  {
458 
459  // Calculate dynamically the precision delta according to the current mz
460  // value.
461 
462  double current_mz =
463  previous_mz_bin + mp_precision->delta(previous_mz_bin);
464 
465  // qDebug() << QString::asprintf(
466  //"previous_mzBin: %.6f and current_mz: %.6f\n",
467  // previous_mz_bin,
468  // current_mz);
469 
470  // Now apply on the obtained mz value the decimals that were either set
471  // or computed earlier.
472 
473  double current_rounded_mz =
474  ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
475  pow(10, m_decimalPlaces);
476 
477  // qDebug() << QString::asprintf(
478  //"current_mz: %.6f and current_rounded_mz: %.6f and previous_mzBin "
479  //": % .6f\n ",
480  // current_mz,
481  // current_rounded_mz,
482  // previous_mz_bin);
483 
484  // If rounding makes the new value identical to the previous one, then
485  // that means that we need to decrease roughness.
486 
487  if(current_rounded_mz == previous_mz_bin)
488  {
489  ++m_decimalPlaces;
490 
491  current_rounded_mz =
492  ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
493  pow(10, m_decimalPlaces);
494 
495  qDebug().noquote()
496  << "Had to increment decimal places by one while creating the bins "
497  "in BinningType::ARBITRARY mode..";
498  }
499 
500  bins.push_back(current_rounded_mz);
501 
502  // Use the local_mz value for the storage of the previous mz bin.
503  previous_mz_bin = current_rounded_mz;
504  }
505 
506 
507 #if 0
508 
509  QString fileName = "/tmp/massSpecArbitraryBins.txt-at-" +
510  QDateTime::currentDateTime().toString("yyyyMMdd-HH-mm-ss");
511 
512  qDebug() << "Writing the list of bins setup in the "
513  "mass spectrum in file "
514  << fileName;
515 
516  QFile file(fileName);
517  file.open(QIODevice::WriteOnly);
518 
519  QTextStream fileStream(&file);
520 
521  for(auto &&bin : bins)
522  fileStream << QString("%1\n").arg(bin, 0, 'f', 10);
523 
524  fileStream.flush();
525  file.close();
526 
527 #endif
528 
529  // qDebug() << "Prepared bins with " << bins.size() << "elements."
530  //<< "starting with mz" << bins.front() << "ending with mz"
531  //<< bins.back();
532 
533  return bins;
534 }
virtual pappso_double delta(pappso_double value) const =0
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:81
double pappso_double
A type definition for doubles.
Definition: types.h:48

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

Referenced by createBins().

◆ createBins() [1/2]

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

Definition at line 323 of file mzintegrationparams.cpp.

324 {
325 
326  // qDebug();
327 
328  std::vector<double> bins;
329 
331  {
332  // If no binning is to be performed, fine.
333  return bins;
334  }
336  {
337  // Use only data in the MzIntegrationParams member data.
338  return createArbitraryBins();
339  }
341  {
342  // qDebug();
343 
344  qFatal("Programming error.");
345  }
346 
347  return bins;
348 }
std::vector< double > createArbitraryBins()
@ DATA_BASED
binning based on mass spectral data
@ 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 352 of file mzintegrationparams.cpp.

353 {
354 
355  // qDebug();
356 
357  std::vector<double> bins;
358 
360  {
361  // If no binning is to be performed, fine.
362  return bins;
363  }
365  {
366  // Use only data in the MzIntegrationParams member data.
367  return createArbitraryBins();
368  }
370  {
371  // qDebug();
372 
373  // Use the first spectrum to perform the data-based bins
374 
375  return createDataBasedBins(mass_spectrum_csp);
376  }
377 
378  return bins;
379 }
std::vector< double > createDataBasedBins(pappso::MassSpectrumCstSPtr massSpectrum)

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 538 of file mzintegrationparams.cpp.

540 {
541  // qDebug();
542 
543  // The bins in *this mass spectrum must be calculated starting from the
544  // data in the mass_spectrum_csp parameter.
545 
546  // Instanciate the vector of mz double_s that we'll feed with the bins.
547 
548  std::vector<pappso::pappso_double> bins;
549 
550  if(mass_spectrum_csp->size() < 2)
551  return bins;
552 
553  // Make sure the spectrum is sorted, as this functions takes for granted
554  // that the DataPoint instances are sorted in ascending x (== mz) value
555  // order.
556  pappso::MassSpectrum local_mass_spectrum = *mass_spectrum_csp;
557  local_mass_spectrum.sortMz();
558 
560 
561  // qDebug() << "The min_mz:" << min_mz;
562 
563  if(m_decimalPlaces != -1)
564  min_mz = ceil((min_mz * pow(10, m_decimalPlaces)) - 0.49) /
565  pow(10, m_decimalPlaces);
566 
567 
568  // Two values for the definition of a MassSpectrumBin.
569 
570  // The first value of the mz range that defines the bin. This value is part
571  // of the bin.
572  pappso::pappso_double start_mz_in = min_mz;
573 
574  // The second value of the mz range that defines the bin. This value is
575  // *not* part of the bin.
576  pappso::pappso_double end_mz_out;
577 
578  std::vector<pappso::DataPoint>::const_iterator it =
579  local_mass_spectrum.begin();
580 
581  pappso::pappso_double prev_mz = it->x;
582 
583  if(m_decimalPlaces != -1)
584  prev_mz = ceil((prev_mz * pow(10, m_decimalPlaces)) - 0.49) /
585  pow(10, m_decimalPlaces);
586 
587  ++it;
588 
589  while(it != local_mass_spectrum.end())
590  {
591  pappso::pappso_double next_mz = it->x;
592 
593  if(m_decimalPlaces != -1)
594  next_mz = ceil((next_mz * pow(10, m_decimalPlaces)) - 0.49) /
595  pow(10, m_decimalPlaces);
596 
597  pappso::pappso_double step = next_mz - prev_mz;
598  end_mz_out = start_mz_in + step;
599 
600  if(m_decimalPlaces != -1)
601  end_mz_out = ceil((end_mz_out * pow(10, m_decimalPlaces)) - 0.49) /
602  pow(10, m_decimalPlaces);
603 
604  // The data point that is crafted has a 0 y-value. The binning must
605  // indeed not create artificial intensity data.
606 
607  // qDebug() << "Pushing back bin:" << start_mz_in << end_mz_out;
608 
609  bins.push_back(start_mz_in);
610 
611  // Prepare next bin
612  start_mz_in = end_mz_out;
613 
614  // Update prev_mz to be the current one for next iteration.
615  prev_mz = next_mz;
616 
617  // Now got the next DataPoint instance.
618  ++it;
619  }
620 
621 #if 0
622 
623  QString fileName = "/tmp/massSpecDataBasedBins.txt";
624 
625  qDebug() << "Writing the list of bins setup in the "
626  "mass spectrum in file "
627  << fileName;
628 
629  QFile file(fileName);
630  file.open(QIODevice::WriteOnly);
631 
632  QTextStream fileStream(&file);
633 
634  for(auto &&bin : m_bins)
635  fileStream << QString("[%1-%2]\n")
636  .arg(bin.startMzIn, 0, 'f', 10)
637  .arg(bin.endMzOut, 0, 'f', 10);
638 
639  fileStream.flush();
640  file.close();
641 
642  qDebug() << "elements."
643  << "starting with mz" << m_bins.front().startMzIn << "ending with mz"
644  << m_bins.back().endMzOut;
645 
646 #endif
647 
648  return bins;
649 }
Class to represent a mass spectrum.
Definition: massspectrum.h:71
void sortMz()
Sort the DataPoint instances of this spectrum.

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

Referenced by createBins().

◆ getBinningType()

BinningType pappso::MzIntegrationParams::getBinningType ( ) const

Definition at line 187 of file mzintegrationparams.cpp.

188 {
189  return m_binningType;
190 }

References m_binningType.

◆ getDecimalPlaces()

int pappso::MzIntegrationParams::getDecimalPlaces ( ) const

Definition at line 200 of file mzintegrationparams.cpp.

201 {
202  return m_decimalPlaces;
203 }

References m_decimalPlaces.

◆ getGreatestMz()

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

Definition at line 175 of file mzintegrationparams.cpp.

176 {
177  return m_greatestMz;
178 }

References m_greatestMz.

◆ getMzShift()

double pappso::MzIntegrationParams::getMzShift ( ) const

Definition at line 257 of file mzintegrationparams.cpp.

258 {
259  return m_mzShift;
260 }

References m_mzShift.

◆ getPrecision()

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

Definition at line 215 of file mzintegrationparams.cpp.

216 {
217  return mp_precision;
218 }

References mp_precision.

◆ getSmallestMz()

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

Definition at line 154 of file mzintegrationparams.cpp.

155 {
156  return m_smallestMz;
157 }

References m_smallestMz.

◆ hasValidMzRange()

bool pappso::MzIntegrationParams::hasValidMzRange ( ) const

Definition at line 315 of file mzintegrationparams.cpp.

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

References m_greatestMz, and m_smallestMz.

◆ isApplyMzShift()

bool pappso::MzIntegrationParams::isApplyMzShift ( ) const

Definition at line 229 of file mzintegrationparams.cpp.

230 {
231  return m_applyMzShift;
232 }

References m_applyMzShift.

◆ isRemoveZeroValDataPoints()

bool pappso::MzIntegrationParams::isRemoveZeroValDataPoints ( ) const

Definition at line 243 of file mzintegrationparams.cpp.

244 {
246 }

References m_removeZeroValDataPoints.

◆ isValid()

bool pappso::MzIntegrationParams::isValid ( ) const

Definition at line 281 of file mzintegrationparams.cpp.

282 {
283  int errors = 0;
284 
286  {
287  // qDebug() << "m_smallestMz:" << m_smallestMz;
288  // qDebug() << "smallest is max:" << (m_smallestMz ==
289  // std::numeric_limits<double>::max());
290 
291  errors += (m_smallestMz == std::numeric_limits<double>::max() ? 1 : 0);
292 
293  // qDebug() << "m_greatestMz:" << m_greatestMz;
294  // qDebug() << "greatest is min:" << (m_greatestMz ==
295  // std::numeric_limits<double>::min());
296  errors += (m_greatestMz == std::numeric_limits<double>::min() ? 1 : 0);
297 
298  // if(mp_precision != nullptr)
299  // qDebug() << mp_precision->toString();
300 
301  errors += (mp_precision == nullptr ? 1 : 0);
302  }
303 
304  if(errors)
305  {
306  qDebug()
307  << "The m/z integration parameters are not valid or do not apply...";
308  }
309 
310  return !errors;
311 }

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

◆ operator=()

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

Definition at line 116 of file mzintegrationparams.cpp.

117 {
118  if(this == &other)
119  return *this;
120 
121  m_smallestMz = other.m_smallestMz;
122  m_greatestMz = other.m_greatestMz;
123  m_binningType = other.m_binningType;
124 
125  m_decimalPlaces = other.m_decimalPlaces;
126 
127  mp_precision = other.mp_precision;
128  if(mp_precision == nullptr)
130 
131  m_applyMzShift = other.m_applyMzShift;
132  m_mzShift = other.m_mzShift;
133  m_removeZeroValDataPoints = other.m_removeZeroValDataPoints;
134 
135  return *this;
136 }

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

◆ reset()

void pappso::MzIntegrationParams::reset ( )

Reset the instance to default values.

Definition at line 265 of file mzintegrationparams.cpp.

266 {
267  m_smallestMz = std::numeric_limits<double>::min();
268  m_greatestMz = std::numeric_limits<double>::min();
270 
271  // Special case for this member datum
273 
274  m_applyMzShift = false;
275  m_mzShift = 0;
277 }

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

◆ setApplyMzShift()

void pappso::MzIntegrationParams::setApplyMzShift ( bool  applyMzShift)

Definition at line 222 of file mzintegrationparams.cpp.

223 {
224  m_applyMzShift = applyMzShift;
225 }

References m_applyMzShift.

◆ setBinningType()

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

Definition at line 181 of file mzintegrationparams.cpp.

182 {
183  m_binningType = binningType;
184 }

References m_binningType.

◆ setDecimalPlaces()

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

Definition at line 193 of file mzintegrationparams.cpp.

194 {
195  m_decimalPlaces = decimal_places;
196 }

References m_decimalPlaces.

◆ setGreatestMz()

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

Definition at line 161 of file mzintegrationparams.cpp.

162 {
163  m_greatestMz = value;
164 }

References m_greatestMz.

◆ setMzShift()

void pappso::MzIntegrationParams::setMzShift ( double  value)

Definition at line 250 of file mzintegrationparams.cpp.

251 {
252  m_mzShift = value;
253 }

References m_mzShift.

◆ setPrecision()

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

Definition at line 206 of file mzintegrationparams.cpp.

207 {
208  mp_precision = precisionPtr;
209 
210  if(mp_precision == nullptr)
212 }
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
Definition: precision.cpp:129

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

◆ setRemoveZeroValDataPoints()

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

Definition at line 236 of file mzintegrationparams.cpp.

237 {
238  m_removeZeroValDataPoints = removeOrNot;
239 }

References m_removeZeroValDataPoints.

◆ setSmallestMz()

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

Definition at line 140 of file mzintegrationparams.cpp.

141 {
142  m_smallestMz = value;
143 }

References m_smallestMz.

◆ toString()

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

Definition at line 653 of file mzintegrationparams.cpp.

654 {
655  QString lead;
656 
657  for(int iter = 0; iter < offset; ++iter)
658  lead += spacer;
659 
660  QString text = lead;
661  text += "m/z integration parameters:\n";
662 
663  text += lead;
664  text += spacer;
665  if(m_smallestMz != std::numeric_limits<double>::max())
666  text.append(
667  QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
668 
669  text += lead;
670  text += spacer;
671  if(m_greatestMz != std::numeric_limits<double>::min())
672  text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
673 
674  text += lead;
675  text += spacer;
676  text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
677 
678  std::map<BinningType, QString>::iterator it;
679  it = binningTypeMap.find(m_binningType);
680 
681  if(it == binningTypeMap.end())
682  qFatal("Programming error.");
683 
684  text += lead;
685  text += spacer;
686  text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
687 
688  // Only provide the details relative to the ARBITRARY binning type.
689 
691  {
692  text += lead;
693  text += spacer;
694  text += spacer;
695  text.append(QString("Bin nominal size: %1\n")
696  .arg(mp_precision->getNominal(), 0, 'f', 6));
697 
698  text += lead;
699  text += spacer;
700  text += spacer;
701  text.append(QString("Bin size: %2\n")
702  .arg(mp_precision->toString().toLatin1().data()));
703  }
704 
705  // Now other data that are independent of the bin settings.
706 
707  text += lead;
708  text += spacer;
709  text +=
710  QString("Apply m/z shift: %1\n").arg(m_applyMzShift ? "true" : "false");
711 
712  if(m_applyMzShift)
713  {
714  text += lead;
715  text += spacer;
716  text += spacer;
717  text += QString("m/z shift: %1").arg(m_mzShift, 0, 'f', 6);
718  }
719 
720  text += lead;
721  text += spacer;
722  text += QString("Remove 0-val data points: %1\n")
723  .arg(m_removeZeroValDataPoints ? "true" : "false");
724 
725  return text;
726 }
virtual QString toString() const =0
virtual pappso_double getNominal() const final
Definition: precision.cpp:64
std::map< BinningType, QString > binningTypeMap
Map relating the BinningType to a textual representation.

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

◆ updateGreatestMz()

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

Definition at line 168 of file mzintegrationparams.cpp.

169 {
170  m_greatestMz = m_greatestMz < value ? value : m_greatestMz;
171 }

References m_greatestMz.

◆ updateSmallestMz()

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

Definition at line 147 of file mzintegrationparams.cpp.

148 {
149  m_smallestMz = m_smallestMz > value ? value : m_smallestMz;
150 }

References m_smallestMz.

Member Data Documentation

◆ m_applyMzShift

bool pappso::MzIntegrationParams::m_applyMzShift = false
private

Definition at line 159 of file mzintegrationparams.h.

Referenced by isApplyMzShift(), operator=(), reset(), setApplyMzShift(), and toString().

◆ m_binningType

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

◆ m_decimalPlaces

int pappso::MzIntegrationParams::m_decimalPlaces = -1
private

◆ m_greatestMz

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

◆ m_mzShift

pappso::pappso_double pappso::MzIntegrationParams::m_mzShift = 0
private

Definition at line 160 of file mzintegrationparams.h.

Referenced by getMzShift(), operator=(), reset(), setMzShift(), and toString().

◆ m_removeZeroValDataPoints

bool pappso::MzIntegrationParams::m_removeZeroValDataPoints = true
private

◆ m_smallestMz

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

◆ mp_precision

pappso::PrecisionPtr pappso::MzIntegrationParams::mp_precision
private

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