Skip to content

Conversation

pslacerda
Copy link
Member

Loosely based on the original AutoDock plugin. It isn't ready yet, there is more work to do:

  1. test it on Windows
  2. allow other ligand input formats besides SMILES
  3. support other Vina implementations like QVina and SMINA

Must be a more convenient way to set the prefs. I'm thinking of guess the defaults for Ubuntu and Windows and let users adjust the prefs themselves if don't work.

Loosely based on the original AutoDock plugin.
Copy link
Contributor

@speleo3 speleo3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't run a docking (don't know how to use it) but the code looks pretty clean, nice job.

plugins/vina.py Outdated
Comment on lines 77 to 83
DEFAULT_PREFS = {
'DOCKING_VINA': '/usr/bin/vina',
'DOCKING_OBABEL': '/usr/bin/obabel',
'DOCKING_ADT_PYTHON': '/usr/bin/python2.7',
'DOCKING_PREPARE_RECEPTOR': '/usr/lib/python2.7/dist-packages/AutoDockTools/Utilities24/prepare_receptor4.py',
'DOCKING_PREPARE_FLEXRECEPTOR': '/usr/lib/python2.7/dist-packages/AutoDockTools/Utilities24/prepare_flexreceptor4.py',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could try something like this:

try:
    from AutoDockTools import Utilities24
    utilities24_dir = os.path.dirname(Utilities24.__file__)
    docking_adt_python = sys.executable
except ImportError:
    try:
        utilities24_dir = glob('/usr/lib/python*/dist-packages/AutoDockTools/Utilities24')[0]
        docking_adt_python = '/usr/bin/' + utilities24_dir.split('/')[3]
    except IndexError:
        utilities24_dir = ''
        docking_adt_python = ''

DEFAULT_PREFS = {
    'DOCKING_VINA': 'vina',  # without /usr/bin, will pick it up from $PATH
    'DOCKING_OBABEL': 'obabel',
    'DOCKING_ADT_PYTHON': docking_adt_python,
    'DOCKING_PREPARE_RECEPTOR': os.path.join(utilities24_dir, 'prepare_receptor4.py'),
    'DOCKING_PREPARE_FLEXRECEPTOR': os.path.join(utilities24_dir, 'prepare_flexreceptor4.py'),
}

plugins/vina.py Outdated
Comment on lines 624 to 628
command = (
f'"{adt_python}"'
f' "{prepare_target}" -r "{target_pdb}"'
)
output, success = run(command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove the shlex.split call in run and do this:

command = [adt_python, prepare_target, "-r", target_pdb]

plugins/vina.py Outdated
Comment on lines 91 to 93
def run(command):
ret = subprocess.run(
shlex.split(command),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to pass a list and not do shlex.split (see other comment below)

@JarrettSJohnson
Copy link
Contributor

Checking in to see what the status of this PR is since it's been quite some time. @pslacerda

@pslacerda
Copy link
Member Author

i'm needing to make this plugin public.

@pslacerda pslacerda merged commit bca0822 into Pymol-Scripts:master Feb 10, 2022
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

Successfully merging this pull request may close these issues.

4 participants