Giter Site home page Giter Site logo

gheinzelmann / bat.py Goto Github PK

View Code? Open in Web Editor NEW
154.0 154.0 41.0 7.44 MB

The Binding Affinity Tool (BAT.py) is a fully automated tool for absolute binding free energy calculations on protein-ligand systems, compatible with the AMBER and OpenMM simulation packages.

License: MIT License

Python 96.58% Tcl 0.92% C 0.96% Shell 1.54%

bat.py's People

Contributors

fengmudong avatar gheinzelmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bat.py's Issues

Update for use with AMBER20

Restraints need to be applied to both molecules during electrostatic annihilation with AMBER20, to eliminate lambda dependent restraint contribution to dvdl.

Python 3

Make BAT.py compatible with python 3

kinase acetonitrile system

Thanks I will need some guidance to set up the APR method on my kinase ligand system and I will provide details in a few minutes. Any help will be deeply appreciated @GHeinzelmann.
Regards

Remove hydrogens

Check for removal of hydrogens when using babel on crystal structure

Charged ligands

New approach needed to deal with charged ligands when DD is performed, due to artifacts caused by artificially setting the box potential at 0 for all lambda windows (gellium).

Chosen solution is to perform binding site (bound) and bulk (unbound) charging and discharging of the ligand simultaneously in the same box, keeping the overall charge of the box constant at zero.

Constraints.in file was missing

First of all, thanks for providing such convenient scripts for FE calculation.

Right now, I repeated the test calculation of BRD4 examples, with all default settings.
I have successfully run the equal and fe calculations for pose0.
Then I ran the python BAT.py -i input-dd.sh -s analysis, there is an error message.
It located the place, in BAT/libanalysis.py, line 56.
The restraints.dat file, which should be generated by cpptraj -I restraints.in command.
But I could not find the restraints.in file.

I use Centos 7.6, the default python2.7.5, amber20 and the new BAT2.0 for the calculation.
I use the GPU2080TI card with coda-11.1.

Thanks very much for your help.

suggestion: remove CONECT lines from protonated ligand files

Hi

I have encountered the same issue as previously posted (eg #31 and #30 amongst others).

LEaP fails because the aromatic carbons are identified in the mol2 as c3 atoms (aliphatic). This happens due to incorrect CONECT lines in the protonated lig-h.pdb:

...
CONECT    7    5    8    8                                            
CONECT    8    1    7    7    9                                       
CONECT    9    8   10   10   14                                       
**CONECT   10    9    9   11   21**                                       
CONECT   11   10   12   12   22                                       
CONECT   12   11   11   13   23                                       
CONECT   13   12   14   14   24                                       
CONECT   14    9   13   13   25                                       
CONECT   15    1   16   26                 
...

I have in general had better experience running antechamber when the protonated pdb consists only of ATOM lines. If i remove all of these CONECTlines and run antechamber manually, C9 has an aromatic atom type of ca.

Kind regards

Charles-Alexandre

some errors

Thank you for making a very interesting program. I immediately ran a follow-up test of the program. However, there was a problem that "l00 to l08" and "t00 to t08" did not work when FE calculations were performed. If possible, please post the results of your calculations using the sample files on github.ใ€€

OpenBabel 3.0

Check for OpenBabel 3.0 compatibility, possible problems with protonation.

Free energy calculation file not found.

Hi,

I am working through the example you give. I have set up the environment with all the required dependencies and have been able to successfully run the first command i.e. python3 BAT.py -i input-dd.in -s equil

However, when running the second command, python3 BAT.py -i input-dd.in -s fe I get the following error.

python3 BAT.py -i input-dd.in -s fe
Setting up pose0
window: c00 weight: 0.0
Traceback (most recent call last):
  File "BAT.py", line 501, in <module>
    anch = build.build_rest(hmr, mol, pose, comp, win, ntpr, ntwr, ntwe, ntwx, cut, gamma_ln, barostat, receptor_ff, ligand_ff, dt, fwin, l1_x, l1_y, l1_z, l1_range, min_adis, max_adis, sdr_dist, ion_def)
  File "/data/gpfs/projects/punim1165/bobbie/bat/BAT/lib/build.py", line 517, in build_rest
    shutil.copy('../../build_files/%s.pdb' %mol.lower(), './')
  File "/home/bobbieshaban/.conda/envs/bat/lib/python3.8/shutil.py", line 418, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/bobbieshaban/.conda/envs/bat/lib/python3.8/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '../../build_files/lig.pdb'

Can I please get some guidance on what I am doing wrong? It seems to have problems finding the ligand pdb file, but I am running it the same directory as the previous command. Thank you!

Question on correct behaviour for the ligand only phase.

Hi there!

I am modifying parts of this code for some specific runs and was just wondering as to the behaviour of specific parts with respect to the ligand only phases. I am just clarafying this as I wasn't certain after reading the corresponding paper and guide.

  1. Are the ligand-only conformational dihedral restraints left on during the decoupling ligand-only phase in bulk solution, and the cost of these restraints calculated in a separate set of runs with the ligand fully coupled?
  2. And if one is certain of a specific binding pose of a given ligand, do you think it would be viable to engage the ligand dihedral conformational as well as the translational restraints (the boresch type restraints) in a single set of simulations?

Thanks for your time!

Suggestion: SLURM support?

PBS is supported, so maybe some template scripts for the SLURM scheduler could be added. Like how PBS is set up, we would have individual scripts for each portion of the calculation (quil, rest, fe, etc.) and a user could manually (or automatically, using a custom script) execute each of those scripts to launch a SLURM job across their cluster. I think if SLURM support were added, the BAT.py/BAT/run_files/ folder would need to be organized better like into folders based on portion of calculation or job scheduler. It's getting a little crowded in there. I'd like to have some SLURM scripts for running BAT.py on the cluster2.mccammon.ucsd.edu, but since that cluster has some special SLURM quirks I thought it might be a better use of time to write general SLURM scripts, share them either in the repo or in the comments here, and then adapt them for my personal needs later.

Anyway, is this a good idea? Is it a useful and straightforward addition? Let me know.

Max. 500 TI atoms

Maximum number of TI atoms was increased to 500 atoms in AMBER20, or a maximum of 125 atoms per ligand when using SDR. Test changing MaxNumberTIAtom and MaxNumberTIPair variables in the amber20_src/src/pmemd/src/cuda/gti_simulationConst.h file, and recompiling pmemd.cuda.. Further tests are still needed.

Note: The following floating-point exceptions are signaling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

Dear Gheinzelmann,

Thanks for providing such convenient scripts

Recently I was practicing the tutorial and using run-local.bash in equil folder, it shows "Note: The following floating-point exceptions are signaling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL". But the program can continue running, should I be really careful about this issue or just ignore it

Hope to receive your reply soon

Regards,
Andy

Openmm version

Hello--I see a .in file referencing openMM as the engine, but can't run the equil step with that input (looks like a teLeap error?). Are there examples or steps I can follow to use openmm?

Example Crashes

Hello,

I am trying to run the example for the 2.1 release using Amber20 and am getting a crash.

$AMBERHOME/bin/amber.python BAT.py -i input-dd.in -s equil

Traceback (most recent call last):
  File "/data/BAT.py-2.1/BAT/BAT.py", line 581, in <module>
    build.create_box(comp, hmr, pose, mol, num_waters, water_model, ion_def, neut, buffer_x, buffer_y, buffer_z, stage, ntpr, ntwr, ntwe, ntwx, cut, gamma_ln, barostat, receptor_ff, ligand_ff, dt, dec_method)
  File "/data/BAT.py-2.1/BAT/lib/build.py", line 1120, in create_box
    box_volume = scripts.box_volume()
  File "/data/BAT.py-2.1/BAT/lib/scripts.py", line 81, in box_volume
    box_volume=float(ratio * x_axis * y_axis * z_axis)
UnboundLocalError: local variable 'ratio' referenced before assignment

This is caused by this error:

/amber/bin/teLeap: Fatal Error!

Atom .R<LIG 1>.A<C9 13> has force field coordination 4
       but only 3 bonded neighbors.
       The cause may be an incorrect atom type, and
       the effect may be a crash very soon (if running interactively).

Protein and ligand protonation

Look into pdb4amber histidine issue, and possible inconsistencies between poses for babel protonation (probably due to different docked ligand angles)

Free energy calculation step not finding files from equilibration step

I'm trying to run the example calculation (I haven't changed input-dd.in). The equilibration step python BAT.py -i input-dd.in -s equil appeared to run successfully -- I've attached the full output below.

equil.txt

However, when I run the free energy step python BAT.py -i input-dd.in -s fe, I get the following error:

lambda values: [0.025446043828620757, 0.12923440720030277, 0.2970774243113014, 0.5, 0.7029225756886985, 0.8707655927996972, 0.9745539561713792]
Gaussian weights: [0.06474248308443532, 0.1398526957446383, 0.19091502525255916, 0.20897959183673448, 0.19091502525255916, 0.1398526957446383, 0.06474248308443532]
Setting up pose0
window: c00 weight: 0.0
Traceback (most recent call last):
  File "[...]/BAT/BAT.py", line 720, in <module>
    anch = build.build_dec(fwin, hmr, mol, pose, comp, win, water_model, ntpr, ntwr, ntwe, ntwx, cut, gamma_ln, barostat, receptor_ff, ligand_ff, dt, sdr_dist, dec_method, l1_x, l1_y, l1_z, l1_range, min_adis, max_adis, ion_def, other_mol, solv_shell)
  File "/home/boris/Repos/BAT.py/BAT/lib/build.py", line 440, in build_dec
    shutil.copy('../../../equil/'+pose+'/md%02d.rst7' %fwin, './')
  File "[...]/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "[...]/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '../../../equil/pose0/md08.rst7'

Any idea what's going on here? Thanks for your help!

Input files preparation

Hi,
I previously always used Schrodinger's Maestro as docking engine. Do we have to use Autodock workflow to prepare input files for BAT.py ? If not, how should I modify the files I obtained from other docking engines?

If only Autodock is supported, then I must install all 3 or 4 more packages, like chimera and Mgltools etc. Could anyone possibly share the detailed way to install those packages? I have tried but failed due to the python version being incompatible etc (The link attached in BAT.py readme, which introduces how to use CELPPade seems to have some out-of-date link there, I can't repeat that workflow). I know it sounds simple, but we all understand it is those little bugs that stop us most of the time.

In return, I might be able to share a complete Colab version of BAT, from beginning to end, using Google's free GPU, to allow those who do not have access to a computer cluster or supercomputer, can also run BAT.py. But help me first, please!

Cheers

Q

File missing - Get last state from equilibrium simulations

I encountered this problem during fe stage of the example when the program tried to copy the file '../../../equil/pose0/md08.rst7' to the folder 'fe'. When I check the folder equil/pose0 there is no file named with this format.
So, when was that (those) file created, did I miss any step?

Necessary requirements for usage

Hello,

thanks for uploading the tool.
I haven't tested it yet but I was wondering if it is required to have VMD and LovoAlign installed or if it accessory.
The same would be for Amber since you have implemented openmm, would it require to have AmberTools installed?

Many thanks

Missing build_files/lig.pdb error when running OpenMM FE simulation with default config

Dear @GHeinzelmann - thank you for sharing this ABFE code. I am currently learning more about ABFE methods and decided to try the BAT.py suite this long weekend.

After installing OpenMM and all other required dependencies I started equilibrating pose0 from the default example specified in input-sdr-openmm.in. This process ran without an issue and I performed local OpenMM simulations on an RTX4090 within a couple minutes of all 9 segments.
In the next step, the fe simulation, I am running into the following issue:

(abfe) root@bd6f9c20ec44:/BAT.py/BAT# python BAT.py -i input-sdr-openmm.in -s fe
lambda values: [0.009219682876640378, 0.0479413718147626, 0.11504866290284765, 0.20634102285669126, 0.31608425050090994, 0.43738329574426554, 0.5626167042557344, 0.6839157494990901, 0.7936589771433087, 0.8849513370971523, 0.9520586281852375, 0.9907803171233596]
Gaussian weights: [0.02358766819325601, 0.05346966299765944, 0.08003916427167306, 0.10158371336153282, 0.11674626826917732, 0.12457352290670134, 0.12457352290670134, 0.11674626826917732, 0.10158371336153282, 0.08003916427167306, 0.05346966299765944, 0.02358766819325601]
['m', 'n', 'e', 'v']
sdr
[0.0, 0.1, 0.24, 0.56, 1.33, 3.16, 7.5, 17.78, 42.17, 100.0]
[0.009219682876640378, 0.0479413718147626, 0.11504866290284765, 0.20634102285669126, 0.31608425050090994, 0.43738329574426554, 0.5626167042557344, 0.6839157494990901, 0.7936589771433087, 0.8849513370971523, 0.9520586281852375, 0.9907803171233596]
4.0
0.9
Error: 'md08.dcd': No such file or directory
Error: Could not set up input trajectory 'md08.dcd'.
        1 errors encountered reading input.
Error: Error(s) occurred during execution.
Error: 'md08.dcd': No such file or directory
Error: Could not set up input trajectory 'md08.dcd'.
        1 errors encountered reading input.
Error: Error(s) occurred during execution.
Error: 'md08.dcd': No such file or directory
Error: Could not set up input trajectory 'md08.dcd'.
        1 errors encountered reading input.
Error: Error(s) occurred during execution.
Error: 'md08.dcd': No such file or directory
Error: Could not set up input trajectory 'md08.dcd'.
        1 errors encountered reading input.
Error: Error(s) occurred during execution.
Setting up pose0
window: t00 weight: 100.0
Traceback (most recent call last):
  File "BAT.py", line 840, in <module>
    anch = build.build_dec(fwin, hmr, mol, pose, comp, win, water_model, ntpr, ntwr, ntwe, ntwx, cut, gamma_ln, barostat, receptor_ff, ligand_ff, dt, sdr_dist, dec_method, l1_x, l1_y, l1_z, l1_range, min_adis, max_adis, ion_def, other_mol, solv_shell)
  File "/BAT.py/BAT/lib/build.py", line 627, in build_dec
    shutil.copy('../../build_files/%s.pdb' %mol.lower(), './')
  File "/root/miniforge3/envs/abfe/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/root/miniforge3/envs/abfe/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '../../build_files/lig.pdb'

The first issue is an Error re: a missing md08.dcd files. I am running this script from the BAT subdirectory. The trajectories of the equilibrated complexes are located in equal/pose0. I double checked that all dcd files for the 9 components are there. I also moved the dcd files into /BAT2.py/BAT in order to be extra sure that there is not a path issue.

The second issue is a missing lig.pdb file in the build_files directory. When checking the github repo, I could not find such a file and I did not find a related line in the BAT2 input configuration file.

Is this an error something you have seen before with OpenMM in BAT2? I am happy to share a docker image to more easily reproduce the issue if that is helpful.

Thank you!

Possible unreferenced variable

When running box_volume(), I ran into trouble where apparently there was no "Density" anywhere in tmp.log, meaning the variable ratio went unassigned and threw an UnboundLocalError. Maybe ratio should have a default value (of 1)? Or perhaps there should never arise a situation where tmp.log doesn't have a "Density"-containing line, and my program is broken in some way...

def box_volume():
p = sp.call('tleap -s -f tmp_tleap.in > tmp.log', shell=True)
# Get box volume and adjust it to system density after equilibration
num_added = None
dens = 1.00 # Final estimated density of the equilibrated system (close to 1)
f = open('tmp.log', 'r')
for line in f:
if "Total vdw box size" in line:
splitdata = line.split()
x_axis = float(splitdata[4])
y_axis = float(splitdata[5])
z_axis = float(splitdata[6])
if "Density" in line:
splitdata = line.split()
ratio = float(float(splitdata[5])/dens)
f.close()
box_volume=float(ratio * x_axis * y_axis * z_axis)
return box_volume

UnboundLocalError: cannot access local variable 'ratio' where it is not associated with a value

After executing

python3 BAT.py -i input-dd.in -s equil

it shows following error

Traceback (most recent call last):
  File "/home/administrator/Documents/BAT_ABFEP/BAT/BAT.py", line 594, in <module>
    build.create_box(comp, hmr, pose, mol, num_waters, water_model, ion_def, neut, buffer_x, buffer_y, buffer_z, stage, ntpr, ntwr, ntwe, ntwx, cut, gamma_ln, barostat, receptor_ff, ligand_ff, dt, dec_method, other_mol)
  File "/home/administrator/Documents/BAT_ABFEP/BAT/lib/build.py", line 1109, in create_box
    box_volume = scripts.box_volume()
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/Documents/BAT_ABFEP/BAT/lib/scripts.py", line 85, in box_volume
    box_volume=float(ratio * x_axis * y_axis * z_axis)
                     ^^^^^
UnboundLocalError: cannot access local variable 'ratio' where it is not associated with a value

License missing

Very interesting script, will definitely give it a try.
However, you have not specified a LICENSE so technically I cannot use it.

Maybe give https://choosealicense.com/ a try (MIT could be an option).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.