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)
 
 MzIntegrationParams (const pappso::SavGolParams &savGolParams)
 
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 setApplySavGolFilter (bool applySavGolFilter)
 
bool isApplySavGolFilter () const
 
void setSavGolParams (int nL=15, int nR=15, int m=4, int lD=0, bool convolveWithNr=false)
 
void setSavGolParams (const pappso::SavGolParams &params)
 
pappso::SavGolParams getSavGolParams () 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
 
bool m_applySavGolFilter = false
 
pappso::SavGolParams m_savGolParams
 

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/4]

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/4]

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/4]

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  m_applySavGolFilter(other.m_applySavGolFilter)
105 {
106  if(mp_precision == nullptr)
108 
109  m_savGolParams.initialize(other.m_savGolParams);
110 }
pappso::SavGolParams m_savGolParams
void initialize(int nLParam, int nRParam, int mParam, int lDParam, bool convolveWithNrParam)
Definition: savgolfilter.h:85

References pappso::PrecisionFactory::getPpmInstance(), pappso::SavGolParams::initialize(), m_savGolParams, and mp_precision.

◆ MzIntegrationParams() [4/4]

pappso::MzIntegrationParams::MzIntegrationParams ( const pappso::SavGolParams savGolParams)

Definition at line 113 of file mzintegrationparams.cpp.

115 {
118  setSavGolParams(savGolParams);
119 }
void setSavGolParams(int nL=15, int nR=15, int m=4, int lD=0, bool convolveWithNr=false)

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

◆ ~MzIntegrationParams()

pappso::MzIntegrationParams::~MzIntegrationParams ( )
virtual

Definition at line 122 of file mzintegrationparams.cpp.

123 {
124 }

Member Function Documentation

◆ createArbitraryBins()

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

Definition at line 451 of file mzintegrationparams.cpp.

452 {
453 
454  // qDebug();
455 
456  // Now starts the tricky stuff. Depending on how the binning has been
457  // configured, we need to take diverse actions.
458 
459  // qDebug() << "Bin size:" << mp_precision->toString();
460 
463 
464  // qDebug() << QString::asprintf("min_mz: %.6f\n", min_mz)
465  //<< QString::asprintf("max_mz: %.6f\n", max_mz);
466 
467  pappso::pappso_double binSize = mp_precision->delta(min_mz);
468 
469  // qDebug() << QString::asprintf(
470  //"binSize is the precision delta for min_mz: %.6f\n", binSize);
471 
472  // Only compute the decimal places if they were not configured already.
473  if(m_decimalPlaces == -1)
474  {
475 
476  // We want as many decimal places as there are 0s between the integral
477  // part of the double and the first non-0 cipher. For example, if
478  // binSize is 0.004, zero decimals is 2 and m_decimalPlaces is set to 3,
479  // because we want decimals up to 4 included.
480 
482 
483  // qDebug() << "With the binSize m_decimalPlaces was computed to be:"
484  //<< m_decimalPlaces;
485  }
486 
487  // Now that we have defined the value of m_decimalPlaces, let's use that
488  // value.
489 
490  double first_mz = ceil((min_mz * std::pow(10, m_decimalPlaces)) - 0.49) /
491  pow(10, m_decimalPlaces);
492  double last_mz =
493  ceil((max_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
494 
495  // qDebug() << "After having accounted for the decimals, new min/max values:"
496  //<< QString::asprintf("Very first data point: %.6f\n", first_mz)
497  //<< QString::asprintf("Very last data point to reach: %.6f\n",
498  // last_mz);
499 
500  // Instanciate the vector of mz double_s that we'll feed with the bins.
501 
502  std::vector<pappso::pappso_double> bins;
503 
504  // Store that very first value for later use in the loop.
505  // The bins are notking more than:
506  //
507  // 1. The first mz (that is the smallest mz value found in all the spectra
508  // 2. A sequence of mz values corresponding to that first mz value
509  // incremented by the bin size.
510 
511  // Seed the root of the bin vector with the first mz value rounded above as
512  // requested.
513  pappso::pappso_double previous_mz_bin = first_mz;
514 
515  bins.push_back(previous_mz_bin);
516 
517  // Now continue adding mz values until we have reached the end of the
518  // spectrum, that is the max_mz value, as converted using the decimals to
519  // last_mz.
520 
521  // debugCount value used below for debugging purposes.
522  // int debugCount = 0;
523 
524  while(previous_mz_bin <= last_mz)
525  {
526 
527  // Calculate dynamically the precision delta according to the current mz
528  // value.
529 
530  double current_mz =
531  previous_mz_bin + mp_precision->delta(previous_mz_bin);
532 
533  // qDebug() << QString::asprintf(
534  //"previous_mzBin: %.6f and current_mz: %.6f\n",
535  // previous_mz_bin,
536  // current_mz);
537 
538  // Now apply on the obtained mz value the decimals that were either set
539  // or computed earlier.
540 
541  double current_rounded_mz =
542  ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
543  pow(10, m_decimalPlaces);
544 
545  // qDebug() << QString::asprintf(
546  //"current_mz: %.6f and current_rounded_mz: %.6f and previous_mzBin "
547  //": % .6f\n ",
548  // current_mz,
549  // current_rounded_mz,
550  // previous_mz_bin);
551 
552  // If rounding makes the new value identical to the previous one, then
553  // that means that we need to decrease roughness.
554 
555  if(current_rounded_mz == previous_mz_bin)
556  {
557  ++m_decimalPlaces;
558 
559  current_rounded_mz =
560  ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
561  pow(10, m_decimalPlaces);
562 
563  qDebug().noquote()
564  << "Had to increment decimal places by one while creating the bins "
565  "in BinningType::ARBITRARY mode..";
566  }
567 
568  bins.push_back(current_rounded_mz);
569 
570  // Use the local_mz value for the storage of the previous mz bin.
571  previous_mz_bin = current_rounded_mz;
572  }
573 
574 
575 #if 0
576 
577  QString fileName = "/tmp/massSpecArbitraryBins.txt-at-" +
578  QDateTime::currentDateTime().toString("yyyyMMdd-HH-mm-ss");
579 
580  qDebug() << "Writing the list of bins setup in the "
581  "mass spectrum in file "
582  << fileName;
583 
584  QFile file(fileName);
585  file.open(QIODevice::WriteOnly);
586 
587  QTextStream fileStream(&file);
588 
589  for(auto &&bin : bins)
590  fileStream << QString("%1\n").arg(bin, 0, 'f', 10);
591 
592  fileStream.flush();
593  file.close();
594 
595 #endif
596 
597  // qDebug() << "Prepared bins with " << bins.size() << "elements."
598  //<< "starting with mz" << bins.front() << "ending with mz"
599  //<< bins.back();
600 
601  return bins;
602 }
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 391 of file mzintegrationparams.cpp.

392 {
393 
394  // qDebug();
395 
396  std::vector<double> bins;
397 
399  {
400  // If no binning is to be performed, fine.
401  return bins;
402  }
404  {
405  // Use only data in the MzIntegrationParams member data.
406  return createArbitraryBins();
407  }
409  {
410  // qDebug();
411 
412  qFatal("Programming error.");
413  }
414 
415  return bins;
416 }
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 420 of file mzintegrationparams.cpp.

421 {
422 
423  // qDebug();
424 
425  std::vector<double> bins;
426 
428  {
429  // If no binning is to be performed, fine.
430  return bins;
431  }
433  {
434  // Use only data in the MzIntegrationParams member data.
435  return createArbitraryBins();
436  }
438  {
439  // qDebug();
440 
441  // Use the first spectrum to perform the data-based bins
442 
443  return createDataBasedBins(mass_spectrum_csp);
444  }
445 
446  return bins;
447 }
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 606 of file mzintegrationparams.cpp.

608 {
609  // qDebug();
610 
611  // The bins in *this mass spectrum must be calculated starting from the
612  // data in the mass_spectrum_csp parameter.
613 
614  // Instanciate the vector of mz double_s that we'll feed with the bins.
615 
616  std::vector<pappso::pappso_double> bins;
617 
618  if(mass_spectrum_csp->size() < 2)
619  return bins;
620 
621  // Make sure the spectrum is sorted, as this functions takes for granted
622  // that the DataPoint instances are sorted in ascending x (== mz) value
623  // order.
624  pappso::MassSpectrum local_mass_spectrum = *mass_spectrum_csp;
625  local_mass_spectrum.sortMz();
626 
628 
629  // qDebug() << "The min_mz:" << min_mz;
630 
631  if(m_decimalPlaces != -1)
632  min_mz = ceil((min_mz * pow(10, m_decimalPlaces)) - 0.49) /
633  pow(10, m_decimalPlaces);
634 
635 
636  // Two values for the definition of a MassSpectrumBin.
637 
638  // The first value of the mz range that defines the bin. This value is part
639  // of the bin.
640  pappso::pappso_double start_mz_in = min_mz;
641 
642  // The second value of the mz range that defines the bin. This value is
643  // *not* part of the bin.
644  pappso::pappso_double end_mz_out;
645 
646  std::vector<pappso::DataPoint>::const_iterator it =
647  local_mass_spectrum.begin();
648 
649  pappso::pappso_double prev_mz = it->x;
650 
651  if(m_decimalPlaces != -1)
652  prev_mz = ceil((prev_mz * pow(10, m_decimalPlaces)) - 0.49) /
653  pow(10, m_decimalPlaces);
654 
655  ++it;
656 
657  while(it != local_mass_spectrum.end())
658  {
659  pappso::pappso_double next_mz = it->x;
660 
661  if(m_decimalPlaces != -1)
662  next_mz = ceil((next_mz * pow(10, m_decimalPlaces)) - 0.49) /
663  pow(10, m_decimalPlaces);
664 
665  pappso::pappso_double step = next_mz - prev_mz;
666  end_mz_out = start_mz_in + step;
667 
668  if(m_decimalPlaces != -1)
669  end_mz_out = ceil((end_mz_out * pow(10, m_decimalPlaces)) - 0.49) /
670  pow(10, m_decimalPlaces);
671 
672  // The data point that is crafted has a 0 y-value. The binning must
673  // indeed not create artificial intensity data.
674 
675  // qDebug() << "Pushing back bin:" << start_mz_in << end_mz_out;
676 
677  bins.push_back(start_mz_in);
678 
679  // Prepare next bin
680  start_mz_in = end_mz_out;
681 
682  // Update prev_mz to be the current one for next iteration.
683  prev_mz = next_mz;
684 
685  // Now got the next DataPoint instance.
686  ++it;
687  }
688 
689 #if 0
690 
691  QString fileName = "/tmp/massSpecDataBasedBins.txt";
692 
693  qDebug() << "Writing the list of bins setup in the "
694  "mass spectrum in file "
695  << fileName;
696 
697  QFile file(fileName);
698  file.open(QIODevice::WriteOnly);
699 
700  QTextStream fileStream(&file);
701 
702  for(auto &&bin : m_bins)
703  fileStream << QString("[%1-%2]\n")
704  .arg(bin.startMzIn, 0, 'f', 10)
705  .arg(bin.endMzOut, 0, 'f', 10);
706 
707  fileStream.flush();
708  file.close();
709 
710  qDebug() << "elements."
711  << "starting with mz" << m_bins.front().startMzIn << "ending with mz"
712  << m_bins.back().endMzOut;
713 
714 #endif
715 
716  return bins;
717 }
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 203 of file mzintegrationparams.cpp.

204 {
205  return m_binningType;
206 }

References m_binningType.

◆ getDecimalPlaces()

int pappso::MzIntegrationParams::getDecimalPlaces ( ) const

Definition at line 216 of file mzintegrationparams.cpp.

217 {
218  return m_decimalPlaces;
219 }

References m_decimalPlaces.

◆ getGreatestMz()

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

Definition at line 191 of file mzintegrationparams.cpp.

192 {
193  return m_greatestMz;
194 }

References m_greatestMz.

◆ getMzShift()

double pappso::MzIntegrationParams::getMzShift ( ) const

Definition at line 273 of file mzintegrationparams.cpp.

274 {
275  return m_mzShift;
276 }

References m_mzShift.

◆ getPrecision()

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

Definition at line 231 of file mzintegrationparams.cpp.

232 {
233  return mp_precision;
234 }

References mp_precision.

◆ getSavGolParams()

pappso::SavGolParams pappso::MzIntegrationParams::getSavGolParams ( ) const

Definition at line 317 of file mzintegrationparams.cpp.

318 {
319  return m_savGolParams;
320 }

References m_savGolParams.

◆ getSmallestMz()

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

Definition at line 170 of file mzintegrationparams.cpp.

171 {
172  return m_smallestMz;
173 }

References m_smallestMz.

◆ hasValidMzRange()

bool pappso::MzIntegrationParams::hasValidMzRange ( ) const

Definition at line 383 of file mzintegrationparams.cpp.

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

References m_greatestMz, and m_smallestMz.

◆ isApplyMzShift()

bool pappso::MzIntegrationParams::isApplyMzShift ( ) const

Definition at line 245 of file mzintegrationparams.cpp.

246 {
247  return m_applyMzShift;
248 }

References m_applyMzShift.

◆ isApplySavGolFilter()

bool pappso::MzIntegrationParams::isApplySavGolFilter ( ) const

Definition at line 287 of file mzintegrationparams.cpp.

288 {
289  return m_applySavGolFilter;
290 }

References m_applySavGolFilter.

◆ isRemoveZeroValDataPoints()

bool pappso::MzIntegrationParams::isRemoveZeroValDataPoints ( ) const

Definition at line 259 of file mzintegrationparams.cpp.

260 {
262 }

References m_removeZeroValDataPoints.

◆ isValid()

bool pappso::MzIntegrationParams::isValid ( ) const

Definition at line 349 of file mzintegrationparams.cpp.

350 {
351  int errors = 0;
352 
354  {
355  // qDebug() << "m_smallestMz:" << m_smallestMz;
356  // qDebug() << "smallest is max:" << (m_smallestMz ==
357  // std::numeric_limits<double>::max());
358 
359  errors += (m_smallestMz == std::numeric_limits<double>::max() ? 1 : 0);
360 
361  // qDebug() << "m_greatestMz:" << m_greatestMz;
362  // qDebug() << "greatest is min:" << (m_greatestMz ==
363  // std::numeric_limits<double>::min());
364  errors += (m_greatestMz == std::numeric_limits<double>::min() ? 1 : 0);
365 
366  // if(mp_precision != nullptr)
367  // qDebug() << mp_precision->toString();
368 
369  errors += (mp_precision == nullptr ? 1 : 0);
370  }
371 
372  if(errors)
373  {
374  qDebug()
375  << "The m/z integration parameters are not valid or do not apply...";
376  }
377 
378  return !errors;
379 }

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

◆ operator=()

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

Definition at line 128 of file mzintegrationparams.cpp.

129 {
130  if(this == &other)
131  return *this;
132 
133  m_smallestMz = other.m_smallestMz;
134  m_greatestMz = other.m_greatestMz;
135  m_binningType = other.m_binningType;
136 
137  m_decimalPlaces = other.m_decimalPlaces;
138 
139  mp_precision = other.mp_precision;
140  if(mp_precision == nullptr)
142 
143  m_applyMzShift = other.m_applyMzShift;
144  m_mzShift = other.m_mzShift;
145  m_removeZeroValDataPoints = other.m_removeZeroValDataPoints;
146 
147  setSavGolParams(other.m_savGolParams);
148 
149  m_applySavGolFilter = other.m_applySavGolFilter;
150 
151  return *this;
152 }

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

◆ reset()

void pappso::MzIntegrationParams::reset ( )

Reset the instance to default values.

Definition at line 325 of file mzintegrationparams.cpp.

326 {
327  m_smallestMz = std::numeric_limits<double>::min();
328  m_greatestMz = std::numeric_limits<double>::min();
330 
331  // Special case for this member datum
333 
334  m_applyMzShift = false;
335  m_mzShift = 0;
337 
338  m_savGolParams.nL = 15;
339  m_savGolParams.nR = 15;
340  m_savGolParams.m = 4;
341  m_savGolParams.lD = 0;
343 
344  m_applySavGolFilter = false;
345 }
int nR
number of data points on the right of the filtered point
Definition: savgolfilter.h:52
int nL
number of data points on the left of the filtered point
Definition: savgolfilter.h:50
bool convolveWithNr
set to false for best results
Definition: savgolfilter.h:60

References pappso::SavGolParams::convolveWithNr, pappso::PrecisionFactory::getPpmInstance(), pappso::SavGolParams::lD, pappso::SavGolParams::m, m_applyMzShift, m_applySavGolFilter, m_binningType, m_greatestMz, m_mzShift, m_removeZeroValDataPoints, m_savGolParams, m_smallestMz, mp_precision, pappso::SavGolParams::nL, pappso::NONE, and pappso::SavGolParams::nR.

◆ setApplyMzShift()

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

Definition at line 238 of file mzintegrationparams.cpp.

239 {
240  m_applyMzShift = applyMzShift;
241 }

References m_applyMzShift.

◆ setApplySavGolFilter()

void pappso::MzIntegrationParams::setApplySavGolFilter ( bool  applySavGolFilter)

Definition at line 280 of file mzintegrationparams.cpp.

281 {
282  m_applySavGolFilter = applySavGolFilter;
283 }

References m_applySavGolFilter.

◆ setBinningType()

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

Definition at line 197 of file mzintegrationparams.cpp.

198 {
199  m_binningType = binningType;
200 }

References m_binningType.

◆ setDecimalPlaces()

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

Definition at line 209 of file mzintegrationparams.cpp.

210 {
211  m_decimalPlaces = decimal_places;
212 }

References m_decimalPlaces.

◆ setGreatestMz()

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

Definition at line 177 of file mzintegrationparams.cpp.

178 {
179  m_greatestMz = value;
180 }

References m_greatestMz.

◆ setMzShift()

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

Definition at line 266 of file mzintegrationparams.cpp.

267 {
268  m_mzShift = value;
269 }

References m_mzShift.

◆ setPrecision()

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

Definition at line 222 of file mzintegrationparams.cpp.

223 {
224  mp_precision = precisionPtr;
225 
226  if(mp_precision == nullptr)
228 }
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 252 of file mzintegrationparams.cpp.

253 {
254  m_removeZeroValDataPoints = removeOrNot;
255 }

References m_removeZeroValDataPoints.

◆ setSavGolParams() [1/2]

void pappso::MzIntegrationParams::setSavGolParams ( const pappso::SavGolParams params)

◆ setSavGolParams() [2/2]

void pappso::MzIntegrationParams::setSavGolParams ( int  nL = 15,
int  nR = 15,
int  m = 4,
int  lD = 0,
bool  convolveWithNr = false 
)

◆ setSmallestMz()

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

Definition at line 156 of file mzintegrationparams.cpp.

157 {
158  m_smallestMz = value;
159 }

References m_smallestMz.

◆ toString()

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

Definition at line 721 of file mzintegrationparams.cpp.

722 {
723  QString lead;
724 
725  for(int iter = 0; iter < offset; ++iter)
726  lead += spacer;
727 
728  QString text = lead;
729  text += "m/z integration parameters:\n";
730 
731  text += lead;
732  text += spacer;
733  if(m_smallestMz != std::numeric_limits<double>::max())
734  text.append(
735  QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
736 
737  text += lead;
738  text += spacer;
739  if(m_greatestMz != std::numeric_limits<double>::min())
740  text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
741 
742  text += lead;
743  text += spacer;
744  text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
745 
746  std::map<BinningType, QString>::iterator it;
747  it = binningTypeMap.find(m_binningType);
748 
749  if(it == binningTypeMap.end())
750  qFatal("Programming error.");
751 
752  text += lead;
753  text += spacer;
754  text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
755 
756  // Only provide the details relative to the ARBITRARY binning type.
757 
759  {
760  text += lead;
761  text += spacer;
762  text += spacer;
763  text.append(QString("Bin nominal size: %1\n")
764  .arg(mp_precision->getNominal(), 0, 'f', 6));
765 
766  text += lead;
767  text += spacer;
768  text += spacer;
769  text.append(QString("Bin size: %2\n")
770  .arg(mp_precision->toString().toLatin1().data()));
771  }
772 
773  // Now other data that are independent of the bin settings.
774 
775  text += lead;
776  text += spacer;
777  text +=
778  QString("Apply m/z shift: %1\n").arg(m_applyMzShift ? "true" : "false");
779 
780  if(m_applyMzShift)
781  {
782  text += lead;
783  text += spacer;
784  text += spacer;
785  text += QString("m/z shift: %1").arg(m_mzShift, 0, 'f', 6);
786  }
787 
788  text += lead;
789  text += spacer;
790  text += QString("Remove 0-val data points: %1\n")
791  .arg(m_removeZeroValDataPoints ? "true" : "false");
792 
793  // Finally the Savitzy-Golay parameters (if requested)
794 
796  {
797  text += lead;
798  text += spacer;
799  text.append("Savitzky-Golay parameters\n");
800  text += lead;
801  text += spacer;
802  text += spacer;
803  text +=
804  QString("nL = %1 ; nR = %2 ; m = %3 ; lD = %4 ; convolveWithNr = %5\n")
805  .arg(m_savGolParams.nL)
806  .arg(m_savGolParams.nR)
807  .arg(m_savGolParams.m)
808  .arg(m_savGolParams.lD)
809  .arg(m_savGolParams.convolveWithNr ? "true" : "false");
810  }
811 
812  return text;
813 }
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::SavGolParams::convolveWithNr, pappso::PrecisionBase::getNominal(), pappso::SavGolParams::lD, pappso::SavGolParams::m, m_applyMzShift, m_applySavGolFilter, m_binningType, m_decimalPlaces, m_greatestMz, m_mzShift, m_removeZeroValDataPoints, m_savGolParams, m_smallestMz, mp_precision, pappso::SavGolParams::nL, pappso::SavGolParams::nR, and pappso::PrecisionBase::toString().

◆ updateGreatestMz()

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

Definition at line 184 of file mzintegrationparams.cpp.

185 {
186  m_greatestMz = m_greatestMz < value ? value : m_greatestMz;
187 }

References m_greatestMz.

◆ updateSmallestMz()

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

Definition at line 163 of file mzintegrationparams.cpp.

164 {
165  m_smallestMz = m_smallestMz > value ? value : m_smallestMz;
166 }

References m_smallestMz.

Member Data Documentation

◆ m_applyMzShift

bool pappso::MzIntegrationParams::m_applyMzShift = false
private

Definition at line 172 of file mzintegrationparams.h.

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

◆ m_applySavGolFilter

bool pappso::MzIntegrationParams::m_applySavGolFilter = false
private

◆ 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 173 of file mzintegrationparams.h.

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

◆ m_removeZeroValDataPoints

bool pappso::MzIntegrationParams::m_removeZeroValDataPoints = true
private

◆ m_savGolParams

pappso::SavGolParams pappso::MzIntegrationParams::m_savGolParams
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: