| 857 | |
| 858 | |
| 859 | ExitCodes main_(int, const char**) override |
| 860 | { |
| 861 | ProgressLogger progresslogger; |
| 862 | progresslogger.setLogType(log_type_); |
| 863 | |
| 864 | IdentificationData id_data; // container for results |
| 865 | |
| 866 | // load parameters and check validity: |
| 867 | String in_mzml = getStringOption_("in"); |
| 868 | String in_db = getStringOption_("database"); |
| 869 | String in_digest = getStringOption_("digest"); |
| 870 | |
| 871 | if (in_db.empty() && in_digest.empty()) |
| 872 | { |
| 873 | OPENMS_LOG_ERROR << "Error: parameter 'database' or 'digest' must be set" |
| 874 | << endl; |
| 875 | return ILLEGAL_PARAMETERS; |
| 876 | } |
| 877 | if (!in_db.empty() && !in_digest.empty()) |
| 878 | { |
| 879 | OPENMS_LOG_WARN |
| 880 | << "Warning: both 'database' and 'digest' are set; ignoring 'database'" |
| 881 | << endl; |
| 882 | } |
| 883 | |
| 884 | String out = getStringOption_("out"); |
| 885 | String id_out = getStringOption_("id_out"); |
| 886 | String db_out = getStringOption_("db_out"); |
| 887 | String lfq_out = getStringOption_("lfq_out"); |
| 888 | String theo_ms2_out = getStringOption_("theo_ms2_out"); |
| 889 | String exp_ms2_out = getStringOption_("exp_ms2_out"); |
| 890 | bool use_avg_mass = getFlag_("precursor:use_avg_mass"); |
| 891 | Int min_charge = getIntOption_("precursor:min_charge"); |
| 892 | Int max_charge = getIntOption_("precursor:max_charge"); |
| 893 | |
| 894 | // @TODO: allow zero to mean "any charge state in the data"? |
| 895 | if ((min_charge == 0) || (max_charge == 0)) |
| 896 | { |
| 897 | OPENMS_LOG_ERROR << "Error: invalid charge state 0" << endl; |
| 898 | return ILLEGAL_PARAMETERS; |
| 899 | } |
| 900 | // charges can be positive or negative, depending on data acquisition mode: |
| 901 | if (((min_charge < 0) && (max_charge > 0)) || |
| 902 | ((min_charge > 0) && (max_charge < 0))) |
| 903 | { |
| 904 | OPENMS_LOG_ERROR << "Error: mixing positive and negative charges is not allowed" |
| 905 | << endl; |
| 906 | return ILLEGAL_PARAMETERS; |
| 907 | } |
| 908 | // min./max. are based on absolute value: |
| 909 | if (abs(max_charge) < abs(min_charge)) swap(min_charge, max_charge); |
| 910 | bool negative_mode = (max_charge < 0); |
| 911 | Int charge_step = negative_mode ? -1 : 1; |
| 912 | |
| 913 | IdentificationData::DBSearchParam search_param; |
| 914 | for (Int charge = min_charge; abs(charge) <= abs(max_charge); |
| 915 | charge += charge_step) |
| 916 | { |
nothing calls this directly
no test coverage detected