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

Method returnResultsAndClear

src/openms/source/ANALYSIS/ID/IDMergerAlgorithm.cpp:98–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96 }
97
98 void IDMergerAlgorithm::returnResultsAndClear(
99 ProteinIdentification& prots,
100 vector<PeptideIdentification>& peps)
101 {
102 // convert the map from file origin to idx into
103 // a vector
104 StringList newOrigins(file_origin_to_idx_.size());
105 for (auto& entry : file_origin_to_idx_)
106 {
107 newOrigins[entry.second] = entry.first;
108 }
109 // currently setPrimaryMSRunPath does not support move (const ref)
110 prot_result_.setPrimaryMSRunPath(newOrigins);
111 std::swap(prots, prot_result_);
112 std::swap(peps, pep_result_);
113 //reset so the new this class is reuseable
114 prot_result_ = ProteinIdentification{};
115 prot_result_.setIdentifier(getNewIdentifier_());
116 //clear, if user gave non-empty vector
117 pep_result_.clear();
118 //reset internals
119 file_origin_to_idx_.clear();
120
121 for (auto& p : collected_protein_hits_)
122 prots.getHits().push_back(std::move(const_cast<ProteinHit&>(p)));
123 // above invalidates set but we clear right after
124
125 collected_protein_hits_.clear();
126 }
127
128 String IDMergerAlgorithm::getNewIdentifier_() const
129 {

Callers 4

main_Method · 0.80
main_Method · 0.80
main_Method · 0.80
START_SECTIONFunction · 0.80

Calls 6

swapFunction · 0.50
sizeMethod · 0.45
setPrimaryMSRunPathMethod · 0.45
setIdentifierMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by 1

START_SECTIONFunction · 0.64