libpappsomspp
Library for mass spectrometry
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 ()
 
MzIntegrationParamsoperator= (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_doublecreateBins ()
 
Q_INVOKABLE std::vector< pappso::pappso_doublecreateBins (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.

74{
77}
pappso::PrecisionPtr mp_precision
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
@ 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.

87 : m_smallestMz(minMz),
88 m_greatestMz(maxMz),
89 m_binningType(binningType),
90 m_decimalPlaces(decimalPlaces),
91 mp_precision(precisionPtr),
92 m_binSizeDivisor(binSizeDivisor),
93 m_removeZeroValDataPoints(removeZeroValDataPoints)
94{
95 if(mp_precision == nullptr)
97
98 // qDebug() << "mp_precision:" << mp_precision->toString();
99}
pappso::pappso_double m_smallestMz
pappso::pappso_double m_greatestMz

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

◆ MzIntegrationParams() [3/3]

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

Definition at line 102 of file mzintegrationparams.cpp.

103 : m_smallestMz(other.m_smallestMz),
104 m_greatestMz(other.m_greatestMz),
105 m_binningType(other.m_binningType),
106 m_decimalPlaces(other.m_decimalPlaces),
107 mp_precision(other.mp_precision),
108 m_binSizeDivisor(other.m_binSizeDivisor),
109 m_removeZeroValDataPoints(other.m_removeZeroValDataPoints)
110{
111 if(mp_precision == nullptr)
113
114 // qDebug() << "mp_precision:" << mp_precision->toString();
115}
static PrecisionPtr getResInstance(pappso_double value)
get a resolution precision pointer

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

◆ ~MzIntegrationParams()

pappso::MzIntegrationParams::~MzIntegrationParams ( )
virtual

Definition at line 118 of file mzintegrationparams.cpp.

119{
120}

Member Function Documentation

◆ createArbitraryBins()

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

Definition at line 382 of file mzintegrationparams.cpp.

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

323{
324
325 // qDebug() << "mp_precision:" << mp_precision->toString();
326
327 std::vector<double> bins;
328
330 {
331 // If no binning is to be performed, fine.
332 return bins;
333 }
335 {
336 // Use only data in the MzIntegrationParams member data.
337 return createArbitraryBins();
338 }
340 {
341 // qDebug();
342
343 qFatal("Programming error.");
344 }
345
346 return bins;
347}
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 351 of file mzintegrationparams.cpp.

352{
353
354 // qDebug();
355
356 std::vector<double> bins;
357
359 {
360 // If no binning is to be performed, fine.
361 return bins;
362 }
364 {
365 // Use only data in the MzIntegrationParams member data.
366 return createArbitraryBins();
367 }
369 {
370 // qDebug();
371
372 // Use the first spectrum to perform the data-based bins
373
374 return createDataBasedBins(mass_spectrum_csp);
375 }
376
377 return bins;
378}
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 568 of file mzintegrationparams.cpp.

570{
571 // qDebug();
572
573 // The bins in *this mass spectrum must be calculated starting from the
574 // data in the mass_spectrum_csp parameter.
575
576 // Instanciate the vector of mz double_s that we'll feed with the bins.
577
578 std::vector<pappso::pappso_double> bins;
579
580 if(mass_spectrum_csp->size() < 2)
581 return bins;
582
583 // Make sure the spectrum is sorted, as this functions takes for granted
584 // that the DataPoint instances are sorted in ascending x (== mz) value
585 // order.
586 pappso::MassSpectrum local_mass_spectrum = *mass_spectrum_csp;
587 local_mass_spectrum.sortMz();
588
590
591 // qDebug() << "The min_mz:" << min_mz;
592
593 if(m_decimalPlaces != -1)
594 min_mz = ceil((min_mz * pow(10, m_decimalPlaces)) - 0.49) /
595 pow(10, m_decimalPlaces);
596
597
598 // Two values for the definition of a MassSpectrumBin.
599
600 // The first value of the mz range that defines the bin. This value is part
601 // of the bin.
602 pappso::pappso_double start_mz_in = min_mz;
603
604 // The second value of the mz range that defines the bin. This value is
605 // *not* part of the bin.
606 pappso::pappso_double end_mz_out;
607
608 std::vector<pappso::DataPoint>::const_iterator it =
609 local_mass_spectrum.begin();
610
611 pappso::pappso_double prev_mz = it->x;
612
613 if(m_decimalPlaces != -1)
614 prev_mz = ceil((prev_mz * pow(10, m_decimalPlaces)) - 0.49) /
615 pow(10, m_decimalPlaces);
616
617 ++it;
618
619 while(it != local_mass_spectrum.end())
620 {
621 pappso::pappso_double next_mz = it->x;
622
623 if(m_decimalPlaces != -1)
624 next_mz = ceil((next_mz * pow(10, m_decimalPlaces)) - 0.49) /
625 pow(10, m_decimalPlaces);
626
627 pappso::pappso_double step = next_mz - prev_mz;
628 end_mz_out = start_mz_in + step;
629
630 if(m_decimalPlaces != -1)
631 end_mz_out = ceil((end_mz_out * pow(10, m_decimalPlaces)) - 0.49) /
632 pow(10, m_decimalPlaces);
633
634 // The data point that is crafted has a 0 y-value. The binning must
635 // indeed not create artificial intensity data.
636
637 // qDebug() << "Pushing back bin:" << start_mz_in << end_mz_out;
638
639 bins.push_back(start_mz_in);
640
641 // Prepare next bin
642 start_mz_in = end_mz_out;
643
644 // Update prev_mz to be the current one for next iteration.
645 prev_mz = next_mz;
646
647 // Now got the next DataPoint instance.
648 ++it;
649 }
650
651#if 0
652
653 QString fileName = "/tmp/massSpecDataBasedBins.txt";
654
655 qDebug() << "Writing the list of bins setup in the "
656 "mass spectrum in file "
657 << fileName;
658
659 QFile file(fileName);
660 file.open(QIODevice::WriteOnly);
661
662 QTextStream fileStream(&file);
663
664 for(auto &&bin : m_bins)
665 fileStream << QString("[%1-%2]\n")
666 .arg(bin.startMzIn, 0, 'f', 10)
667 .arg(bin.endMzOut, 0, 'f', 10);
668
669 fileStream.flush();
670 file.close();
671
672 qDebug() << "elements."
673 << "starting with mz" << m_bins.front().startMzIn << "ending with mz"
674 << m_bins.back().endMzOut;
675
676#endif
677
678 return bins;
679}
Class to represent a mass spectrum.
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 197 of file mzintegrationparams.cpp.

198{
199 return m_binningType;
200}

References m_binningType.

◆ getBinSizeDivisor()

int pappso::MzIntegrationParams::getBinSizeDivisor ( ) const

Definition at line 240 of file mzintegrationparams.cpp.

241{
242 return m_binSizeDivisor;
243}

References m_binSizeDivisor.

◆ getDecimalPlaces()

int pappso::MzIntegrationParams::getDecimalPlaces ( ) const

Definition at line 211 of file mzintegrationparams.cpp.

212{
213 return m_decimalPlaces;
214}

References m_decimalPlaces.

◆ getGreatestMz()

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

Definition at line 183 of file mzintegrationparams.cpp.

184{
185 return m_greatestMz;
186}

References m_greatestMz.

◆ getPrecision()

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

Definition at line 226 of file mzintegrationparams.cpp.

227{
228 return mp_precision;
229}

References mp_precision.

◆ getSmallestMz()

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

Definition at line 162 of file mzintegrationparams.cpp.

163{
164 return m_smallestMz;
165}

References m_smallestMz.

◆ hasValidMzRange()

bool pappso::MzIntegrationParams::hasValidMzRange ( ) const

Definition at line 314 of file mzintegrationparams.cpp.

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

References m_greatestMz, and m_smallestMz.

◆ isRemoveZeroValDataPoints()

bool pappso::MzIntegrationParams::isRemoveZeroValDataPoints ( ) const

Definition at line 254 of file mzintegrationparams.cpp.

255{
257}

References m_removeZeroValDataPoints.

◆ isValid()

bool pappso::MzIntegrationParams::isValid ( ) const

Definition at line 277 of file mzintegrationparams.cpp.

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

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.

125{
126 if(this == &other)
127 return *this;
128
129 m_smallestMz = other.m_smallestMz;
130 m_greatestMz = other.m_greatestMz;
131 m_binningType = other.m_binningType;
132
133 m_decimalPlaces = other.m_decimalPlaces;
134
135 mp_precision = other.mp_precision;
136 if(mp_precision == nullptr)
138
139 m_binSizeDivisor = other.m_binSizeDivisor;
140
141 m_removeZeroValDataPoints = other.m_removeZeroValDataPoints;
142
143 return *this;
144}

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.

263{
264 m_smallestMz = std::numeric_limits<double>::min();
265 m_greatestMz = std::numeric_limits<double>::min();
267
268 // Special case for this member datum
270
273}

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.

191{
192 m_binningType = binningType;
193}

References m_binningType.

◆ setBinSizeDivisor()

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

Definition at line 233 of file mzintegrationparams.cpp.

234{
235 m_binSizeDivisor = divisor;
236}

References m_binSizeDivisor.

◆ setDecimalPlaces()

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

Definition at line 204 of file mzintegrationparams.cpp.

205{
206 m_decimalPlaces = decimal_places;
207}

References m_decimalPlaces.

◆ setGreatestMz()

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

Definition at line 169 of file mzintegrationparams.cpp.

170{
171 m_greatestMz = value;
172}

References m_greatestMz.

◆ setPrecision()

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

Definition at line 217 of file mzintegrationparams.cpp.

218{
219 mp_precision = precisionPtr;
220
221 if(mp_precision == nullptr)
223}
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer

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

◆ setRemoveZeroValDataPoints()

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

Definition at line 247 of file mzintegrationparams.cpp.

248{
249 m_removeZeroValDataPoints = removeOrNot;
250}

References m_removeZeroValDataPoints.

◆ setSmallestMz()

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

Definition at line 148 of file mzintegrationparams.cpp.

149{
150 m_smallestMz = value;
151}

References m_smallestMz.

◆ toString()

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

Definition at line 683 of file mzintegrationparams.cpp.

684{
685 QString lead;
686
687 for(int iter = 0; iter < offset; ++iter)
688 lead += spacer;
689
690 QString text = lead;
691 text += "m/z integration parameters:\n";
692
693 text += lead;
694 text += spacer;
695 if(m_smallestMz != std::numeric_limits<double>::max())
696 text.append(
697 QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
698
699 text += lead;
700 text += spacer;
701 if(m_greatestMz != std::numeric_limits<double>::min())
702 text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
703
704 text += lead;
705 text += spacer;
706 text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
707
708 std::map<BinningType, QString>::iterator it;
709 it = binningTypeMap.find(m_binningType);
710
711 if(it == binningTypeMap.end())
712 qFatal("Programming error.");
713
714 text += lead;
715 text += spacer;
716 text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
717
718 // Only provide the details relative to the ARBITRARY binning type.
719
721 {
722 text += lead;
723 text += spacer;
724 text += spacer;
725 text.append(QString("Bin nominal size: %1\n")
726 .arg(mp_precision->getNominal(), 0, 'f', 6));
727
728 text += lead;
729 text += spacer;
730 text += spacer;
731 text.append(QString("Bin size: %2\n")
732 .arg(mp_precision->toString().toLatin1().data()));
733
734 text += lead;
735 text += spacer;
736 text += spacer;
737 text.append(QString("Bin size divisor: %2\n").arg(m_binSizeDivisor));
738 }
739
740 // Now other data that are independent of the bin settings.
741
742 text += lead;
743 text += spacer;
744 text += QString("Remove 0-val data points: %1\n")
745 .arg(m_removeZeroValDataPoints ? "true" : "false");
746
747 return text;
748}
virtual QString toString() const =0
virtual pappso_double getNominal() const final
Definition precision.cpp:65
std::map< BinningType, QString > binningTypeMap
Map relating the BinningType to a textual representation.

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.

177{
178 m_greatestMz = m_greatestMz < value ? value : m_greatestMz;
179}

References m_greatestMz.

◆ updateSmallestMz()

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

Definition at line 155 of file mzintegrationparams.cpp.

156{
157 m_smallestMz = m_smallestMz > value ? value : m_smallestMz;
158}

References m_smallestMz.

Member Data Documentation

◆ m_binningType

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

◆ m_binSizeDivisor

int pappso::MzIntegrationParams::m_binSizeDivisor = 1
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_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


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