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

Method writeMetadata_x

src/openms/source/FORMAT/HANDLERS/CachedMzMLHandler.cpp:240–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238 }
239
240 void CachedMzMLHandler::writeMetadata_x(const MapType& exp, const String& out_meta, const bool addCacheMetaValue)
241 {
242 // delete the actual data for all spectra and chromatograms, leave only metadata
243 // TODO : remove copy
244 const ExperimentalSettings& qq = exp;
245 MSExperiment out_exp;
246 out_exp = qq;
247 // std::vector<MSChromatogram > chromatograms = exp.getChromatograms(); // copy
248 for (const auto& s: exp)
249 {
250 out_exp.addSpectrum(s);
251 out_exp.getSpectra().back().clear(false);
252 }
253 for (const auto& c: exp.getChromatograms())
254 {
255 out_exp.addChromatogram(c);
256 out_exp.getChromatograms().back().clear(false);
257 }
258
259 if (addCacheMetaValue)
260 {
261 // set dataprocessing on each spectrum/chromatogram
262 boost::shared_ptr< DataProcessing > dp = boost::shared_ptr< DataProcessing >(new DataProcessing);
263 std::set<DataProcessing::ProcessingAction> actions;
264 actions.insert(DataProcessing::FORMAT_CONVERSION);
265 dp->setProcessingActions(actions);
266 dp->setMetaValue("cached_data", "true");
267 for (Size i=0; i<out_exp.size(); ++i)
268 {
269 out_exp[i].getDataProcessing().push_back(dp);
270 }
271 std::vector<MSChromatogram > l_chromatograms = out_exp.getChromatograms();
272 for (Size i=0; i<l_chromatograms.size(); ++i)
273 {
274 l_chromatograms[i].getDataProcessing().push_back(dp);
275 }
276 out_exp.setChromatograms(l_chromatograms);
277 }
278
279 // store the meta data using the regular MzMLFile
280 MzMLFile().store(out_meta, out_exp);
281 }
282
283 std::vector<OpenSwath::BinaryDataArrayPtr> CachedMzMLHandler::readSpectrumFast(std::ifstream& ifs, int& ms_level, double& rt)
284 {

Callers 1

storeMethod · 0.80

Calls 14

MzMLFileClass · 0.85
addSpectrumMethod · 0.80
backMethod · 0.80
getChromatogramsMethod · 0.80
setProcessingActionsMethod · 0.80
setChromatogramsMethod · 0.80
clearMethod · 0.45
addChromatogramMethod · 0.45
insertMethod · 0.45
setMetaValueMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected