| 295 | } |
| 296 | |
| 297 | void write_out_body_best_score(std::ostream &os, FeatureMap &feature_map, |
| 298 | TargetedExperiment &transition_exp, std::vector<String> &meta_value_names, |
| 299 | int run_id, bool short_format, String best_score, String filename) |
| 300 | { |
| 301 | |
| 302 | // for each peptide reference search for the best feature |
| 303 | typedef std::map<String, std::vector<Feature *> > PeptideFeatureMapType; |
| 304 | PeptideFeatureMapType peptide_feature_map; |
| 305 | for (Feature& feature : feature_map) |
| 306 | { |
| 307 | String peptide_ref = feature.getMetaValue("PeptideRef"); |
| 308 | peptide_feature_map[peptide_ref].push_back(&feature); |
| 309 | } |
| 310 | |
| 311 | for (PeptideFeatureMapType::iterator peptide_it = peptide_feature_map.begin(); peptide_it != peptide_feature_map.end(); ++peptide_it) |
| 312 | { |
| 313 | if (peptide_it->second.size() > 1) |
| 314 | { |
| 315 | //std::cout << "Warning " << peptide_it->first << " has " << peptide_it->second.size() << " features!" << std::endl; |
| 316 | // for (Size j =0; j<peptide_it->second.size(); j++) |
| 317 | // std::cout << *peptide_it->second.at(j) << std::endl; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | for (PeptideFeatureMapType::iterator peptide_it = peptide_feature_map.begin(); peptide_it != peptide_feature_map.end(); ++peptide_it) |
| 322 | { |
| 323 | Feature *bestfeature = find_best_feature(peptide_it->second, best_score); |
| 324 | if (bestfeature == nullptr) |
| 325 | { |
| 326 | throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Did not find best feature for peptide " + peptide_it->first); |
| 327 | } |
| 328 | write_out_body_(os, bestfeature, transition_exp, meta_value_names, run_id, short_format, feature_map.getIdentifier(), filename); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | |
| 333 | class TOPPOpenSwathFeatureXMLToTSV |
no test coverage detected