| 305 | } |
| 306 | |
| 307 | vector<PeptideIdentification> DBSuitability::runIdentificationSearch_(const MSExperiment& exp, const vector<FASTAFile::FASTAEntry>& fasta_data, const String& adapter_name, Param& parameters) const |
| 308 | { |
| 309 | if (adapter_name.empty()) |
| 310 | { |
| 311 | throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No adapter name given. Aborting!"); |
| 312 | } |
| 313 | |
| 314 | // temporary folder for search in- und output files |
| 315 | bool keep_files = param_.getValue("keep_search_files").toBool(); |
| 316 | File::TempDir tmp_dir(keep_files); |
| 317 | String mzml_path = tmp_dir.getPath() + "spectra.mzML"; |
| 318 | String db_path = tmp_dir.getPath() + "database.FASTA"; |
| 319 | String out_path = tmp_dir.getPath() + "out.idXML"; |
| 320 | |
| 321 | // override the in- and output files in the parameters |
| 322 | if (!parameters.exists(adapter_name + ":1:in") || !parameters.exists(adapter_name + ":1:database") || !parameters.exists(adapter_name + ":1:out")) |
| 323 | { |
| 324 | throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "'in', 'out' or 'database' parameter not found! The search adapter is probably not supported anymore."); |
| 325 | } |
| 326 | parameters.setValue(adapter_name + ":1:in", mzml_path); |
| 327 | parameters.setValue(adapter_name + ":1:database", db_path); |
| 328 | parameters.setValue(adapter_name + ":1:out", out_path); |
| 329 | |
| 330 | // store data in temporary files |
| 331 | MzMLFile spectra_file; |
| 332 | spectra_file.store(mzml_path, exp); |
| 333 | FASTAFile database; |
| 334 | database.store(db_path, fasta_data); |
| 335 | |
| 336 | String ini_path = tmp_dir.getPath() + "parameters.INI"; |
| 337 | writeIniFile_(parameters, ini_path); |
| 338 | |
| 339 | // run identification search |
| 340 | String proc_stdout; |
| 341 | String proc_stderr; |
| 342 | auto lam_out = [&](const String& out) { proc_stdout += out; }; |
| 343 | auto lam_err = [&](const String& out) { proc_stderr += out; }; |
| 344 | |
| 345 | ExternalProcess ep(lam_out, lam_err); |
| 346 | OPENMS_LOG_DEBUG << "Running " << adapter_name << "..." << endl << endl; |
| 347 | const auto& rt = ep.run(adapter_name.toQString(), QStringList() << "-ini" << ini_path.toQString(), tmp_dir.getPath().toQString(), true); |
| 348 | if (rt != ExternalProcess::RETURNSTATE::SUCCESS) |
| 349 | { // error occured |
| 350 | OPENMS_LOG_ERROR << "An error occured while running " << adapter_name << "." << endl; |
| 351 | OPENMS_LOG_ERROR << "Standard output: " << proc_stdout << endl; |
| 352 | OPENMS_LOG_ERROR << "Standard error: " << proc_stderr << endl; |
| 353 | throw Exception::InternalToolError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Return state was: " + String(static_cast<Int>(rt))); |
| 354 | } |
| 355 | // search was successful |
| 356 | |
| 357 | // load result |
| 358 | vector<ProteinIdentification> prot_ids; |
| 359 | vector<PeptideIdentification> pep_ids; |
| 360 | IdXMLFile id_file; |
| 361 | id_file.load(out_path, prot_ids, pep_ids); |
| 362 | |
| 363 | // annotate target/decoy information |
| 364 | PeptideIndexing indexer; |
nothing calls this directly
no test coverage detected