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

Method inferFromPeptides

src/openms/source/CHEMISTRY/ModificationDefinitionsSet.cpp:337–382  ·  view source on GitHub ↗

@TODO: should this function handle "max_mods_per_peptide_" as well?

Source from the content-addressed store, hash-verified

335
336 // @TODO: should this function handle "max_mods_per_peptide_" as well?
337 void ModificationDefinitionsSet::inferFromPeptides(const vector<PeptideIdentification>& peptides)
338 {
339 // amino acid (or terminus) -> set of modifications (incl. no mod. = 0):
340 map<String, set<const ResidueModification*> > mod_map;
341
342 for (const PeptideIdentification& pep : peptides)
343 {
344 for (const PeptideHit& hit : pep.getHits())
345 {
346 const AASequence& seq = hit.getSequence();
347 mod_map["N-term"].insert(seq.getNTerminalModification());
348 mod_map["C-term"].insert(seq.getCTerminalModification());
349 for (AASequence::ConstIterator seq_it = seq.begin();
350 seq_it != seq.end(); ++seq_it)
351 {
352 mod_map[seq_it->getOneLetterCode()].insert(seq_it->getModification());
353 }
354 }
355 }
356
357 fixed_mods_.clear();
358 variable_mods_.clear();
359 for (map<String, set<const ResidueModification*> >::const_iterator map_it =
360 mod_map.begin(); map_it != mod_map.end(); ++map_it)
361 {
362 set<const ResidueModification*>::const_iterator set_it =
363 map_it->second.begin();
364 // if there's only one mod, it's probably a fixed one:
365 if ((map_it->second.size() == 1) && (*set_it != 0))
366 {
367 ModificationDefinition mod_def(**set_it, true);
368 fixed_mods_.insert(mod_def);
369 }
370 else // variable mod(s)
371 {
372 for (; set_it != map_it->second.end(); ++set_it)
373 {
374 if (*set_it != 0)
375 {
376 ModificationDefinition mod_def(**set_it, false);
377 variable_mods_.insert(mod_def);
378 }
379 }
380 }
381 }
382 }
383
384
385} // namespace OpenMS

Callers 3

loadMethod · 0.80
writeToMethod · 0.80

Calls 9

getSequenceMethod · 0.80
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getModificationMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected