| 448 | } |
| 449 | |
| 450 | ExitCodes main_(int, const char**) override |
| 451 | { |
| 452 | String java_executable = getStringOption_("java_executable"); |
| 453 | if (!getFlag_("force")) |
| 454 | { |
| 455 | if (!JavaInfo::canRun(java_executable)) |
| 456 | { |
| 457 | writeLogError_("Fatal error: Java is needed to run LuciPHOr2!"); |
| 458 | return EXTERNAL_PROGRAM_ERROR; |
| 459 | } |
| 460 | } |
| 461 | else |
| 462 | { |
| 463 | writeLogWarn_("The installation of Java was not checked."); |
| 464 | } |
| 465 | |
| 466 | //tmp_dir |
| 467 | File::TempDir tmp_dir(debug_level_ >= 2); |
| 468 | |
| 469 | // create a temporary config file for LuciPHOr2 parameters |
| 470 | String conf_file = tmp_dir.getPath() + "luciphor2_input_template.txt"; |
| 471 | |
| 472 | String id = getStringOption_("id"); |
| 473 | String in = getStringOption_("in"); |
| 474 | String out = getStringOption_("out"); |
| 475 | double rt_tolerance = getDoubleOption_("rt_tolerance"); |
| 476 | |
| 477 | FileHandler fh; |
| 478 | FileTypes::Type in_type = fh.getType(id); |
| 479 | |
| 480 | vector<PeptideIdentification> pep_ids; |
| 481 | vector<ProteinIdentification> prot_ids; |
| 482 | |
| 483 | PeakMap exp; |
| 484 | MzMLFile file; |
| 485 | file.setLogType(log_type_); |
| 486 | PeakFileOptions options; |
| 487 | options.clearMSLevels(); |
| 488 | options.addMSLevel(2); |
| 489 | |
| 490 | file.load(in, exp); |
| 491 | exp.sortSpectra(true); |
| 492 | |
| 493 | // convert idXML input to pepXML if necessary |
| 494 | if (in_type == FileTypes::IDXML) |
| 495 | { |
| 496 | IdXMLFile().load(id, prot_ids, pep_ids); |
| 497 | if (!pep_ids.empty()) |
| 498 | { |
| 499 | IDFilter::keepNBestHits(pep_ids, 1); // LuciPHOR2 only calculates the best hit |
| 500 | } |
| 501 | else |
| 502 | { |
| 503 | OPENMS_LOG_WARN << "No PeptideIdentifications found in the IdXMLFile. Please check your previous steps.\n"; |
| 504 | } |
| 505 | // create a temporary pepXML file for LuciPHOR2 input |
| 506 | String id_file_name = FileHandler::swapExtension(File::basename(id), FileTypes::PEPXML); |
| 507 | id = tmp_dir.getPath() + id_file_name; |
nothing calls this directly
no test coverage detected