| 199 | } |
| 200 | |
| 201 | void CachedMzMLHandler::writeMetadata(MapType exp, const String& out_meta, bool addCacheMetaValue) |
| 202 | { |
| 203 | // delete the actual data for all spectra and chromatograms, leave only metadata |
| 204 | // TODO : remove copy |
| 205 | std::vector<MSChromatogram > chromatograms = exp.getChromatograms(); // copy |
| 206 | for (Size i = 0; i < exp.size(); i++) |
| 207 | { |
| 208 | exp[i].clear(false); |
| 209 | } |
| 210 | for (Size i = 0; i < exp.getChromatograms().size(); i++) |
| 211 | { |
| 212 | chromatograms[i].clear(false); |
| 213 | } |
| 214 | exp.setChromatograms(chromatograms); |
| 215 | |
| 216 | if (addCacheMetaValue) |
| 217 | { |
| 218 | // set dataprocessing on each spectrum/chromatogram |
| 219 | boost::shared_ptr< DataProcessing > dp = boost::shared_ptr< DataProcessing >(new DataProcessing); |
| 220 | std::set<DataProcessing::ProcessingAction> actions; |
| 221 | actions.insert(DataProcessing::FORMAT_CONVERSION); |
| 222 | dp->setProcessingActions(actions); |
| 223 | dp->setMetaValue("cached_data", "true"); |
| 224 | for (Size i=0; i<exp.size(); ++i) |
| 225 | { |
| 226 | exp[i].getDataProcessing().push_back(dp); |
| 227 | } |
| 228 | std::vector<MSChromatogram > l_chromatograms = exp.getChromatograms(); |
| 229 | for (Size i=0; i<l_chromatograms.size(); ++i) |
| 230 | { |
| 231 | l_chromatograms[i].getDataProcessing().push_back(dp); |
| 232 | } |
| 233 | exp.setChromatograms(l_chromatograms); |
| 234 | } |
| 235 | |
| 236 | // store the meta data using the regular MzMLFile |
| 237 | MzMLFile().store(out_meta, exp); |
| 238 | } |
| 239 | |
| 240 | void CachedMzMLHandler::writeMetadata_x(const MapType& exp, const String& out_meta, const bool addCacheMetaValue) |
| 241 | { |
no test coverage detected