| 581 | } |
| 582 | |
| 583 | ExitCodes main_(int, const char**) override |
| 584 | { |
| 585 | //------------------------------------------------------------- |
| 586 | // parsing parameters |
| 587 | //------------------------------------------------------------- |
| 588 | |
| 589 | // do this early, to see if comet is installed |
| 590 | String comet_executable = getStringOption_("comet_executable"); |
| 591 | File::TempDir tmp_dir(debug_level_ >= 2); |
| 592 | |
| 593 | writeDebug_("Comet is writing the default parameter file...", 1); |
| 594 | |
| 595 | TOPPBase::ExitCodes exit_code = runExternalProcess_(comet_executable.toQString(), QStringList() << "-p", tmp_dir.getPath().toQString()); |
| 596 | if (exit_code != EXECUTION_OK) |
| 597 | { |
| 598 | return EXTERNAL_PROGRAM_ERROR; |
| 599 | } |
| 600 | // the first line of 'comet.params.new' contains a string like: "# comet_version 2017.01 rev. 1" |
| 601 | String comet_version; |
| 602 | { |
| 603 | std::ifstream ifs(tmp_dir.getPath() + "/comet.params.new"); |
| 604 | getline(ifs, comet_version); |
| 605 | } |
| 606 | writeDebug_("Comet Version extracted is: '" + comet_version + "\n", 2); |
| 607 | |
| 608 | //------------------------------------------------------------- |
| 609 | // reading input |
| 610 | //------------------------------------------------------------- |
| 611 | |
| 612 | |
| 613 | int ms_level = getIntOption_("ms_level"); |
| 614 | String inputfile_name = getRawfileName(ms_level); |
| 615 | String out = getStringOption_("out"); |
| 616 | String db_name = getDBFilename(); |
| 617 | |
| 618 | // tmp_dir |
| 619 | String tmp_pepxml = tmp_dir.getPath() + "result.pep.xml"; |
| 620 | String tmp_pin = tmp_dir.getPath() + "result.pin"; |
| 621 | String default_params = getStringOption_("default_params_file"); |
| 622 | String tmp_file; |
| 623 | |
| 624 | // default params given or to be written |
| 625 | if (default_params.empty()) |
| 626 | { |
| 627 | tmp_file = tmp_dir.getPath() + "param.txt"; |
| 628 | ofstream os(tmp_file.c_str()); |
| 629 | auto ret = createParamFile_(os, comet_version); |
| 630 | os.close(); |
| 631 | if (ret != EXECUTION_OK) |
| 632 | { |
| 633 | return ret; |
| 634 | } |
| 635 | } |
| 636 | else |
| 637 | { |
| 638 | tmp_file = default_params; |
| 639 | } |
| 640 |
nothing calls this directly
no test coverage detected