marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
84 stars 37 forks source link

Raise warning if mutation not found #553

Closed csbrasnett closed 2 weeks ago

csbrasnett commented 8 months ago

At the moment, if a -mutate flag is given, but the target residue is not found, then martinize will process the input structure as given without raising a warning.

Eg, taking the martinize tutorial:

martinize2 -f 181L_clean.pdb -o t4l_only.top -x t4l_cg.pdb -dssp /usr/bin/dssp -p backbone -ff martini3001 -mutate A-MET1:LYS

will correctly mutate the first residue from MET to LYS, but

martinize2 -f 181L_clean.pdb -o t4l_only.top -x t4l_cg.pdb -dssp /usr/bin/dssp -p backbone -ff martini3001 -mutate A-MET2:LYS

will do nothing (ie. keep residue 1, 2 as MET, ASN as in the input structure). If a user is expecting the mutation (eg the above could easily be a typo) and uses the topology naively (even though they should really check...) then that's a problem.

It's probably about time I put in a PR here, so I can try and do something about it this week, just thought I'd open the issue first, or in case I don't get to it as soon as I'd like.

vermouth 0.9.6

pckroon commented 8 months ago

I think this would be a great first PR :) The best place is probably in vermouth/processors/annotate_mut_mod.py. Beyond that, good luck, have fun, and feel free to ask for help/advice/whatever!

csbrasnett commented 7 months ago

@pckroon Noticed one minor issue with how this was fixed. In the case where we have >1 chain in the protein, the mutation is looked for across all chains and raises a warning for each of the chains where the mutation isn't found. Then nothing is written, even though the mutation has been specified correctly. I'll come up with a fix asap...

pckroon commented 7 months ago

Good find. I don't think the issue is chains per se, but rather molecules, since the AnnotateMutMod processor has a run_molecule method rather than a run_system method.

csbrasnett commented 7 months ago

Thanks, not sure I have time to address this week but I'll try to start next. It would be good to try and address #512 at the same time, but I'm less sure about where to start on that one.

pckroon commented 7 months ago

Don't. That will be a separate PR for sure, because #512, #17, #307 is a huge feature. The open choice is whether you want to rebuild coordinates/atoms at the atomistic level or the CG level. Once you can do that for mutated residues (#512) you can do it for any atom without coordinates in the input (#17)

csbrasnett commented 7 months ago

ha, understood! I'll address this soon then, and maybe we could work something out for the rebuilding issue in the new year?

pckroon commented 7 months ago

IMNSHO the rebuilding is one of the biggest missing features we have, so yes please!

csbrasnett commented 7 months ago

sweet, I'll drop you a message then

csbrasnett commented 3 weeks ago

Going to have to reopen this again, I think there's some error being picked up when chains are merged, but I haven't traced it fully yet