Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load maps for vina #31

Closed
linfranksong opened this issue Aug 25, 2021 · 13 comments
Closed

Load maps for vina #31

linfranksong opened this issue Aug 25, 2021 · 13 comments

Comments

@linfranksong
Copy link

Hi,

I'm trying to load existing maps for vina and only score the pose with the following code, but it terminated with "Reading Vina maps ... Segmentation fault".

~/vina_1.2.2_linux_x86_64 --ligand 3ozt_105.pdbqt --maps 3ozt_protein --scoring vina --score_only

The maps were previously generated by command:

/opt/software/MGLTools/1.5.6/MGLTools-1.5.6/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_gpf4.py -l 3ozt_105.pdbqt -r 3ozt_protein.pdbqt -o 3ozt_protein.gpf -y
autogrid4 -p 3ozt_protein.gpf -l grid.log

Could you help to debug?

Thanks!
Best,
Lin

@diogomart
Copy link
Member

Hi,

autogrid4 writes maps for the autodock4 (ad4) scoring function, but you are requesting the vina scoring function, which has different atom types. In any case it should throw an error message, not just segfault. Could you provide the following information?

  1. does it work without --score_only
  2. do all the maps have the same number of lines and how many (wc -l *.map)
  3. values of npts in the .gpf file

Thanks!

@linfranksong
Copy link
Author

Hi,

I saw that in the recent paper, vna1.2 could read existing maps, maybe not from autogrid4?

  1. No, same segfault.
  2. Yes, each has 68927 lines.
  3. npts 40 40 40

@diogomart
Copy link
Member

Thanks for the info.

Vina will read autodock4 maps but with --scoring ad4 instead of --scoring vina
Vina can also read vina maps (--scoring vina) but those maps need to be written by vina itself with --write_maps.

@linfranksong
Copy link
Author

I see. Could you help me with another question? For the following protein and ligand, I'm trying to score the pose using vina1.1.2 and vina1.2.2. However, with the default box size(15.375 A for each dimension), I'm only able to get vina1.1.2 working, and vina1.2.2 gives a very large positive number. If I use 20.375 A cubic box, then vina1.2.2 could work and gave similar result as vina1.1.2.

Here're the protein and ligand files:
Archive.zip

@jeeberhardt
Copy link
Member

Hi Lin,

In Vina 1.1.2, the score (using --score_only) is not interpolated from the grids, but it is obtained by calculating the pairwise interactions between atoms directly. This changed in Vina 1.2, the score (using --score_only) is now obtained from the grids only.

In your case, the default box size (15.375 A) is too small for the ligand hence the large positive value you observe.

@linfranksong
Copy link
Author

Hi,
Thanks for your reply. Is this a “bug” in Vina1.2.2? I mean, the grids were generated by Vina1.2.2 itself, like Vina1.1.2 did by itself. Or am I misunderstanding something?

@diogomart
Copy link
Member

With --score_only, vina 1.1.2 ignores the dimensions and position of the grids, and does not penalize atoms that are outside. Grid dimensions don't even need to be defined with --score_only in 1.1.2.

Contrarily, vina 1.2.2 penalizes atoms that are outside the grids. So you need to specify grid dimensions that enclose all ligand atoms.

@linfranksong
Copy link
Author

I see. Is there any convenient or best approach to defining the grid box size for vina 1.2.2? Thank you!

@diogomart
Copy link
Member

Generally, the best is to look at the box and define it manually.

For an automated box around a known ligand a script like this will do:

#!/usr/bin/env python

import sys

lig = sys.argv[1]

xmax, xmin = float('-inf'), float('+inf')
ymax, ymin = float('-inf'), float('+inf')
zmax, zmin = float('-inf'), float('+inf')

for line in open(lig):
    if line[:6] in ['ATOM  ', 'HETATM']:
        x, y, z = float(line[30:38]), float(line[38:46]), float(line[46:54])
        xmax = max(xmax, x)
        ymax = max(ymax, y)
        zmax = max(zmax, z)
        xmin = min(xmin, x)
        ymin = min(ymin, y)
        zmin = min(zmin, z)

size_x = int(xmax-xmin) + 16
size_y = int(ymax-ymin) + 16
size_z = int(zmax-zmin) + 16
center_x = int(.5*xmax+.5*xmin) 
center_y = int(.5*ymax+.5*ymin) 
center_z = int(.5*zmax+.5*zmin) 

print('center_x = %d' % center_x)
print('center_y = %d' % center_y)
print('center_z = %d' % center_z)
print('size_x = %d' % size_x)
print('size_y = %d' % size_y)
print('size_z = %d' % size_z)

@linfranksong
Copy link
Author

I see. Thank you for the info! I will now close this issue.

@diogomart
Copy link
Member

Re-opening because we still need to get rid of the segfault when using --maps and ALL maps are missing :-)

@diogomart diogomart reopened this Aug 27, 2021
@linfranksong
Copy link
Author

Cool

@diogomart
Copy link
Member

Segfault fixed in #38, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants