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

Method cleanup

src/openms/source/METADATA/ID/IdentificationData.cpp:769–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767
768
769 void IdentificationData::cleanup(bool require_observation_match,
770 bool require_identified_sequence,
771 bool require_parent_match,
772 bool require_parent_group,
773 bool require_match_group)
774 {
775 // we expect that only "primary results" (stored in classes derived from
776 // "ScoredProcessingResult") will be directly removed (by filters) - not
777 // meta data (incl. score types, processing steps etc.)
778
779 // remove parent sequences based on parent groups:
780 if (require_parent_group)
781 {
782 parent_lookup_.clear(); // will become invalid anyway
783 for (const auto& groups: parent_groups_)
784 {
785 for (const auto& group : groups.groups)
786 {
787 for (const auto& ref : group.parent_refs)
788 {
789 parent_lookup_.insert(ref);
790 }
791 }
792 }
793 removeFromSetIfNotHashed_(parents_, parent_lookup_);
794 }
795 // update look-up table of parent sequence addresses (in case parent
796 // molecules were removed):
797 updateAddressLookup_(parents_, parent_lookup_);
798
799 // remove parent matches based on parent sequences:
800 ModifyMultiIndexRemoveParentMatches<IdentifiedPeptide>
801 pep_modifier(parent_lookup_);
802 for (auto it = identified_peptides_.begin();
803 it != identified_peptides_.end(); ++it)
804 {
805 identified_peptides_.modify(it, pep_modifier);
806 }
807 ModifyMultiIndexRemoveParentMatches<IdentifiedOligo>
808 oli_modifier(parent_lookup_);
809 for (auto it = identified_oligos_.begin();
810 it != identified_oligos_.end(); ++it)
811 {
812 identified_oligos_.modify(it, oli_modifier);
813 }
814
815 // remove identified molecules based on parent matches:
816 if (require_parent_match)
817 {
818 removeFromSetIf_(identified_peptides_, [](IdentifiedPeptides::iterator it)
819 {
820 return it->parent_matches.empty();
821 });
822 removeFromSetIf_(identified_oligos_, [](IdentifiedOligos::iterator it)
823 {
824 return it->parent_matches.empty();
825 });
826 }

Callers 2

postProcessHits_Method · 0.80
START_SECTIONFunction · 0.80

Calls 15

updateAddressLookup_Function · 0.85
removeFromSetIf_Function · 0.85
countMethod · 0.80
getMoleculeTypeMethod · 0.80
getIdentifiedOligoRefMethod · 0.80
clearMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

START_SECTIONFunction · 0.64