| 375 | } |
| 376 | |
| 377 | ExitCodes main_(int, const char **) override |
| 378 | { |
| 379 | StringList file_list = getStringList_("in"); |
| 380 | String tr_file = getStringOption_("tr"); |
| 381 | String out = getStringOption_("out"); |
| 382 | //String main_var_name = getStringOption_("main_var_name"); |
| 383 | String best_scoring = getStringOption_("best_scoring_peptide"); |
| 384 | bool short_format = getFlag_("short_format"); |
| 385 | |
| 386 | setLogType(log_type_); |
| 387 | |
| 388 | TargetedExperiment transition_exp; |
| 389 | TraMLFile().load(tr_file, transition_exp); |
| 390 | |
| 391 | startProgress(0, transition_exp.getTransitions().size(), "indexing transitions peaks"); |
| 392 | for (Size i = 0; i < transition_exp.getTransitions().size(); i++) |
| 393 | { |
| 394 | setProgress(i); |
| 395 | const ReactionMonitoringTransition *transition = &transition_exp.getTransitions()[i]; |
| 396 | |
| 397 | { |
| 398 | peptide_transition_map[transition->getPeptideRef()].push_back(&transition_exp.getTransitions()[i]); |
| 399 | } |
| 400 | } |
| 401 | endProgress(); |
| 402 | |
| 403 | std::ofstream os(out.c_str()); |
| 404 | //set high precision for writing of floating point numbers |
| 405 | os.precision(writtenDigits(double())); |
| 406 | if (!os) |
| 407 | { |
| 408 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, out); |
| 409 | } |
| 410 | |
| 411 | // write the csv header (we need to know which parameters are in the map to do that) |
| 412 | if (file_list.empty()) |
| 413 | { |
| 414 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No input files given "); |
| 415 | } |
| 416 | FeatureMap feature_map; |
| 417 | FeatureXMLFile feature_file; |
| 418 | feature_file.setLogType(log_type_); |
| 419 | // feature_file.load() resets the locale to the user's (Don't know where, maybe QT or Xerces) |
| 420 | // Somehow even our variable OpenMS::Internal::OpenMS_locale is overwritten |
| 421 | // Create copy here and reset it later. TODO this needs to be fixed more thouroughly. |
| 422 | String locale_before = String(OpenMS::Internal::OpenMS_locale); |
| 423 | feature_file.load(file_list[0], feature_map); |
| 424 | setlocale(LC_ALL, locale_before.c_str()); |
| 425 | if (feature_map.getIdentifier().empty()) |
| 426 | { |
| 427 | feature_map.setIdentifier("run0"); |
| 428 | } |
| 429 | std::vector<String> meta_value_names; |
| 430 | |
| 431 | if (feature_map.empty() && file_list.size() > 1) |
| 432 | { |
| 433 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Feature map " + file_list[0] + " is empty."); |
| 434 | } |
nothing calls this directly
no test coverage detected