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

Method checkPeptideIdentification_

src/topp/FileFilter.cpp:163–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161 }
162
163 static bool checkPeptideIdentification_(BaseFeature& feature,
164 const bool remove_annotated_features,
165 const bool remove_unannotated_features,
166 const StringList& sequences,
167 const String& sequence_comparison_method,
168 const StringList& accessions,
169 const bool keep_best_score_id,
170 const bool remove_clashes)
171 {
172 //flag: remove_annotated_features and non-empty peptideIdentifications
173 if (remove_annotated_features && !feature.getPeptideIdentifications().empty())
174 {
175 return false;
176 }
177 //flag: remove_unannotated_features and no peptideIdentifications
178 if (remove_unannotated_features && feature.getPeptideIdentifications().empty())
179 {
180 return false;
181 }
182 //flag: remove_clashes
183 if (remove_clashes && !feature.getPeptideIdentifications().empty())
184 {
185 String temp = feature.getPeptideIdentifications().begin()->getHits().begin()->getSequence().toString();
186 //loop over all peptideIdentifications
187 for (const PeptideIdentification& pep : feature.getPeptideIdentifications())
188 {
189 //loop over all peptideHits
190 for (const PeptideHit& pep_hit : pep.getHits())
191 {
192 if (pep_hit.getSequence().toString() != temp)
193 {
194 return false;
195 }
196 }
197 }
198 }
199 //flag: keep_best_score_id
200 if (keep_best_score_id && !feature.getPeptideIdentifications().empty())
201 {
202 PeptideIdentification temp = feature.getPeptideIdentifications().front();
203 //loop over all peptideIdentifications
204 for (const PeptideIdentification& pep : feature.getPeptideIdentifications())
205 {
206 //loop over all peptideHits
207 for (const PeptideHit& pep_hit : pep.getHits())
208 {
209 if ((pep.isHigherScoreBetter() && pep_hit.getScore() > temp.getHits().front().getScore()) ||
210 (!pep.isHigherScoreBetter() && pep_hit.getScore() < temp.getHits().front().getScore()))
211 {
212 temp = pep;
213 }
214 }
215 }
216 feature.setPeptideIdentifications(vector<PeptideIdentification>(1, temp));
217 // not filtering sequences or accessions
218 if (sequences.empty() && accessions.empty())
219 {
220 return true;

Callers

nothing calls this directly

Calls 11

getSequenceMethod · 0.80
frontMethod · 0.80
hasSubstringMethod · 0.80
emptyMethod · 0.45
toStringMethod · 0.45
beginMethod · 0.45
isHigherScoreBetterMethod · 0.45
getScoreMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected