ExitCodes main_(int, const char**) { //------------------------------------------------------------- // parameter handling //------------------------------------------------------------- String in = getStringOption_("in"); String out = getStringOption_("out"); //------------------------------------------------------------- // loading input //------------------------------------------------------------- MzMLFile mz_data_file; mz_data_file.setLogType(log_type_); MSExperiment<Peak1D> ms_peakmap; std::vector<Int> ms_level(1,2); (mz_data_file.getOptions()).setMSLevels(ms_level); mz_data_file.load(in, ms_peakmap); if (ms_peakmap.empty()) { LOG_WARN << "The given file does not contain any conventional peak data, but might" " contain chromatograms. This tool currently cannot handle them, sorry."; return INCOMPATIBLE_INPUT_DATA; } // FeatureMap<> ms_feat_map; MzTab mztab_output; // FeatureXMLFile().load(in, ms_feat_map); MzTabFile mztab_outfile; //------------------------------------------------------------- // get parameters //------------------------------------------------------------- Param ams_param = getParam_().copy("algorithm:", true); writeDebug_("Parameters passed to MetaboliteSpectralMatcher", ams_param, 3); //------------------------------------------------------------- // do the work //------------------------------------------------------------- MetaboliteSpectralMatching ams; ams.setParameters(ams_param); ams.run(ms_peakmap, mztab_output); //std::vector<String> results; // ams.queryByMass(308.09, results); //------------------------------------------------------------- // writing output //------------------------------------------------------------- // annotate output with data processing info //addDataProcessing_(ms_feat_map, getProcessingInfo_(DataProcessing::IDENTIFICATION_MAPPING)); mztab_outfile.store(out, mztab_output); //FeatureXMLFile().store(out, ms_feat_map); return EXECUTION_OK; }
ExitCodes main_(int, const char**) override { //------------------------------------------------------------- // parameter handling //------------------------------------------------------------- String in = getStringOption_("in"); String database = getStringOption_("database"); String spec_db_filename(database); // default path? retrieve file path in share folder if (database == "CHEMISTRY/MetaboliteSpectralDB.mzML") { // throws Exception::FileNotFound if file does not exist spec_db_filename = File::find("CHEMISTRY/MetaboliteSpectralDB.mzML"); } String out = getStringOption_("out"); //------------------------------------------------------------- // loading input //------------------------------------------------------------- MzMLFile mz_file; mz_file.setLogType(log_type_); std::vector<Int> ms_level(1,2); mz_file.getOptions().setMSLevels(ms_level); PeakMap ms_peakmap; mz_file.load(in, ms_peakmap); if (ms_peakmap.empty()) { LOG_WARN << "The input file does not contain any spectra."; return INCOMPATIBLE_INPUT_DATA; } MzTab mztab_output; MzTabFile mztab_outfile; //------------------------------------------------------------- // get parameters //------------------------------------------------------------- Param ams_param = getParam_().copy("algorithm:", true); writeDebug_("Parameters passed to MetaboliteSpectralMatcher", ams_param, 3); //------------------------------------------------------------- // load database //------------------------------------------------------------- PeakMap spec_db; mz_file.load(spec_db_filename, spec_db); if (spec_db.empty()) { LOG_WARN << "The spectral library does not contain any spectra."; return INCOMPATIBLE_INPUT_DATA; } //------------------------------------------------------------- // run spectral library search //------------------------------------------------------------- MetaboliteSpectralMatching ams; ams.setParameters(ams_param); ams.run(ms_peakmap, spec_db, mztab_output); //------------------------------------------------------------- // store results //------------------------------------------------------------- mztab_outfile.store(out, mztab_output); return EXECUTION_OK; }