MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / prepareChromatogram

Function prepareChromatogram

src/openms_gui/source/VISUAL/Plot1DCanvas.cpp:49–88  ·  view source on GitHub ↗

returns an MSExp with a single spec (converted from @p exp_sptr's chromatograms at index @p index (or ondisc_sptr, if that should be empty)

Source from the content-addressed store, hash-verified

47
48 /// returns an MSExp with a single spec (converted from @p exp_sptr's chromatograms at index @p index (or ondisc_sptr, if that should be empty)
49 Plot1DCanvas::ExperimentSharedPtrType prepareChromatogram(Size index, const Plot1DCanvas::ExperimentSharedPtrType& exp_sptr, const Plot1DCanvas::ODExperimentSharedPtrType& ondisc_sptr)
50 {
51 // create a managed pointer fill it with a spectrum containing the chromatographic data
52 LayerDataBase::ExperimentSharedPtrType chrom_exp_sptr(new LayerDataBase::ExperimentType());
53 chrom_exp_sptr->setMetaValue("is_chromatogram", "true"); //this is a hack to store that we have chromatogram data
54 LayerDataBase::ExperimentType::SpectrumType spectrum;
55
56 // retrieve chromatogram (either from in-memory or on-disc representation)
57 MSChromatogram current_chrom = exp_sptr->getChromatograms()[index];
58 if (current_chrom.empty())
59 {
60 current_chrom = ondisc_sptr->getChromatogram(index);
61 }
62
63 // fill "dummy" spectrum with chromatogram data
64 for (const ChromatogramPeak& cpeak : current_chrom)
65 {
66 spectrum.emplace_back(cpeak.getRT(), cpeak.getIntensity());
67 }
68
69 spectrum.getFloatDataArrays() = current_chrom.getFloatDataArrays();
70 spectrum.getIntegerDataArrays() = current_chrom.getIntegerDataArrays();
71 spectrum.getStringDataArrays() = current_chrom.getStringDataArrays();
72
73 // Add at least one data point to the chromatogram, otherwise
74 // "addPeakLayer" will fail and a segfault occurs later
75 if (current_chrom.empty())
76 {
77 spectrum.emplace_back(-1, 0);
78 }
79 chrom_exp_sptr->addSpectrum(spectrum);
80
81 // store peptide_sequence if available
82 if (current_chrom.getPrecursor().metaValueExists("peptide_sequence"))
83 {
84 chrom_exp_sptr->setMetaValue("peptide_sequence", current_chrom.getPrecursor().getMetaValue("peptide_sequence"));
85 }
86
87 return chrom_exp_sptr;
88 }
89
90
91 Plot1DCanvas::Plot1DCanvas(const Param& preferences, const DIM gravity_axis, QWidget* parent) :

Callers

nothing calls this directly

Calls 10

getChromatogramsMethod · 0.80
getChromatogramMethod · 0.80
emplace_backMethod · 0.80
addSpectrumMethod · 0.80
metaValueExistsMethod · 0.80
getMetaValueMethod · 0.80
setMetaValueMethod · 0.45
emptyMethod · 0.45
getRTMethod · 0.45
getIntensityMethod · 0.45

Tested by

no test coverage detected