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
427 // Now that we have defined the value of m_decimalPlaces, let's use that
428 // value.
429
430 double first_mz = ceil((min_mz * std::pow(10, m_decimalPlaces)) - 0.49) /
431 pow(10, m_decimalPlaces);
432 double last_mz =
433 ceil((max_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
434
435 // qDebug() << "After having accounted for the decimals, new min/max values:"
436 //<< QString::asprintf("Very first data point: %.6f\n", first_mz)
437 //<< QString::asprintf("Very last data point to reach: %.6f\n",
438 // last_mz);
439
440 // Instanciate the vector of mz double_s that we'll feed with the bins.
441
442 std::vector<pappso::pappso_double> bins;
443
444 // Store that very first value for later use in the loop.
445 // The bins are notking more than:
446 //
447 // 1. The first mz (that is the smallest mz value found in all the spectra
448 // 2. A sequence of mz values corresponding to that first mz value
449 // incremented by the bin size.
450
451 // Seed the root of the bin vector with the first mz value rounded above as
452 // requested.
453 pappso::pappso_double previous_mz_bin = first_mz;
454
455 bins.push_back(previous_mz_bin);
456
457 // Now continue adding mz values until we have reached the end of the
458 // spectrum, that is the max_mz value, as converted using the decimals to
459 // last_mz.
460
461 // debugCount value used below for debugging purposes.
462 // int debugCount = 0;
463
464 while(previous_mz_bin <= last_mz)
465 {
466
467 // qDebug() << "Now starting the bin creation loop.";
468
469 // Calculate dynamically the precision delta according to the current mz
470 // value.
471
472 // double precision_delta = mp_precision->delta(previous_mz_bin);
473 // qDebug() << "precision_delta: " << precision_delta;
474
475 double current_mz =
476 previous_mz_bin + mp_precision->delta(previous_mz_bin);
477
478 // qDebug() << QString::asprintf(
479 //"previous_mzBin: %.6f and current_mz: %.6f\n",
480 // previous_mz_bin,
481 // current_mz);
482
483 // Now apply on the obtained mz value the decimals that were either set
484 // or computed earlier.
485
486 double current_rounded_mz =
487 ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
488 pow(10, m_decimalPlaces);
489
490 // qDebug() << QString::asprintf(
491 //"current_mz: %.6f and current_rounded_mz: %.6f and previous_mzBin "
492 //": % .6f\n ",
493 // current_mz,
494 // current_rounded_mz,
495 // previous_mz_bin);
496
497 // If rounding makes the new value identical to the previous one, then
498 // that means that we need to decrease roughness.
499
500 if(current_rounded_mz == previous_mz_bin)
501 {
503
504 current_rounded_mz =
505 ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) /
506 pow(10, m_decimalPlaces);
507
508 // qDebug().noquote()
509 //<< "Had to increment decimal places by one while creating the bins "
510 //"in BinningType::ARBITRARY mode..";
511 }
512
513 bins.push_back(current_rounded_mz);
514
515 // Use the local_mz value for the storage of the previous mz bin.
516 previous_mz_bin = current_rounded_mz;
517 }
518
519
520#if 0
521
522 QString fileName = "/tmp/massSpecArbitraryBins.txt-at-" +
523 QDateTime::currentDateTime().toString("yyyyMMdd-HH-mm-ss");
524
525 qDebug() << "Writing the list of bins setup in the "
526 "mass spectrum in file "
527 << fileName;
528
529 QFile file(fileName);
530 file.open(QIODevice::WriteOnly);
531
532 QTextStream fileStream(&file);
533
534 for(auto &&bin : bins)
535 fileStream << QString("%1\n").arg(bin, 0, 'f', 10);
536
537 fileStream.flush();
538 file.close();
539
540#endif
541
542 // qDebug() << "Prepared bins with " << bins.size() << "elements."
543 //<< "starting with mz" << bins.front() << "ending with mz"
544 //<< bins.back();
545
546 return bins;
547}
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 551 of file mzintegrationparams.cpp.

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

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