the main_ function is called after all parameters are read
| 119 | |
| 120 | // the main_ function is called after all parameters are read |
| 121 | ExitCodes main_(int, const char **) override |
| 122 | { |
| 123 | // Assemble command line for SpectraST |
| 124 | QStringList arguments; |
| 125 | |
| 126 | // Executable |
| 127 | String executable = getStringOption_(TOPPSpectraSTSearchAdapter::param_executable); |
| 128 | if (executable.empty()) |
| 129 | { |
| 130 | executable = "spectrast"; |
| 131 | } |
| 132 | |
| 133 | // Make Search Mode explicit |
| 134 | arguments << "-s"; |
| 135 | |
| 136 | double precursor_mz_tolerance = getDoubleOption_(TOPPSpectraSTSearchAdapter::param_precursor_mz_tolerance); |
| 137 | arguments << QString::number(precursor_mz_tolerance).prepend("-sM"); |
| 138 | |
| 139 | // Set the parameter file if present |
| 140 | String params_file = getStringOption_(TOPPSpectraSTSearchAdapter::param_params_file); |
| 141 | if (! params_file.empty()) |
| 142 | { |
| 143 | arguments << params_file.toQString().prepend("-sF"); |
| 144 | } |
| 145 | |
| 146 | // Add library file argument, terminate if the corresponding spidx is not present |
| 147 | String library_file = getStringOption_(TOPPSpectraSTSearchAdapter::param_library_file); |
| 148 | String index_file = FileHandler::stripExtension(library_file).append(".spidx"); |
| 149 | if (! File::exists(index_file)) |
| 150 | { |
| 151 | OPENMS_LOG_ERROR << "ERROR: Index file required by spectrast not found:\n" << index_file << endl; |
| 152 | return INPUT_FILE_NOT_FOUND; |
| 153 | } |
| 154 | arguments << library_file.toQString().prepend("-sL"); |
| 155 | |
| 156 | // Add Sequence Database file if exists |
| 157 | String sequence_database_file = getStringOption_(TOPPSpectraSTSearchAdapter::param_sequence_database_file); |
| 158 | if (! sequence_database_file.empty()) |
| 159 | { |
| 160 | String sequence_database_type = getStringOption_(TOPPSpectraSTSearchAdapter::param_sequence_database_type); |
| 161 | |
| 162 | // Check empty or invalid sequence database type |
| 163 | if (sequence_database_type.empty()) |
| 164 | { |
| 165 | OPENMS_LOG_ERROR << "ERROR: Sequence database type invalid or not provided" << endl; |
| 166 | return MISSING_PARAMETERS; |
| 167 | } |
| 168 | arguments << sequence_database_type.toQString().prepend("-sT"); |
| 169 | arguments << sequence_database_file.toQString().prepend("-sD"); |
| 170 | } |
| 171 | |
| 172 | // Set the number of threads in SpectraST |
| 173 | Int threads = getIntOption_("threads"); |
| 174 | arguments << (threads > 1 ? QString::number(threads).prepend("-sP") : "-sP!"); |
| 175 | |
| 176 | // Set the search file |
| 177 | String search_file = getStringOption_(TOPPSpectraSTSearchAdapter::param_search_file); |
| 178 | if (! search_file.empty()) |