libpappsomspp
Library for mass spectrometry
mzintegrationparams.cpp
Go to the documentation of this file.
1/* BEGIN software license
2 *
3 * msXpertSuite - mass spectrometry software suite
4 * -----------------------------------------------
5 * Copyright(C) 2009,...,2018 Filippo Rusconi
6 *
7 * http://www.msxpertsuite.org
8 *
9 * This file is part of the msXpertSuite project.
10 *
11 * The msXpertSuite project is the successor of the massXpert project. This
12 * project now includes various independent modules:
13 *
14 * - massXpert, model polymer chemistries and simulate mass spectrometric data;
15 * - mineXpert, a powerful TIC chromatogram/mass spectrum viewer/miner;
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 *
30 * END software license
31 */
32
33
34/////////////////////// StdLib includes
35#include <map>
36#include <cmath>
37
38
39/////////////////////// Qt includes
40#include <QDebug>
41#include <QString>
42#include <QFile>
43#include <QDateTime>
44
45
46/////////////////////// pappsomspp includes
47#include "../../utils.h"
48#include "../../massspectrum/massspectrum.h"
49
50
51/////////////////////// Local includes
52#include "mzintegrationparams.h"
53
54
56 qRegisterMetaType<pappso::MzIntegrationParams>("pappso::MzIntegrationParams");
58 qRegisterMetaType<pappso::MzIntegrationParams *>("pappso::MzIntegrationParams *");
59
60
61namespace pappso
62{
63
64
65//! Map relating the BinningType to a textual representation
66std::map<BinningType, QString> binningTypeMap{{BinningType::NONE, "NONE"},
67 {BinningType::DATA_BASED, "DATA_BASED"},
68 {BinningType::ARBITRARY, "ARBITRARY"}};
69
71getBinningTypeFromString(const QString &text)
72{
73 std::map<BinningType, QString>::const_iterator the_iterator_const =
74 std::find_if(binningTypeMap.begin(),binningTypeMap.end(), [text]
75 (const std::pair<BinningType, QString> &pair)
76 {
77 return pair.second == text;
78 });
79
80 if(the_iterator_const != binningTypeMap.end())
81 return the_iterator_const->first;
82
83 return BinningType::NONE;
84}
85
87{
90}
91
92
94{
95 initialize(text);
96}
97
100 BinningType binningType,
101 int decimalPlaces,
102 pappso::PrecisionPtr precisionPtr,
103 int binSizeDivisor,
104 bool removeZeroValDataPoints)
105 : m_smallestMz(minMz),
106 m_greatestMz(maxMz),
107 m_binningType(binningType),
108 m_decimalPlaces(decimalPlaces),
109 mp_binSizeModel(precisionPtr),
110 m_binSizeDivisor(binSizeDivisor),
111 m_removeZeroValDataPoints(removeZeroValDataPoints)
112{
113 if(mp_binSizeModel == nullptr)
115
116 // qDebug() << "mp_precision:" << mp_precision->toString();
117}
118
119
121 : m_smallestMz(other.m_smallestMz),
122 m_greatestMz(other.m_greatestMz),
123 m_binningType(other.m_binningType),
124 m_decimalPlaces(other.m_decimalPlaces),
125 mp_binSizeModel(other.mp_binSizeModel),
126 m_binSizeDivisor(other.m_binSizeDivisor),
127 m_removeZeroValDataPoints(other.m_removeZeroValDataPoints)
128{
129 if(mp_binSizeModel == nullptr)
131
132 // qDebug() << "mp_precision:" << mp_precision->toString();
133}
134
135
137{
138}
139
142{
143 // Set the config to default values. We'll then change these on the
144 // basis of parsing the text.
147 m_decimalPlaces = -1;
150
151 if(text.isEmpty())
153
154 // qDebug() << "Getting text for initialization:" << text;
155
156 // Expected text: "Smallest (first) m/z:294.725158\nGreatest (last) m/z:2055.002453\nDecimal
157 // places:-1\nBinning type:2\nBin size model:0.05 dalton\nBin size divisor:1\nRemove 0-val data
158 // points:1\n"
159
160 // In order to consider that the parameters were correctly read, we need
161 // some of the members to effectively be set from the settings values.
162
163 bool smallest_mz_set = false;
164 bool greatest_mz_set = false;
165 bool binning_type_set = false;
166 bool decimal_places_set = false;
167 bool bin_size_model_set = false;
168 bool bin_size_divisor_set = false;
169 bool remove_zero_data_points_set = false;
170
171 QStringList string_list = text.split("\n");
172
173 for(int iter = 0; iter < string_list.size(); ++iter)
174 {
175 QString iter_string = string_list.at(iter);
176
177 qDebug() << "Iterating in string:" << iter_string;
178
179 if(iter_string.contains("Smallest (first) m/z:"))
180 {
181 smallest_mz_set = true;
182 m_smallestMz = iter_string.split(':').last().toDouble();
183 }
184 else if(iter_string.contains("Greatest (last) m/z:"))
185 {
186 greatest_mz_set = true;
187 m_greatestMz = iter_string.split(':').last().toDouble();
188 }
189 else if(iter_string.contains("Decimal places:"))
190 {
191 decimal_places_set = true;
192 m_decimalPlaces = iter_string.split(':').last().toInt();
193 }
194 else if(iter_string.contains("Binning type:"))
195 {
196 m_binningType = getBinningTypeFromString(iter_string.split(':').last());
197 binning_type_set = true;
198 }
199 else if(iter_string.contains("Bin size model:"))
200 {
201 mp_binSizeModel = PrecisionFactory::fromString(iter_string.split(':').last());
202 bin_size_model_set = true;
203 }
204 else if(iter_string.contains("Bin size divisor:"))
205 {
206 bin_size_divisor_set = true;
207 m_binSizeDivisor = iter_string.split(':').last().toInt();
208 }
209 else if(iter_string.contains("Remove 0-val data points:"))
210 {
211 remove_zero_data_points_set = true;
212 m_removeZeroValDataPoints = iter_string.split(':').last().toInt();
213 }
214 }
215
216 // qDebug() << "At this point the initialization is done and this"
217 // " MzIntegrationParams instance is: "
218 // << toString();
219
220 if(smallest_mz_set && greatest_mz_set && decimal_places_set && binning_type_set &&
221 bin_size_model_set && bin_size_divisor_set && remove_zero_data_points_set)
223
224 if(decimal_places_set && binning_type_set &&
225 bin_size_model_set && bin_size_divisor_set && remove_zero_data_points_set)
227
228 if(binning_type_set &&
229 bin_size_model_set)
231
233}
234
237{
238 if(this == &other)
239 return *this;
240
244
246
248 if(mp_binSizeModel == nullptr)
250
252
254
255 return *this;
256}
257
258
259void
261{
262 m_smallestMz = value;
263}
264
265
266void
268{
269 m_smallestMz = m_smallestMz > value ? value : m_smallestMz;
270}
271
272
275{
276 return m_smallestMz;
277}
278
279
280void
282{
283 m_greatestMz = value;
284}
285
286
287void
289{
290 m_greatestMz = m_greatestMz < value ? value : m_greatestMz;
291}
292
293
296{
297 return m_greatestMz;
298}
299
300
301void
303{
304 m_binningType = binningType;
305}
306
307
310{
311 return m_binningType;
312}
313
314
315void
317{
318 m_decimalPlaces = decimal_places;
319}
320
321
322int
324{
325 return m_decimalPlaces;
326}
327
328void
330{
331 mp_binSizeModel = precisionPtr;
332
333 if(mp_binSizeModel == nullptr)
335}
336
339{
340 return mp_binSizeModel;
341}
342
343
344void
346{
347 m_binSizeDivisor = divisor;
348}
349
350
351int
353{
354 return m_binSizeDivisor;
355}
356
357
358void
360{
361 m_removeZeroValDataPoints = removeOrNot;
362}
363
364
365bool
367{
369}
370
371
372//! Reset the instance to default values.
373void
375{
376 m_smallestMz = std::numeric_limits<double>::min();
377 m_greatestMz = std::numeric_limits<double>::min();
379
380 // Special case for this member datum
382
385}
386
387
388bool
390{
391 int errors = 0;
392
394 errors += 1;
395
397 {
398 // qDebug() << "m_smallestMz:" << m_smallestMz;
399 // qDebug() << "smallest is max:" << (m_smallestMz ==
400 // std::numeric_limits<double>::max());
401
402 errors += (m_smallestMz == std::numeric_limits<double>::max() ? 1 : 0);
403
404 // qDebug() << "m_greatestMz:" << m_greatestMz;
405 // qDebug() << "greatest is min:" << (m_greatestMz ==
406 // std::numeric_limits<double>::min());
407 errors += (m_greatestMz == std::numeric_limits<double>::min() ? 1 : 0);
408
409 // if(mp_precision != nullptr)
410 // qDebug() << mp_precision->toString();
411
412 errors += (mp_binSizeModel == nullptr ? 1 : 0);
413 }
414
415 if(errors)
416 {
417 qDebug() << "The m/z integration parameters are not valid or do not apply...";
418 }
419
420 return !errors;
421}
422
423
424bool
426{
427 return (m_smallestMz != std::numeric_limits<double>::max()) &&
428 (m_greatestMz != std::numeric_limits<double>::min());
429}
430
431
432std::vector<double>
434{
435
436 // qDebug() << "mp_precision:" << mp_precision->toString();
437
438 std::vector<double> bins;
439
441 {
442 // If no binning is to be performed, fine.
443 return bins;
444 }
446 {
447 // Use only data in the MzIntegrationParams member data.
448 return createArbitraryBins();
449 }
451 {
452 // qDebug();
453
454 qFatal("Programming error.");
455 }
456
457 return bins;
458}
459
460
461std::vector<double>
463{
464
465 // qDebug();
466
467 std::vector<double> bins;
468
470 {
471 // If no binning is to be performed, fine.
472 return bins;
473 }
475 {
476 // Use only data in the MzIntegrationParams member data.
477 return createArbitraryBins();
478 }
480 {
481 // qDebug();
482
483 // Use the first spectrum to perform the data-based bins
484
485 return createDataBasedBins(mass_spectrum_csp);
486 }
487
488 return bins;
489}
490
491
492std::vector<double>
494{
495 // Now starts the tricky stuff. Depending on how the binning has been
496 // configured, we need to take diverse actions.
497
498 // qDebug() << "Bin size specification:" << mp_precision->toString();
499
502
503 // qDebug() << "m_smallestMz:" << m_smallestMz
504 //<< "m_greatestMz:" << m_greatestMz;
505
506 // qDebug() << QString::asprintf("min_mz: %.6f\n", min_mz)
507 //<< QString::asprintf("max_mz: %.6f\n", max_mz);
508
509 pappso::pappso_double binSize;
510
512 {
513 double resolution_based_bin_size = mp_binSizeModel->delta(min_mz);
514 binSize = resolution_based_bin_size / m_binSizeDivisor;
515
516 // qDebug() << "With res-based bin size, the uncorrected bin size:"
517 //<< resolution_based_bin_size
518 //<< "and the final binSize:" << binSize;
519 }
520 else
521 binSize = mp_binSizeModel->delta(min_mz);
522
523 // qDebug() << QString::asprintf(
524 //"binSize is the precision delta for min_mz: %.6f\n", binSize);
525
526 // Only compute the decimal places if they were not configured already.
527 if(m_decimalPlaces == -1)
528 {
529 // qDebug() << "Now checking how many decimal places are needed.";
530
531 // We want as many decimal places as there are 0s between the integral
532 // part of the double and the first non-0 cipher. For example, if
533 // binSize is 0.004, zero decimals is 2 and m_decimalPlaces is set to 3,
534 // because we want decimals up to 4 included.
535
537
538 // qDebug() << "With binSize" << binSize
539 //<< " m_decimalPlaces was computed to be:" << m_decimalPlaces;
540 }
541 // else
542 // qDebug() << "m_decimalPlaces: " << m_decimalPlaces;
543
544 // Now that we have defined the value of m_decimalPlaces, let's use that
545 // value.
546
547 double first_mz =
548 ceil((min_mz * std::pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
549 double last_mz = ceil((max_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
550
551 // qDebug() << "After having accounted for the decimals, new min/max values:"
552 //<< QString::asprintf("Very first data point: %.6f\n", first_mz)
553 //<< QString::asprintf("Very last data point to reach: %.6f\n",
554 // last_mz);
555
556 // Instanciate the vector of mz double_s that we'll feed with the bins.
557
558 std::vector<pappso::pappso_double> bins;
559
560 // Store that very first value for later use in the loop.
561 // The bins are notking more than:
562 //
563 // 1. The first mz (that is the smallest mz value found in all the spectra
564 // 2. A sequence of mz values corresponding to that first mz value
565 // incremented by the bin size.
566
567 // Seed the root of the bin vector with the first mz value rounded above as
568 // requested.
569 pappso::pappso_double previous_mz_bin = first_mz;
570
571 bins.push_back(previous_mz_bin);
572
573 // Now continue adding mz values until we have reached the end of the
574 // spectrum, that is the max_mz value, as converted using the decimals to
575 // last_mz.
576
577 // debugCount value used below for debugging purposes.
578 // int debugCount = 0;
579
580 while(previous_mz_bin <= last_mz)
581 {
582
583 // qDebug() << "Now starting the bin creation loop.";
584
585 // Calculate dynamically the precision delta according to the current mz
586 // value.
587
588 // double precision_delta = mp_precision->delta(previous_mz_bin);
589 // qDebug() << "precision_delta: " << precision_delta;
590
591 // In certain circumstances, the bin size is not enough to properly render
592 // hyper-high resolution data (like the theoretical isotopic cluster data
593 // generated in silico). In that case, the bin size, computed using the
594 // precision object, is divided by the m_binSizeDivisor, which normally is
595 // set to 1 as the default, that is, it has no effect.
596
597 double current_mz;
598
600 current_mz = previous_mz_bin + (mp_binSizeModel->delta(previous_mz_bin) / m_binSizeDivisor);
601 else
602 current_mz = previous_mz_bin + mp_binSizeModel->delta(previous_mz_bin);
603
604 // qDebug() << QString::asprintf(
605 //"previous_mzBin: %.6f and current_mz: %.6f\n",
606 // previous_mz_bin,
607 // current_mz);
608
609 // Now apply on the obtained mz value the decimals that were either set
610 // or computed earlier.
611
612 double current_rounded_mz =
613 ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
614
615 // qDebug() << QString::asprintf(
616 //"current_mz: %.6f and current_rounded_mz: %.6f and previous_mzBin "
617 //": % .6f\n ",
618 // current_mz,
619 // current_rounded_mz,
620 // previous_mz_bin);
621
622 // If rounding makes the new value identical to the previous one, then
623 // that means that we need to decrease roughness.
624
625 if(current_rounded_mz == previous_mz_bin)
626 {
628
629 current_rounded_mz =
630 ceil((current_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
631
632 // qDebug().noquote()
633 //<< "Had to increment decimal places by one while creating the bins "
634 //"in BinningType::ARBITRARY mode..";
635 }
636
637 bins.push_back(current_rounded_mz);
638
639 // Use the local_mz value for the storage of the previous mz bin.
640 previous_mz_bin = current_rounded_mz;
641 }
642
643
644#if 0
645
646 QString fileName = "/tmp/massSpecArbitraryBins.txt-at-" +
647 QDateTime::currentDateTime().toString("yyyyMMdd-HH-mm-ss");
648
649 qDebug() << "Writing the list of bins setup in the "
650 "mass spectrum in file "
651 << fileName;
652
653 QFile file(fileName);
654 file.open(QIODevice::WriteOnly);
655
656 QTextStream fileStream(&file);
657
658 for(auto &&bin : bins)
659 fileStream << QString("%1\n").arg(bin, 0, 'f', 10);
660
661 fileStream.flush();
662 file.close();
663
664#endif
665
666 // qDebug() << "Prepared bins with " << bins.size() << "elements."
667 //<< "starting with mz" << bins.front() << "ending with mz"
668 //<< bins.back();
669
670 return bins;
671}
672
673
674std::vector<double>
676{
677 // qDebug();
678
679 // The bins in *this mass spectrum must be calculated starting from the
680 // data in the mass_spectrum_csp parameter.
681
682 // Instanciate the vector of mz double_s that we'll feed with the bins.
683
684 std::vector<pappso::pappso_double> bins;
685
686 if(mass_spectrum_csp->size() < 2)
687 return bins;
688
689 // Make sure the spectrum is sorted, as this functions takes for granted
690 // that the DataPoint instances are sorted in ascending x (== mz) value
691 // order.
692 pappso::MassSpectrum local_mass_spectrum = *mass_spectrum_csp;
693 local_mass_spectrum.sortMz();
694
696
697 // qDebug() << "The min_mz:" << min_mz;
698
699 if(m_decimalPlaces != -1)
700 min_mz = ceil((min_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
701
702
703 // Two values for the definition of a MassSpectrumBin.
704
705 // The first value of the mz range that defines the bin. This value is part
706 // of the bin.
707 pappso::pappso_double start_mz_in = min_mz;
708
709 // The second value of the mz range that defines the bin. This value is
710 // *not* part of the bin.
711 pappso::pappso_double end_mz_out;
712
713 std::vector<pappso::DataPoint>::const_iterator it = local_mass_spectrum.begin();
714
715 pappso::pappso_double prev_mz = it->x;
716
717 if(m_decimalPlaces != -1)
718 prev_mz = ceil((prev_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
719
720 ++it;
721
722 while(it != local_mass_spectrum.end())
723 {
724 pappso::pappso_double next_mz = it->x;
725
726 if(m_decimalPlaces != -1)
727 next_mz = ceil((next_mz * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
728
729 pappso::pappso_double step = next_mz - prev_mz;
730 end_mz_out = start_mz_in + step;
731
732 if(m_decimalPlaces != -1)
733 end_mz_out =
734 ceil((end_mz_out * pow(10, m_decimalPlaces)) - 0.49) / pow(10, m_decimalPlaces);
735
736 // The data point that is crafted has a 0 y-value. The binning must
737 // indeed not create artificial intensity data.
738
739 // qDebug() << "Pushing back bin:" << start_mz_in << end_mz_out;
740
741 bins.push_back(start_mz_in);
742
743 // Prepare next bin
744 start_mz_in = end_mz_out;
745
746 // Update prev_mz to be the current one for next iteration.
747 prev_mz = next_mz;
748
749 // Now got the next DataPoint instance.
750 ++it;
751 }
752
753#if 0
754
755 QString fileName = "/tmp/massSpecDataBasedBins.txt";
756
757 qDebug() << "Writing the list of bins setup in the "
758 "mass spectrum in file "
759 << fileName;
760
761 QFile file(fileName);
762 file.open(QIODevice::WriteOnly);
763
764 QTextStream fileStream(&file);
765
766 for(auto &&bin : m_bins)
767 fileStream << QString("[%1-%2]\n")
768 .arg(bin.startMzIn, 0, 'f', 10)
769 .arg(bin.endMzOut, 0, 'f', 10);
770
771 fileStream.flush();
772 file.close();
773
774 qDebug() << "elements."
775 << "starting with mz" << m_bins.front().startMzIn << "ending with mz"
776 << m_bins.back().endMzOut;
777
778#endif
779
780 return bins;
781}
782
783
784QString
785MzIntegrationParams::toString(int offset, const QString &spacer) const
786{
787 QString lead;
788
789 for(int iter = 0; iter < offset; ++iter)
790 lead += spacer;
791
792 QString text = lead;
793 text += "m/z integration parameters:\n";
794
795 text += lead;
796 text += spacer;
797 if(m_smallestMz != std::numeric_limits<double>::max())
798 text.append(QString::asprintf("Smallest (first) m/z: %.6f\n", m_smallestMz));
799
800 text += lead;
801 text += spacer;
802 if(m_greatestMz != std::numeric_limits<double>::min())
803 text.append(QString::asprintf("Greatest (last) m/z: %.6f\n", m_greatestMz));
804
805 text += lead;
806 text += spacer;
807 text.append(QString("Decimal places: %1\n").arg(m_decimalPlaces));
808
809 std::map<BinningType, QString>::iterator it;
810 it = binningTypeMap.find(m_binningType);
811
812 if(it == binningTypeMap.end())
813 qFatal("Programming error.");
814
815 text += lead;
816 text += spacer;
817 text.append(QString("Binning type: %1\n").arg(it->second.toLatin1().data()));
818
819 // Only provide the details relative to the ARBITRARY binning type.
820
822 {
823 text += lead;
824 text += spacer;
825 text += spacer;
826 text.append(QString("Bin nominal size: %1\n").arg(mp_binSizeModel->getNominal(), 0, 'f', 6));
827
828 text += lead;
829 text += spacer;
830 text += spacer;
831 text.append(QString("Bin size: %2\n").arg(mp_binSizeModel->toString().toLatin1().data()));
832
833 text += lead;
834 text += spacer;
835 text += spacer;
836 text.append(QString("Bin size divisor: %2\n").arg(m_binSizeDivisor));
837 }
838
839 // Now other data that are independent of the bin settings.
840
841 text += lead;
842 text += spacer;
843 text +=
844 QString("Remove 0-val data points: %1\n").arg(m_removeZeroValDataPoints ? "true" : "false");
845
846 return text;
847}
848
849QString
851{
852 QString text;
853
854 if(m_smallestMz != std::numeric_limits<double>::max())
855 text.append(QString::asprintf("Smallest (first) m/z:%.6f\n", m_smallestMz));
856 if(m_greatestMz != std::numeric_limits<double>::min())
857 text.append(QString::asprintf("Greatest (last) m/z:%.6f\n", m_greatestMz));
858 text.append(QString("Decimal places:%1\n").arg(m_decimalPlaces));
859 text.append(QString("Binning type:%1\n").arg(binningTypeMap[m_binningType]));
860
861 // Only provide the details relative to the ARBITRARY binning type.
863 {
864 text.append(QString("Bin size model:%1\n").arg(mp_binSizeModel->toString()));
865 text.append(QString("Bin size divisor:%2\n").arg(m_binSizeDivisor));
866 }
867
868 // Now other data that are independent of the bin settings.
869 text += QString("Remove 0-val data points:%1\n").arg(m_removeZeroValDataPoints);
870
871 return text;
872}
873} // namespace pappso
Class to represent a mass spectrum.
Definition: massspectrum.h:73
void sortMz()
Sort the DataPoint instances of this spectrum.
The MzIntegrationParams class provides the parameters definining how m/z !
Q_INVOKABLE BinningType getBinningType() const
Q_INVOKABLE int getDecimalPlaces() const
pappso::pappso_double getSmallestMz() const
Q_INVOKABLE void setBinSizeModel(pappso::PrecisionPtr bin_size_model)
pappso::pappso_double m_smallestMz
MzIntegrationParams & operator=(const MzIntegrationParams &other)
Q_INVOKABLE pappso::pappso_double getGreatestMz() const
InitializationResult initialize(const QString &text)
pappso::pappso_double m_greatestMz
std::vector< double > createArbitraryBins()
pappso::PrecisionPtr mp_binSizeModel
Q_INVOKABLE void updateSmallestMz(pappso::pappso_double value)
Q_INVOKABLE void updateGreatestMz(pappso::pappso_double value)
Q_INVOKABLE bool isRemoveZeroValDataPoints() const
Q_INVOKABLE bool isValid() const
Q_INVOKABLE pappso::PrecisionPtr getBinSizeModel() const
Q_INVOKABLE bool hasValidMzRange() const
Q_INVOKABLE void setSmallestMz(pappso::pappso_double value)
Q_INVOKABLE void setBinningType(BinningType binningType)
Q_INVOKABLE void reset()
Reset the instance to default values.
std::vector< double > createDataBasedBins(pappso::MassSpectrumCstSPtr massSpectrum)
Q_INVOKABLE QString toString() const
Q_INVOKABLE void setDecimalPlaces(int decimal_places)
Q_INVOKABLE std::vector< pappso::pappso_double > createBins()
Q_INVOKABLE void setRemoveZeroValDataPoints(bool removeOrNot=true)
Q_INVOKABLE void setGreatestMz(pappso::pappso_double value)
virtual QString toString() const =0
virtual pappso_double getNominal() const final
Definition: precision.cpp:72
virtual pappso_double delta(pappso_double value) const =0
virtual PrecisionUnit unit() const =0
static PrecisionPtr getResInstance(pappso_double value)
get a resolution precision pointer
Definition: precision.cpp:180
static PrecisionPtr fromString(const QString &str)
get a precision pointer from a string
Definition: precision.cpp:79
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition: precision.cpp:154
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
Definition: precision.cpp:135
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:102
int mzIntegrationParamsMetaTypeId
int mzIntegrationParamsPtrMetaTypeId
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
BinningType getBinningTypeFromString(const QString &text)
BinningType
Type of binning when performing integrations to a mass spectrum.
@ DATA_BASED
binning based on mass spectral data
@ ARBITRARY
binning based on arbitrary bin size value
@ NONE
< no binning
double pappso_double
A type definition for doubles.
Definition: types.h:52
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition: massspectrum.h:57
std::map< BinningType, QString > binningTypeMap
Map relating the BinningType to a textual representation.