84 template <
typename ExperimentType>
87 for (std::vector<MSChromatogram >::const_iterator it = exp.getChromatograms().begin(); it != exp.getChromatograms().end(); ++it)
90 for (
typename ExperimentType::ChromatogramType::const_iterator pit = it->begin(); pit != it->end(); ++pit)
96 spec.getProducts().push_back(it->getProduct());
97 spec.setRT(pit->getRT());
99 spec.setInstrumentSettings(it->getInstrumentSettings());
100 spec.setAcquisitionInfo(it->getAcquisitionInfo());
101 spec.setSourceFile(it->getSourceFile());
115 peak.
setMZ(it->getMZ());
116 peak.setIntensity(pit->getIntensity());
117 spec.push_back(peak);
118 exp.addSpectrum(spec);
122 exp.setChromatograms(std::vector<MSChromatogram >());
136 template <
typename ExperimentType>
142 for (
typename ExperimentType::ConstIterator it = exp.begin(); it != exp.end(); ++it)
148 if (it->getPrecursors().size() == 1 && it->size() == 1)
150 chroms[it->getPrecursors().begin()->getMZ()][it->begin()->getMZ()].push_back(*it);
156 else if (it->getPrecursors().size() == 1 && it->size() > 0)
158 for (
Size peak_idx = 0; peak_idx < it->size(); peak_idx++)
163 dummy.push_back((*it)[peak_idx]);
164 chroms[it->getPrecursors().begin()->getMZ()][(*it)[peak_idx].getMZ()].push_back(dummy);
168 else if (force_conversion)
172 double mz = p.getMZ();
174 chr_p.
setRT(it->getRT());
176 if (chroms_xic.find(mz) == chroms_xic.end())
179 chroms_xic[mz].getPrecursor().setMZ(mz);
181 chroms_xic[mz].setInstrumentSettings(it->getInstrumentSettings());
182 chroms_xic[mz].getPrecursor().setMetaValue(
"description",
String(
"XIC @ " +
String(mz)));
183 chroms_xic[mz].setAcquisitionInfo(it->getAcquisitionInfo());
184 chroms_xic[mz].setSourceFile(it->getSourceFile());
186 chroms_xic[mz].push_back(chr_p);
191 LOG_WARN <<
"ChromatogramTools: need exactly one precursor (given " << it->getPrecursors().size() <<
192 ") and one or more product ions (" << it->size() <<
"), skipping conversion of this spectrum to chromatogram. If this is a MS1 chromatogram, please force conversion (e.g. with -convert_to_chromatograms)." << std::endl;
205 for (
auto & chrom: chroms_xic) exp.addChromatogram(chrom.second);
209 for (; it1 != chroms.end(); ++it1)
212 for (; it2 != it1->second.end(); ++it2)
215 chrom.
setPrecursor(*it2->second.begin()->getPrecursors().begin());
217 prod.
setMZ(it2->first);
218 chrom.setProduct(prod);
219 chrom.setInstrumentSettings(it2->second.begin()->getInstrumentSettings());
220 chrom.setAcquisitionInfo(it2->second.begin()->getAcquisitionInfo());
221 chrom.setSourceFile(it2->second.begin()->getSourceFile());
223 typename std::vector<SpectrumType>::const_iterator it3 = it2->second.begin();
224 for (; it3 != it2->second.end(); ++it3)
227 p.
setRT(it3->getRT());
228 p.setIntensity(it3->begin()->getIntensity());
232 chrom.setNativeID(
"chromatogram=" + it2->second.begin()->getNativeID());
234 exp.addChromatogram(chrom);
void setRT(CoordinateType rt)
Mutable access to RT.
Definition: ChromatogramPeak.h:122
A more convenient string class.
Definition: String.h:57
void setMZ(CoordinateType coordinate)
Mutable access to the m/z coordinate (index 1)
Definition: Peak2D.h:202
Product meta information.
Definition: Product.h:48
Predicate that determines if a spectrum has a certain scan mode.
Definition: RangeUtils.h:206
Peak2D PeakType
Definition: MassTrace.h:47
void setMZ(double mz)
sets the target m/z
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
MSChromatogram ChromatogramType
Definition: MzDataHandler.h:61
Selected reaction monitoring scan Synonyms: 'Multiple reaction monitoring scan', 'SRM scan', 'MRM scan'.
Definition: InstrumentSettings.h:59
#define LOG_WARN
Macro if a warning, a piece of information which should be read by the user, should be logged...
Definition: LogStream.h:450
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
void setRT(CoordinateType coordinate)
Mutable access to the RT coordinate (index 0)
Definition: Peak2D.h:214
Selected ion monitoring scan Synonyms: 'Multiple ion monitoring scan', 'SIM scan', 'MIM scan'.
Definition: InstrumentSettings.h:58
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: ChromatogramSettings.h:73
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:113
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:54
Definition: ChromatogramSettings.h:72
void setPrecursor(const Precursor &precursor)
sets the precursors
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:50
MSSpectrum SpectrumType
Definition: MzDataHandler.h:60