Skip to content

Commit

Permalink
Apply modifications mappings from large to small
Browse files Browse the repository at this point in the history
  • Loading branch information
pckroon committed Dec 10, 2024
1 parent cd98aef commit e4fe2f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vermouth/processors/do_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ def modification_matches(molecule, mappings):
matches = []
# Sort on the tuple[str] type names of the mappings so that mappings that
# define most modifications at the same time get processed first
for mod_name in sorted(needed_mod_mappings, key=len, reverse=True):
for mod_name in sorted(needed_mod_mappings,
key=lambda ms: (len(ms), len(known_mod_mappings[ms].block_from.nodes)),
reverse=True):
mod_mapping = known_mod_mappings[mod_name]
for mol_to_mod, modification, references in mod_mapping.map(molecule, node_match=ptm_resname_match):
matches.append((mol_to_mod, modification, references))
Expand Down

0 comments on commit e4fe2f3

Please sign in to comment.