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)
| 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) : |
nothing calls this directly
no test coverage detected