Comments (4)
Hi @parkc23,
Could you please provide the code and file to reproduce the issue?
from oddt.
from oddt.
The same thing is happening with autodock_vina. It just stuck at some molecules (py process fills up whole memory after vina process ends), usually larger ones. Example is bellow. Tested on windows and ubuntu. Example from shorturl.at/eNRX0 works fine.
Any thoughts?
Code:
mol = Chem.AddHs(Chem.MolFromSmiles('CC(=O)O[C@H]1C[C@@H](OC(C)=O)C(C)(C)[C@@H]2C[C@@H](OC(C)=O)[C@]3(C)[C@H](CC[C@@]4(C)[C@H](c5ccoc5)OC(=O)[C@H]5O[C@]543)[C@@]12C
'))
AllChem.EmbedMolecule(mol)
odmol = oddt.toolkits.rdk.Molecule(mol)
obmol = oddt.toolkits.ob.Molecule(odmol)
vs.center
res = vs.dock(ligands=[obmol])
from oddt.
The same thing is happening with autodock_vina. It just stuck at some molecules (py process fills up whole memory after vina process ends), usually larger ones. Example is bellow. Tested on windows and ubuntu. Example from shorturl.at/eNRX0 works fine. Any thoughts?
Code: mol = Chem.AddHs(Chem.MolFromSmiles('
CC(=O)O[C@H]1C[C@@H](OC(C)=O)C(C)(C)[C@@H]2C[C@@H](OC(C)=O)[C@]3(C)[C@H](CC[C@@]4(C)[C@H](c5ccoc5)OC(=O)[C@H]5O[C@]543)[C@@]12C
')) AllChem.EmbedMolecule(mol) odmol = oddt.toolkits.rdk.Molecule(mol) obmol = oddt.toolkits.ob.Molecule(odmol) vs.center res = vs.dock(ligands=[obmol])
Just to follow up on the issue I reported in previous comment. Basically, what prevented python process to finish was part of the code of "dock" function of AutodockVina.py which renumbers the atoms order and calculates the RMSD on that messed up atoms. When I deleted (commented out) the parts of the code referring to the renumbering and rmsd calculations, everything worked just fine. Modified AutodockVina.py dock function is attached below. Probably something went wrong with open babel version (i have tested versions 3.0.0 and above). I hope this will help others to solve the issue on failure in completing.
def dock(self, ligands, protein=None):
"""Automated docking procedure.
Parameters
----------
ligands: iterable of oddt.toolkit.Molecule objects
Ligands to dock
protein: oddt.toolkit.Molecule object or None
Protein object to be used. If None, then the default one
is used, else the protein is new default.
Returns
-------
ligands : array of oddt.toolkit.Molecule objects
Array of ligands (scores are stored in mol.data method)
"""
if protein:
self.set_protein(protein)
if not self.protein_file:
raise IOError("No receptor.")
if is_molecule(ligands):
ligands = [ligands]
ligand_dir = mkdtemp(dir=self.tmp_dir, prefix='ligands_')
output_array = []
for n, ligand in enumerate(ligands):
check_molecule(ligand, force_coords=True)
ligand_file = write_vina_pdbqt(ligand, ligand_dir, name_id=n)
ligand_outfile = ligand_file[:-6] + '_out.pdbqt'
try:
scores = parse_vina_docking_output(
subprocess.check_output([self.executable, '--receptor',
self.protein_file,
'--ligand', ligand_file,
'--out', ligand_outfile] +
self.params +
['--cpu', str(self.n_cpu)],
stderr=subprocess.STDOUT))
except subprocess.CalledProcessError as e:
sys.stderr.write(e.output.decode('ascii'))
if self.skip_bad_mols:
continue # TODO: print some warning message
else:
raise Exception('Autodock Vina failed. Command: "%s"' %
' '.join(e.cmd))
# docked conformations may have wrong connectivity - use source ligand
if is_openbabel_molecule(ligand):
if oddt.toolkits.ob.__version__ >= '2.4.0':
# find the order of PDBQT atoms assigned by OpenBabel
with open(ligand_file) as f:
write_order = [int(line[7:12].strip())
for line in f
if line[:4] == 'ATOM']
new_order = sorted(range(len(write_order)),
key=write_order.__getitem__)
new_order = [i + 1 for i in new_order] # OBMol has 1 based idx
assert len(new_order) == len(ligand.atoms)
else:
# Openbabel 2.3.2 does not support perserving atom order.
# We read back the PDBQT ligand to get "correct" bonding.
ligand = next(oddt.toolkit.readfile('pdbqt', ligand_file))
if 'REMARK' in ligand.data:
del ligand.data['REMARK']
docked_ligands = oddt.toolkit.readfile('pdbqt', ligand_outfile)
for docked_ligand, score in zip(docked_ligands, scores):
# Renumber atoms to match the input ligand
# if (is_openbabel_molecule(docked_ligand) and
# oddt.toolkits.ob.__version__ >= '2.4.0'):
# docked_ligand.OBMol.RenumberAtoms(new_order)
# HACK: copy docked coordinates onto source ligand
# We assume that the order of atoms match between ligands
clone = docked_ligand.clone
clone.clone_coords(docked_ligand)
clone.data.update(score)
# Calculate RMSD to the input pose
# try:
# clone.data['vina_rmsd_input'] = rmsd(ligand, clone)
# clone.data['vina_rmsd_input_min'] = rmsd(ligand, clone,
# method='min_symmetry')
# except Exception:
# pass
output_array.append(clone)
rmtree(ligand_dir)
return output_array
from oddt.
Related Issues (20)
- Calculating PLEC by bypassing completely OpenBabel HOT 6
- Could there be a new release? HOT 2
- Ring normal vector is calculated incorrectly in pip package HOT 1
- Please do not install tests into the 'test' directory
- Protein structure used does not change when using autodock_vina_descriptor.build()
- PIP distribution does not correspond to github version HOT 1
- Installing oddt from poetry is not possible HOT 3
- TypeError: in method 'new_OBMol' HOT 2
- RDKIT molecule HOT 1
- Training scoring functions and updated version of PDBBind HOT 2
- oodt syntax error HOT 1
- pip installation failed -
- you have a mol2 parser in there? HOT 3
- Docking Issues Between MacOS and Windows HOT 1
- AttributeError: module 'openbabel.openbabel' has no attribute 'OBElementTable' HOT 1
- toolkit not being recognised
- rf = RFScore() TypeError: 'module' object is not callable HOT 2
- for mol in ligands: TypeError: 'NoneType' object is not iterable
- Question about retrain your model on PDBbind-2016 by modifying the 'act' column
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oddt.