| 182 | } |
| 183 | |
| 184 | ExitCodes main_(int, const char**) override |
| 185 | { |
| 186 | //------------------------------------------------------------- |
| 187 | // parameter handling |
| 188 | //------------------------------------------------------------- |
| 189 | StringList file_names = getStringList_("in"); |
| 190 | String out = getStringOption_("out"); |
| 191 | String add_to = getStringOption_("add_to"); |
| 192 | bool annotate_file_origin = getStringOption_("annotate_file_origin") == "true" ? true : false; |
| 193 | |
| 194 | if (file_names.empty()) |
| 195 | { |
| 196 | // this also allows exactly 1 file, because it might be useful for |
| 197 | // a TOPPAS pipeline containing an IDMerger, to run only with one file |
| 198 | writeLogError_("No input filename given. Aborting!"); |
| 199 | printUsage_(); |
| 200 | return ILLEGAL_PARAMETERS; |
| 201 | } |
| 202 | |
| 203 | bool pepxml_protxml = getFlag_("pepxml_protxml"); |
| 204 | if (pepxml_protxml && (file_names.size() != 2)) |
| 205 | { |
| 206 | writeLogError_("Exactly two input filenames expected for option 'pepxml_protxml'. Aborting!"); |
| 207 | printUsage_(); |
| 208 | return ILLEGAL_PARAMETERS; |
| 209 | } |
| 210 | if (pepxml_protxml && !add_to.empty()) |
| 211 | { |
| 212 | // currently not allowed to keep the code simpler and because it doesn't |
| 213 | // seem useful, but should be possible in principle: |
| 214 | writeLogError_("The options 'add_to' and 'pepxml_protxml' cannot be used together. Aborting!"); |
| 215 | printUsage_(); |
| 216 | return ILLEGAL_PARAMETERS; |
| 217 | } |
| 218 | |
| 219 | bool merge_proteins_add_PSMs = getFlag_("merge_proteins_add_PSMs"); |
| 220 | if (merge_proteins_add_PSMs && (pepxml_protxml || !add_to.empty())) |
| 221 | { |
| 222 | // currently not allowed to keep the code simpler and because it doesn't |
| 223 | // seem useful, but should be possible in principle: |
| 224 | writeLogError_("The options 'merge_proteins_add_PSMs', 'add_to' and 'pepxml_protxml' cannot be used together. Aborting!"); |
| 225 | printUsage_(); |
| 226 | return ILLEGAL_PARAMETERS; |
| 227 | } |
| 228 | |
| 229 | // check file types: |
| 230 | FileTypes::Type type; |
| 231 | String out_type = getStringOption_("out_type"); |
| 232 | if (!out_type.empty()) |
| 233 | { |
| 234 | type = FileTypes::nameToType(out_type); |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | type = FileHandler::getTypeByFileName(out); |
| 239 | } |
| 240 | for (const String& file_name : file_names) |
| 241 | { |
nothing calls this directly
no test coverage detected