Skip to content

Commit

Permalink
Fix a docstring to include vinardo for sf_name
Browse files Browse the repository at this point in the history
  • Loading branch information
eunos-1128 committed Feb 22, 2024
1 parent 350bb7f commit d3ed1d8
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions build/python/vina/vina.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, sf_name='vina', cpu=0, seed=0, no_refine=False, verbosity=1):
"""Initialize a Vina object.
Args:
sf_name (str): Scoring function name to use (Vina or ad4) (default: vina)
sf_name (str): Scoring function name to use (vina, vinardo or ad4) (default: vina)
cpu (int): Number of CPU to use (default: 0; use all of them)
seed (int): Random seed (default: 0; ramdomly choosed)
no_refine (boolean): when receptor is provided, do not use explicit receptor atoms
Expand All @@ -34,7 +34,7 @@ def __init__(self, sf_name='vina', cpu=0, seed=0, no_refine=False, verbosity=1):
raise ValueError('Error: Scoring function %s not recognized. (only vina, vinardo or ad4)' % sf_name)

self._vina = _Vina(sf_name, cpu, seed, verbosity, no_refine)

self._sf_name = sf_name
if sf_name == 'vina':
self._weights = (-0.035579, -0.005156, 0.840245, -0.035069, -0.587439, 50, 0.05846)
Expand All @@ -56,10 +56,10 @@ def __init__(self, sf_name='vina', cpu=0, seed=0, no_refine=False, verbosity=1):
self._seed = self._vina.seed()

def __str__(self):
"""Print basic information about Docking configuration (rigid receptor, flex receptor,
ligands, scoring function, weights, no_refine, box center, box dimensions,
"""Print basic information about Docking configuration (rigid receptor, flex receptor,
ligands, scoring function, weights, no_refine, box center, box dimensions,
box spacing, box even nelements, seed).
"""
info = "Receptor (rigid): %s\n" % self._rigid_receptor
info += "Receptor (flex): %s\n" % self._flex_receptor
Expand All @@ -82,17 +82,17 @@ def __str__(self):
info += "Seed: %s" % self._seed

return info

def cite(self):
"""Print citation message."""
self._vina.cite()

def info(self):
"""Return information about the docking configuration.
Returns:
dict (str): Dictionary of information about the docking configuration.
Information:
rigid_receptor (str),
flex_receptor (str),
Expand All @@ -105,7 +105,7 @@ def info(self):
box_spacing (float),
box_even_elements (bool),
seed (int)
"""
info = {}

Expand All @@ -120,7 +120,7 @@ def info(self):
info['box_spacing'] = self._spacing
info['box_even_elements'] = self._even_nelements
info['seed'] = self._seed

return info

def set_receptor(self, rigid_pdbqt_filename=None, flex_pdbqt_filename=None):
Expand Down Expand Up @@ -184,7 +184,7 @@ def set_ligand_from_file(self, pdbqt_filename):
self._vina.set_ligand_from_file(pdbqt_filename)

self._ligands = pdbqt_filename

def set_ligand_from_string(self, pdbqt_string):
"""Set ligand(s) from a string. The chemical file format must be PDBQT.
Expand All @@ -194,7 +194,7 @@ def set_ligand_from_string(self, pdbqt_string):
"""
if not isinstance(pdbqt_string, (list, tuple)):
pdbqt_string = [pdbqt_string]

for ps in pdbqt_string:
if not isinstance(ps, str):
raise TypeError('Error: %s is not a string.' % ps)
Expand Down Expand Up @@ -276,7 +276,7 @@ def load_maps(self, map_prefix_filename):
raise RuntimeError('Error: Cannot find affinity maps with %s' % map_prefix_filename)

self._vina.load_maps(map_prefix_filename)

def write_maps(self, map_prefix_filename='receptor', gpf_filename='NULL',
fld_filename='NULL', receptor_filename='NULL', overwrite=False):
"""Write affinity maps.
Expand All @@ -302,7 +302,7 @@ def write_maps(self, map_prefix_filename='receptor', gpf_filename='NULL',
raise RuntimeError(error_msg)

self._vina.write_maps(map_prefix_filename, gpf_filename, fld_filename, receptor_filename)

def write_pose(self, pdbqt_filename, remarks='', overwrite=False):
"""Write pose (after randomize or optimize).
Expand All @@ -319,7 +319,7 @@ def write_pose(self, pdbqt_filename, remarks='', overwrite=False):
raise RuntimeError('Error: Cannot overwrite %s, already exists.' % pdbqt_filename)

self._vina.write_pose(pdbqt_filename, remarks)

def write_poses(self, pdbqt_filename, n_poses=9, energy_range=3.0, overwrite=False):
"""Write poses from docking.
Expand All @@ -344,7 +344,7 @@ def write_poses(self, pdbqt_filename, n_poses=9, energy_range=3.0, overwrite=Fal
raise ValueError('Error: energy range must be greater than zero.')

self._vina.write_poses(pdbqt_filename, n_poses, energy_range)

def poses(self, n_poses=9, energy_range=3.0, coordinates_only=False):
"""Get poses from docking.
Expand All @@ -361,7 +361,7 @@ def poses(self, n_poses=9, energy_range=3.0, coordinates_only=False):
raise ValueError('Error: number of poses written must be greater than zero.')
elif energy_range <= 0:
raise ValueError('Error: energy range must be greater than zero.')

if coordinates_only:
# Dirty hack to get the coordinates from C++, it is not advised to have vector<vector<vector<double>>>
coordinates = np.array(self._vina.get_poses_coordinates(n_poses, energy_range))
Expand All @@ -370,20 +370,20 @@ def poses(self, n_poses=9, energy_range=3.0, coordinates_only=False):
return coordinates
else:
return self._vina.get_poses(n_poses, energy_range)

def energies(self, n_poses=9, energy_range=3.0):
"""Get pose energies from docking.
Args:
n_pose (int): number of poses to retrieve (default: 9)
energy_range (float): maximum energy difference from best pose (default: 3.0 kcal/mol)
Returns:
ndarray: Array of energies from each pose (rows=poses, columns=energies)
ndarray: Array of energies from each pose (rows=poses, columns=energies)
Vina/Vinardo FF:
columns=[total, inter, intra, torsions, intra best pose]
AutoDock FF:
columns=[total, inter, intra, torsions, -intra]
Expand All @@ -403,7 +403,7 @@ def randomize(self, max_steps=10000):
"""
self._vina.randomize(max_steps)

def score(self, unbound_energy=None):
"""Score current pose.
Expand All @@ -415,7 +415,7 @@ def score(self, unbound_energy=None):
Vina/Vinardo FF:
columns=[total, lig_inter, flex_inter, other_inter, flex_intra, lig_intra, torsions, lig_intra best pose]
AutoDock FF:
columns=[total, lig_inter, flex_inter, other_inter, flex_intra, lig_intra, torsions, -lig_intra]
Expand All @@ -440,7 +440,7 @@ def optimize(self, max_steps=0):
Vina/Vinardo FF:
columns=[total, lig_inter, flex_inter, other_inter, flex_intra, lig_intra, torsions, lig_intra best pose]
AutoDock FF:
columns=[total, lig_inter, flex_inter, other_inter, flex_intra, lig_intra, torsions, -lig_intra]
Expand Down

0 comments on commit d3ed1d8

Please sign in to comment.