michellab / BioSimSpace

Code and resources for the EPSRC BioSimSpace project.
https://biosimspace.org
GNU General Public License v3.0
77 stars 19 forks source link

[TUTORIAL] FEP with perturbation network #193

Open lohedges opened 3 years ago

lohedges commented 3 years ago

This is a thread to discuss the creation of a tutorial showing how to implement free-energy perturbation using a network, e.g. generated by LOMAP, within BioSimSpace.

JenkeScheen commented 3 years ago

Linking this thread with my working repo.

ppxasjsm commented 3 years ago

I have done some work around this a while ago. Do you intend to submit this for a live comms tutorial paper as well as a general use tutorial? I can dig out the stuff I have done for this already if helpful.

jmichel80 commented 3 years ago

Hi @ppxasjsm yes it would be great if you can help. It would be good to update https://github.com/michellab/freenrgworkflows . I would like to implement an alternative free energy estimation method that avoids the reference compound dependency on final relative free energies. I'm thinking to adopt the Weighted least squares approach used by Mark at Cresset.

JenkeScheen commented 3 years ago

Hi @ppxasjsm if you've done any work on LOMAP network generation to show within a notebook that would be very helpful! It's starting to look like the LOMAP build I currently have is unable to draw a decent-looking network to show in an ipynb.

see https://github.com/michellab/bss_fep_advanced_tut_bg/blob/main/fep_workflow_ros1.ipynb for the default graph (uses pygraphviz)

ppxasjsm commented 3 years ago

Yes happy to help with this! It’s been on my would like to do list for ages!

JenkeScheen commented 3 years ago

I'm just going to build a networkx function that takes the edges text file written by LOMAP and creates a simple neato graph while loading molecule images and LOMAP scores to display on edges.. @ppxasjsm if you have code that does something similar I'd be happy to work from there

ppxasjsm commented 3 years ago

That is a one liner in networkx though right?

JenkeScheen commented 3 years ago

the graph generation yes, getting to the line requires some more work (rdkit to load molecules, draw images correctly + save, etc)

jmichel80 commented 3 years ago

Adding current diagram summarising use case (for binding)

fep_01-white

And for hydration

fep_02-white

JenkeScheen commented 3 years ago

update: I've now pushed a working notebook that runs LOMAP on a set of ligands, then uses networkx to plot LOMAP's output and finally uses BSS to setup SOMD folders according to the transformations that LOMAP suggests. Note that the network plotting function still needs some condensation + tests!

It was a bit painful to get LOMAP and networkx to work mostly because of versioning. Feel free to use the env.yml to spare yourself to trouble if you're trying to reproduce the outputs. The LOMAP scripts can be found in ./lomap/and will need to be used in the tutorial environment because it contains a few hacks in graphgen.py. lomap_networkgen.py is run as bash command in the notebook.

Next would be using freenrgworkflows to get dGbind barplots with an optinal weighted least squares method. @jmichel80 @lohedges would this implementation be useful to have before our next meeting, or do we have enough to discuss for the time being?

jmichel80 commented 3 years ago

Hi @JenkeScheen great progress ! For the FEP analysis stage can you put together a notebook using current functionality in freenrgworkflows ? We will revisit later the exact approach used to estimate free energies once the code is in place.

JenkeScheen commented 3 years ago

I have now added a draft slurm submission script (of course the BSS functionality of loading a SOMD environment still has to be added for this) the main setup notebook as well as the command to run freenrgworkflows on the output. I decided to adjust the freenrgworkflows-generated notebook a bit so that the user has a bit more freedom in the plotting which in the end is just basic python.

At some point we'll have to decide on how we want to do make the analysis notebook connect to simulation outputs (i.e. could do the ipynb generator that @ppxasjsm has used, or could just work with a template notebook where users adjust paths)

JenkeScheen commented 3 years ago

note that this workflow doesn't have .Solvation() steps yet but that should be easy to implement at a later stage; the only bottleneck there is deciding on how we can make vacuum jobs run on CPU (if that is something we want)