AutoDock-Vina icon indicating copy to clipboard operation
AutoDock-Vina copied to clipboard

Failed to load grid map - python script

Open nimijkrap opened this issue 3 years ago • 1 comments

Hello. I tried to run Vina with the grid maps using the python script, but it seems that the grid maps were not loaded.

I was working at "AutoDock-Vina-1.2.3/example/python_scripting".

First I wrote the grid maps as following:

from vina import Vina

v = Vina(sf_name='vina')
v.set_receptor('1iep_receptor.pdbqt')
v.set_ligand_from_file('1iep_ligand.pdbqt')
v.compute_vina_maps(center=[15.190, 53.903, 16.917], box_size=[20, 20, 20])
v.write_maps()

It generated 5 grid maps as following: receptor.C_P.map receptor.N_D.map receptor.C_H.map receptor.N_A.map receptor.O_A.map

Then, I tried to load these grid maps and run docking, but the segmentation fault error was occurred. So, I loaded the grid maps and printed out info as following:

from vina import Vina

v = Vina(sf_name='vina')
v.set_receptor('1iep_receptor.pdbqt')
v.set_ligand_from_file('1iep_ligand.pdbqt')
v.load_maps("receptor")
print(v.info())

It printed out as following: {'rigid_receptor': None, 'flex_receptor': None, 'ligands': None, 'scoring_function': 'vina', 'weights': (-0.035579, -0.005156, 0.840245, -0.035069, -0.587439, 50, 0.05846), 'no_refine': False, 'box_center': None, 'box_size': None, 'box_spacing': None, 'box_even_elements': True, 'seed': -2015565719}

It seems that the grid maps can not be loaded by load_maps(). Could you please help me to fix it?

nimijkrap avatar Jan 08 '22 17:01 nimijkrap

I'd like to share what I have figured out. The grid map for "Vina" cannot be loaded, but the affinity maps for "AD4" can be loaded by load_maps. I think, because the AD4 docking do not need receptor, but need the prepared affinity maps generated using AutoDockTools, the load_maps function only supports loading the affinity maps for AD4.

nimijkrap avatar Feb 11 '22 07:02 nimijkrap

I've met this problem before, and my scorer function is Vina. If you use compute_vina_maps() before load_maps(), it would not raise errors.

from vina import Vina

v = Vina(sf_name='vina')
v.set_receptor('1iep_receptor.pdbqt')
v.set_ligand_from_file('1iep_ligand.pdbqt')
v.compute_vina_maps(center=[15.190, 53.903, 16.917], box_size=[20, 20, 20])
v.load_maps("receptor")
print(v.info())

It seems that there is no need to use load_maps() since compute_vina_maps() has already calculated the maps, but if the maps you want to load is not same as the maps which is generated by compute_vina_maps(), you can use this method to avoid error.

UR-Free avatar Jan 04 '23 05:01 UR-Free

I can't reproduce this problem, load_maps works as expected on Ubuntu 20.04/Python3.9:

>>> from vina import Vina
>>> v = Vina(sf_name="vina")
>>> v.load_maps("receptor")
Reading Vina maps ... done.
>>> v.set_ligand_from_file("1iep_ligand.pdbqt")
>>> v.dock()
Performing docking (random seed: -1931164659) ... 
0%   10   20   30   40   50   60   70   80   90   100%
|----|----|----|----|----|----|----|----|----|----|
*********

diogomart avatar Jan 04 '23 19:01 diogomart