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

Method main_

src/topp/ImageCreator.cpp:226–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224 }
225
226 ExitCodes main_(int, const char**) override
227 {
228 //----------------------------------------------------------------
229 // load data
230 //----------------------------------------------------------------
231 String in = getStringOption_("in");
232 String in_featureXML = getStringOption_("in_featureXML");
233 String out = getStringOption_("out");
234 String format = getStringOption_("out_type");
235 if (format.trim().empty()) // get from filename
236 {
237 try
238 {
239 format = out.suffix('.');
240 }
241 catch (Exception::ElementNotFound& /*e*/)
242 {
243 format = "nosuffix";
244 }
245 if (!ListUtils::contains(out_formats_, format.toLower()))
246 {
247 OPENMS_LOG_ERROR << "No explicit image output format was provided via 'out_type', and the suffix ('" << format << "') does not resemble a valid type. Please fix one of them." << std::endl;
248 return ILLEGAL_PARAMETERS;
249 }
250 }
251 const double init = numeric_limits<double>::max();
252 double rt_min = -init, rt_max = init, mz_min = -init, mz_max = init;
253 bool filter_rt = parseRange_(getStringOption_("rt"), rt_min, rt_max);
254 if (rt_min > rt_max) swap(rt_min, rt_max);
255 bool filter_mz = parseRange_(getStringOption_("mz"), mz_min, mz_max);
256 if (mz_min > mz_max) swap(mz_min, mz_max);
257 bool show_precursors = getFlag_("precursors");
258
259 PeakMap exp;
260 MzMLFile f;
261 f.setLogType(log_type_);
262 if (filter_rt) f.getOptions().setRTRange(DRange<1>(rt_min, rt_max));
263 if (filter_mz) f.getOptions().setMZRange(DRange<1>(mz_min, mz_max));
264 if (!show_precursors) f.getOptions().setMSLevels({1});
265 f.load(in, exp);
266 if (filter_mz && show_precursors)
267 {
268 // MS2 spectra were not filtered by precursor m/z, remove them now:
269 auto predicate =
270 InPrecursorMZRange<MSSpectrum>(mz_min, mz_max, true);
271 exp.getSpectra().erase(remove_if(exp.begin(), exp.end(), predicate),
272 exp.end());
273 }
274 exp.updateRanges(1);
275
276 Size rows = getIntOption_("height"), cols = getIntOption_("width");
277 if (rows == 0) rows = exp.size();
278 if (cols == 0) cols = UInt(ceil(exp.getMaxMZ() - exp.getMinMZ()));
279
280 //----------------------------------------------------------------
281 //Do the actual resampling
282 BilinearInterpolation<double, double> bilip;
283 bilip.getData().resize(rows, cols);

Callers

nothing calls this directly

Calls 15

toLowerMethod · 0.80
setLogTypeMethod · 0.80
setMSLevelsMethod · 0.80
getMaxMZMethod · 0.80
getMinMZMethod · 0.80
setMapping_0Method · 0.80
getMaxRTMethod · 0.80
getMinRTMethod · 0.80
setMapping_1Method · 0.80
getMSLevelMethod · 0.80
sizePairMethod · 0.80
interpolatedColorAtMethod · 0.80

Tested by

no test coverage detected