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

Q_INVOKABLE MzIntegrationParams ()
 
Q_INVOKABLE MzIntegrationParams (pappso::pappso_double minMz, pappso::pappso_double maxMz, BinningType binningType, int decimalPlaces, pappso::PrecisionPtr precisionPtr, bool applyMzShift, pappso::pappso_double mzShift, 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
 
Q_INVOKABLE void setApplyMzShift (bool applyMzShift)
 
Q_INVOKABLE bool isApplyMzShift () const
 
Q_INVOKABLE void setMzShift (double value)
 
Q_INVOKABLE double getMzShift () const
 
Q_INVOKABLE void setRemoveZeroValDataPoints (bool removeOrNot=true)
 
Q_INVOKABLE bool isRemoveZeroValDataPoints () const
 
Q_INVOKABLE void reset ()
 Reset the instance to default values. More...
 
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
 
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 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
Definition: precision.cpp:150
@ 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 80 of file mzintegrationparams.cpp.

88 : m_smallestMz(minMz),
89 m_greatestMz(maxMz),
90 m_binningType(binningType),
91 m_decimalPlaces(decimalPlaces),
92 mp_precision(precisionPtr),
93 m_applyMzShift(applyMzShift),
94 m_mzShift(mzShift),
95 m_removeZeroValDataPoints(removeZeroValDataPoints)
96{
97 if(mp_precision == nullptr)
99}
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 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_applyMzShift(other.m_applyMzShift),
109 m_mzShift(other.m_mzShift),
110 m_removeZeroValDataPoints(other.m_removeZeroValDataPoints)
111{
112 if(mp_precision == nullptr)
114}

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

◆ ~MzIntegrationParams()

pappso::MzIntegrationParams::~MzIntegrationParams ( )
virtual

Definition at line 117 of file mzintegrationparams.cpp.

118{
119}

Member Function Documentation

◆ createArbitraryBins()

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

Definition at line 390 of file mzintegrationparams.cpp.

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

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

331{
332
333 // qDebug();
334
335 std::vector<double> bins;
336
338 {
339 // If no binning is to be performed, fine.
340 return bins;
341 }
343 {
344 // Use only data in the MzIntegrationParams member data.
345 return createArbitraryBins();
346 }
348 {
349 // qDebug();
350
351 qFatal("Programming error.");
352 }
353
354 return bins;
355}
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 359 of file mzintegrationparams.cpp.

360{
361
362 // qDebug();
363
364 std::vector<double> bins;
365
367 {
368 // If no binning is to be performed, fine.
369 return bins;
370 }
372 {
373 // Use only data in the MzIntegrationParams member data.
374 return createArbitraryBins();
375 }
377 {
378 // qDebug();
379
380 // Use the first spectrum to perform the data-based bins
381
382 return createDataBasedBins(mass_spectrum_csp);
383 }
384
385 return bins;
386}
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 553 of file mzintegrationparams.cpp.

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

195{
196 return m_binningType;
197}

References m_binningType.

◆ getDecimalPlaces()

int pappso::MzIntegrationParams::getDecimalPlaces ( ) const

Definition at line 207 of file mzintegrationparams.cpp.

208{
209 return m_decimalPlaces;
210}

References m_decimalPlaces.

◆ getGreatestMz()

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

Definition at line 182 of file mzintegrationparams.cpp.

183{
184 return m_greatestMz;
185}

References m_greatestMz.

◆ getMzShift()

double pappso::MzIntegrationParams::getMzShift ( ) const

Definition at line 264 of file mzintegrationparams.cpp.

265{
266 return m_mzShift;
267}

References m_mzShift.

◆ getPrecision()

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

Definition at line 222 of file mzintegrationparams.cpp.

223{
224 return mp_precision;
225}

References mp_precision.

◆ getSmallestMz()

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

Definition at line 161 of file mzintegrationparams.cpp.

162{
163 return m_smallestMz;
164}

References m_smallestMz.

◆ hasValidMzRange()

bool pappso::MzIntegrationParams::hasValidMzRange ( ) const

Definition at line 322 of file mzintegrationparams.cpp.

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

References m_greatestMz, and m_smallestMz.

◆ isApplyMzShift()

bool pappso::MzIntegrationParams::isApplyMzShift ( ) const

Definition at line 236 of file mzintegrationparams.cpp.

237{
238 return m_applyMzShift;
239}

References m_applyMzShift.

◆ isRemoveZeroValDataPoints()

bool pappso::MzIntegrationParams::isRemoveZeroValDataPoints ( ) const

Definition at line 250 of file mzintegrationparams.cpp.

251{
253}

References m_removeZeroValDataPoints.

◆ isValid()

bool pappso::MzIntegrationParams::isValid ( ) const

Definition at line 288 of file mzintegrationparams.cpp.

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

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

◆ operator=()

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

Definition at line 123 of file mzintegrationparams.cpp.

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

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

273{
274 m_smallestMz = std::numeric_limits<double>::min();
275 m_greatestMz = std::numeric_limits<double>::min();
277
278 // Special case for this member datum
280
281 m_applyMzShift = false;
282 m_mzShift = 0;
284}

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

230{
231 m_applyMzShift = applyMzShift;
232}

References m_applyMzShift.

◆ setBinningType()

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

Definition at line 188 of file mzintegrationparams.cpp.

189{
190 m_binningType = binningType;
191}

References m_binningType.

◆ setDecimalPlaces()

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

Definition at line 200 of file mzintegrationparams.cpp.

201{
202 m_decimalPlaces = decimal_places;
203}

References m_decimalPlaces.

◆ setGreatestMz()

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

Definition at line 168 of file mzintegrationparams.cpp.

169{
170 m_greatestMz = value;
171}

References m_greatestMz.

◆ setMzShift()

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

Definition at line 257 of file mzintegrationparams.cpp.

258{
259 m_mzShift = value;
260}

References m_mzShift.

◆ setPrecision()

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

Definition at line 213 of file mzintegrationparams.cpp.

214{
215 mp_precision = precisionPtr;
216
217 if(mp_precision == nullptr)
219}
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 243 of file mzintegrationparams.cpp.

244{
245 m_removeZeroValDataPoints = removeOrNot;
246}

References m_removeZeroValDataPoints.

◆ setSmallestMz()

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

Definition at line 147 of file mzintegrationparams.cpp.

148{
149 m_smallestMz = value;
150}

References m_smallestMz.

◆ toString()

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

Definition at line 668 of file mzintegrationparams.cpp.

669{
670 QString lead;
671
672 for(int iter = 0; iter < offset; ++iter)
673 lead += spacer;
674
675 QString text = lead;
676 text += "m/z integration parameters:\n";
677
678 text += lead;
679 text += spacer;
680 if(m_smallestMz != std::numeric_limits<double>::max())
681 text.append(
682 QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
683
684 text += lead;
685 text += spacer;
686 if(m_greatestMz != std::numeric_limits<double>::min())
687 text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
688
689 text += lead;
690 text += spacer;
691 text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
692
693 std::map<BinningType, QString>::iterator it;
694 it = binningTypeMap.find(m_binningType);
695
696 if(it == binningTypeMap.end())
697 qFatal("Programming error.");
698
699 text += lead;
700 text += spacer;
701 text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
702
703 // Only provide the details relative to the ARBITRARY binning type.
704
706 {
707 text += lead;
708 text += spacer;
709 text += spacer;
710 text.append(QString("Bin nominal size: %1\n")
711 .arg(mp_precision->getNominal(), 0, 'f', 6));
712
713 text += lead;
714 text += spacer;
715 text += spacer;
716 text.append(QString("Bin size: %2\n")
717 .arg(mp_precision->toString().toLatin1().data()));
718 }
719
720 // Now other data that are independent of the bin settings.
721
722 text += lead;
723 text += spacer;
724 text +=
725 QString("Apply m/z shift: %1\n").arg(m_applyMzShift ? "true" : "false");
726
728 {
729 text += lead;
730 text += spacer;
731 text += spacer;
732 text += QString("m/z shift: %1").arg(m_mzShift, 0, 'f', 6);
733 }
734
735 text += lead;
736 text += spacer;
737 text += QString("Remove 0-val data points: %1\n")
738 .arg(m_removeZeroValDataPoints ? "true" : "false");
739
740 return text;
741}
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_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 175 of file mzintegrationparams.cpp.

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

References m_greatestMz.

◆ updateSmallestMz()

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

Definition at line 154 of file mzintegrationparams.cpp.

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

References m_smallestMz.

Member Data Documentation

◆ m_applyMzShift

bool pappso::MzIntegrationParams::m_applyMzShift = false
private

Definition at line 162 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 163 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: