From: Josh Vermaas (joshua.vermaas_at_gmail.com)
Date: Fri Nov 06 2020 - 20:10:53 CST

HI Jeff,

My intent was for you to adapt it to your needs, since the script I sent
was initially written to parse AutoDock-GPU output for my own research
needs, and other than the general functions towards the top, the script as
written probably doesn't do what you want it to, since it makes some
assumptions about where the files are located. The script does use python
integration that I have from compiling VMD myself (it is not part of the
standard binaries UIUC distributes. For the lay person, the easiest way to
get VMD into a module is probably to install from
https://github.com/Eigenstate/vmd-python), but at least for parsing dlg
files, it doesn't use anything fancier than standard UNIX command line
tools. That means it should be pretty straightforward to take the pieces
you need to at least convert the dlgs to pdb for visualization purposes,
and to extract the energies from the dlg and put it into a text file or
numpy array for further analysis.

-Josh

On Fri, Nov 6, 2020 at 12:04 PM Jeff Saxon <jmsstarlight_at_gmail.com> wrote:

> Hey Josh,
> I have a question regarding your py script that you shared on VMD mail
> list yesterday.
> Could you tell me whether I need to execute it inside VMD or otherwise
> to export some python modules of VMD into my python?
> Actually previously I used TCL scripting for VMD but did not know that
> it had a python interface too.
> import vmdnumpy as vnp
> from Molecule import *
> from atomsel import *
> ?
> Eventually this script allows to combine several DLG and then
> recluster ligand conformations based on the rmsd, doesn't it? I've
> just double checked end found that I am also dealing with
> autodock-gpu, so formally your script should match my DLGs...
> Cheers,
> Jeff
>
> чт, 5 нояб. 2020 г. в 21:24, Josh Vermaas <joshua.vermaas_at_gmail.com>:
> >
> > Hi Jeff,
> >
> > While there isn't a plugin, it is pretty straightforward to convert a
> DLG file to a multiframe pdb file. This is a script I put together to do
> some analysis, and is written in python to interpret AutoDock-GPU outputs
> (which match AutoDock's as far as I can tell). The key function for you in
> this case would be dlg_to_multiframepdb.
> >
> > -Josh
> >
> > import glob
> > import os
> > import subprocess
> > import numpy as np
> > import vmdnumpy as vnp
> > from Molecule import *
> > from atomsel import *
> > def dlg_to_multiframepdb(fname):
> > inputstrings = subprocess.check_output("grep \"DOCKED:\" %s" %
> fname, shell=True).split("\n")
> > output = ""
> > for s in inputstrings:
> > if s[8:12] == "ATOM" or s[8:12] == "HETA":
> > output += s[8:] + "\n"
> > elif s[8:14] == "ENDMDL":
> > output += "ENDMDL\n"
> > return output
> > def dlg_to_energy(fname):
> > inputstrings = subprocess.check_output("grep \"Estimated\" %s |
> sed 's/=//g' | awk '{print $8}'" % fname, shell=True).split("\n")[:-1]
> > energies = np.array(inputstrings).astype(np.float)
> > return energies
> > def pdbqt_to_pdb(fname):
> > inputstrings = subprocess.check_output("cat %s" % fname,
> shell=True).split("\n")
> > output = ""
> > for s in inputstrings:
> > if s[:4] == "ATOM" or s[:4] == "HETA":
> > output += s + "\n"
> > elif s[:6] == "ENDMDL":
> > output += "ENDMDL\n"
> > return output
> >
> > os.chdir("data")
> > dirlist = glob.glob("*/")
> > print dirlist
> > results = np.empty((len(dirlist), 4, 3), dtype=np.float)
> > for i, d in enumerate(dirlist):
> > fout = open(d+"xray.pdb", "w")
> > fout.write(pdbqt_to_pdb(d+"flex-xray.pdbqt"))
> > fout.close()
> > ref = Molecule()
> > ref.load(d+"xray.pdb")
> > refsel = atomsel("all")
> > for j, dlgtype in enumerate(['CUDAout', 'CUDAout10',
> 'OpenCLout', 'OpenCLout10']):
> > for k in range(3):
> > dlgfile = d + dlgtype + "-%d.dlg" % k
> > energies = dlg_to_energy(dlgfile)
> > fout = open(d+dlgtype+"-%d.pdb" % k, "w")
> > fout.write(dlg_to_multiframepdb(dlgfile))
> > fout.close()
> > mol = Molecule()
> > mol.load(d+dlgtype+"-%d.pdb" % k)
> > sel = atomsel("all", frame=np.argmin(energies))
> > print d, sel.rmsd(refsel)
> > results[i][j][k] = sel.rmsd(refsel)
> > print results
> > np.savez("../dockedrmsds.npz", cuda10=results[:,1,:].flatten(),
> cuda100=results[:,0,:].flatten(), opencl10=results[:,3,:].flatten(),
> opencl100=results[:,2,:].flatten())
> > exit()
> >
> > On Thu, Nov 5, 2020 at 10:14 AM John Stone <johns_at_ks.uiuc.edu> wrote:
> >>
> >> Hi,
> >> There isn't an existing DLG plugin for VMD, but this seems like
> >> it would be a great thing for someone to write. The AutoDock
> >> pages suggest using "ADT" (autodock tools) to work with these files.
> >> That being said, if you are willing to share complete example file
> >> sets for one of your autodock runs, I would love to collect those
> >> with the hope that we would be able to find someone to look into
> >> developing such a plugin down the road.
> >>
> >> Best regards,
> >> John Stone
> >> vmd_at_ks.uiuc.edu
> >>
> >> On Thu, Nov 05, 2020 at 05:45:19PM +0100, Jeff Saxon wrote:
> >> > Dear VMD users!
> >> > Could you tell me whether there is some vmd's plugin that allows me to
> >> > read directly DLG filles (produced by autodock) and make some basic
> >> > operations on the conformational ensembles of the ligand?
> >> > I've tried to load directly DLG files from terminal command line
> >> > vmd *.dlg
> >> > but it recognized it as an attempt to load PDB files and eventually
> did nothing.
> >> >
> >> > Thank you for your help
> >> > J.
> >>
> >> --
> >> NIH Center for Macromolecular Modeling and Bioinformatics
> >> Beckman Institute for Advanced Science and Technology
> >> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> >> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> >> http://www.ks.uiuc.edu/Research/vmd/
> >>
>