| 27 | |
| 28 | |
| 29 | String SearchEngineBase::getRawfileName(int ms_level) const |
| 30 | { |
| 31 | String inputfile_name = getStringOption_("in"); |
| 32 | FileHandler fh; |
| 33 | auto type = fh.getType(inputfile_name); |
| 34 | switch (type) |
| 35 | { |
| 36 | case FileTypes::MZML: |
| 37 | { |
| 38 | MzMLFile mzml; |
| 39 | mzml.getOptions().setMSLevels({ ms_level }); // only query MS2 (or whatever ms_level is) |
| 40 | const auto& centroid_info = mzml.getCentroidInfo(inputfile_name); |
| 41 | const auto& lvl_info = centroid_info.find(ms_level); |
| 42 | if (lvl_info == centroid_info.end()) |
| 43 | { |
| 44 | throw Exception::FileEmpty(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Error: No MS" + String(ms_level) + " spectra in input file."); |
| 45 | } |
| 46 | |
| 47 | if (lvl_info->second.count_profile > 0) |
| 48 | { |
| 49 | if (getFlag_("force")) |
| 50 | { |
| 51 | OPENMS_LOG_WARN << "Warning: Profile data found, but centroid MS spectra required. " |
| 52 | "Since '-force' flag is in effect, we will continue, but results are likely bogus." << std::endl; |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, |
| 57 | "Error: Profile data provided but centroided MS" + String(ms_level) + " spectra required. To enforce processing (unwise!) of the data enable the -force flag (results will be bogus!)."); |
| 58 | } |
| 59 | } |
| 60 | if (lvl_info->second.count_centroided == 0) |
| 61 | { |
| 62 | if (getFlag_("force")) |
| 63 | { |
| 64 | OPENMS_LOG_WARN << "Warning: No centroided MS" + String(ms_level) + " were found, but are required. " |
| 65 | "Since '-force' flag is in effect, we will continue, but results might be bogus." << std::endl; |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, |
| 70 | "Error: No centroided MS" + String(ms_level) + " spectra were found, but are required. To enforce processing of the data enable the -force flag (results will likely be bogus!)."); |
| 71 | } |
| 72 | } |
| 73 | // do no check for UNKNOWN, since it does not really tell much (UNKNOWN can only occur if meta data is missing and our peak type estimation fails (which only happens for (almost) empty spectra)) |
| 74 | } |
| 75 | case FileTypes::MGF: |
| 76 | // no warning required. MGF files should be centroided by definition |
| 77 | break; |
| 78 | default: |
| 79 | OPENMS_LOG_WARN << "Warning: make sure that MS" << ms_level << " spectra in '" << inputfile_name << "' are centroided. Otherwise the results may be undefined!"; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | return inputfile_name; |
| 84 | } |
| 85 | |
| 86 | String SearchEngineBase::getDBFilename(const String& db) const |
nothing calls this directly
no test coverage detected