| 14 | namespace OpenMS |
| 15 | { |
| 16 | void ChromeleonFile::load(const String& filename, MSExperiment& experiment) const |
| 17 | { |
| 18 | experiment.clear(true); |
| 19 | std::ifstream ifs(filename, std::ifstream::in); |
| 20 | if (!ifs.is_open()) |
| 21 | { |
| 22 | throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename); |
| 23 | } |
| 24 | String line; |
| 25 | MSChromatogram chromatogram; |
| 26 | boost::smatch m; |
| 27 | boost::regex re_channel("^Channel\t(.*)", boost::regex::no_mod_s); |
| 28 | boost::regex re_injection("^Injection\t(.*)", boost::regex::no_mod_s); |
| 29 | boost::regex re_processing_method("^Processing Method\t(.*)", boost::regex::no_mod_s); |
| 30 | boost::regex re_instrument_method("^Instrument Method\t(.*)", boost::regex::no_mod_s); |
| 31 | boost::regex re_injection_date("^Injection Date\t(.*)", boost::regex::no_mod_s); |
| 32 | boost::regex re_injection_time("^Injection Time\t(.*)", boost::regex::no_mod_s); |
| 33 | boost::regex re_detector("^Detector\t(.*)", boost::regex::no_mod_s); |
| 34 | boost::regex re_signal_quantity("^Signal Quantity\t(.*)", boost::regex::no_mod_s); |
| 35 | boost::regex re_signal_unit("^Signal Unit\t(.*)", boost::regex::no_mod_s); |
| 36 | boost::regex re_signal_info("^Signal Info\t(.*)", boost::regex::no_mod_s); |
| 37 | boost::regex re_raw_data("^Raw Data:", boost::regex::no_mod_s); |
| 38 | boost::regex re_chromatogram_data("^Chromatogram Data:", boost::regex::no_mod_s); |
| 39 | while (!ifs.eof()) |
| 40 | { |
| 41 | TextFile::getLine(ifs, line); |
| 42 | if (boost::regex_match(line, m, re_injection)) |
| 43 | { |
| 44 | experiment.setMetaValue("mzml_id", m.str(1)); |
| 45 | } |
| 46 | else if (boost::regex_match(line, m, re_channel)) |
| 47 | { |
| 48 | experiment.setMetaValue("acq_method_name", m.str(1)); |
| 49 | } |
| 50 | else if (boost::regex_match(line, m, re_processing_method)) |
| 51 | { |
| 52 | experiment.getExperimentalSettings().getInstrument().getSoftware().setName(m.str(1)); |
| 53 | } |
| 54 | else if (boost::regex_match(line, m, re_instrument_method)) |
| 55 | { |
| 56 | experiment.getExperimentalSettings().getInstrument().setName(m.str(1)); |
| 57 | } |
| 58 | else if (boost::regex_match(line, m, re_injection_date)) |
| 59 | { |
| 60 | experiment.setMetaValue("injection_date", m.str(1)); |
| 61 | } |
| 62 | else if (boost::regex_match(line, m, re_injection_time)) |
| 63 | { |
| 64 | experiment.setMetaValue("injection_time", m.str(1)); |
| 65 | } |
| 66 | else if (boost::regex_match(line, m, re_detector)) |
| 67 | { |
| 68 | experiment.setMetaValue("detector", m.str(1)); |
| 69 | } |
| 70 | else if (boost::regex_match(line, m, re_signal_quantity)) |
| 71 | { |
| 72 | experiment.setMetaValue("signal_quantity", m.str(1)); |
| 73 | } |
nothing calls this directly
no test coverage detected