MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / CMMzTabStream

Method CMMzTabStream

src/openms/source/FORMAT/MzTab.cpp:2566–2885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2564
2565
2566 MzTab::CMMzTabStream::CMMzTabStream(
2567 const ConsensusMap& consensus_map,
2568 const String& filename,
2569 const bool first_run_inference_only,
2570 const bool export_unidentified_features,
2571 const bool export_unassigned_ids,
2572 const bool export_subfeatures,
2573 const bool export_empty_pep_ids,
2574 const bool export_all_psms,
2575 const String& title)
2576 :
2577 consensus_map_(consensus_map),
2578 filename_(filename),
2579 export_unidentified_features_(export_unidentified_features),
2580 export_subfeatures_(export_subfeatures),
2581 export_empty_pep_ids_(export_empty_pep_ids),
2582 export_all_psms_(export_all_psms)
2583 {
2584 // fill ID datastructure without copying
2585 const vector<ProteinIdentification>& prot_id = consensus_map.getProteinIdentifications();
2586 prot_ids_.reserve(prot_id.size());
2587 for (const auto & i : prot_id)
2588 {
2589 prot_ids_.push_back(&i);
2590 }
2591
2592 // extract mapped IDs
2593 for (Size i = 0; i < consensus_map.size(); ++i)
2594 {
2595 const ConsensusFeature& c = consensus_map[i];
2596 const vector<PeptideIdentification>& p = c.getPeptideIdentifications();
2597 peptide_ids_.reserve(peptide_ids_.size() + p.size());
2598 for (const PeptideIdentification& pi : p) { peptide_ids_.push_back(&pi); }
2599 }
2600
2601 // also export PSMs of unassigned peptide identifications
2602 if (export_unassigned_ids)
2603 {
2604 const vector<PeptideIdentification>& up = consensus_map.getUnassignedPeptideIdentifications();
2605 peptide_ids_.reserve(peptide_ids_.size() + up.size());
2606 for (const PeptideIdentification& pi : up) { peptide_ids_.push_back(&pi); }
2607 }
2608
2609 ////////////////////////////////////////////////
2610 // create some lookup structures and precalculate some values
2611 idrunid_2_idrunindex_ = MzTab::mapIDRunIdentifier2IDRunIndex_(prot_ids_);
2612
2613 bool has_inference_data = !prot_ids_.empty() && prot_ids_[0]->hasInferenceData();
2614
2615 first_run_inference_ = has_inference_data && first_run_inference_only;
2616 if (first_run_inference_)
2617 {
2618 OPENMS_LOG_INFO << "MzTab: Inference data provided. Considering first run only for inference data." << std::endl;
2619 }
2620
2621 map<String, size_t> msfilename_2_msrunindex;
2622 map<size_t, String> msrunindex_2_msfilename;
2623 MzTab::mapBetweenMSFileNameAndMSRunIndex_(prot_ids_, first_run_inference_, msfilename_2_msrunindex, msrunindex_2_msfilename);

Callers

nothing calls this directly

Calls 15

transformFunction · 0.85
hasInferenceDataMethod · 0.80
emplace_backMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
getNumberOfSamplesMethod · 0.80
getLabelAsUIntMethod · 0.80
StringClass · 0.50
swapFunction · 0.50
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected