Rose-STL-Lab / LIMO

generative model for drug discovery
59 stars 14 forks source link

Output of docking results #12

Closed mikelee-dev closed 1 year ago

mikelee-dev commented 1 year ago

Hi, perhaps I am missing something here, but in line 214 of utils.py:

ps.append(subprocess.Popen(f'{autodock} -M {protein_file} -s 0 -B ligands/{device}/ligand*.pdbqt -N ../../outs/ -D {device + 1}', shell=True, stdout=subprocess.DEVNULL))

It seems that the output .dlg files for the docking results are being saved at: ../../outs/, and I have 2 questions:

  1. Is the expected behavior supposed to be that AutoDock writes all of the docking results for each ligand file processed here in the batch list in the output folder specified by -N? because in the AutoDock documentation, -N refers to a single file output location. So won't these .dlg files get overwritten with each run of AutoDock?
  2. later, in line 223 of utils.py: for file in tqdm(os.listdir('outs'), desc='extracting binding values'): this seems to be reading from ./outs instead of ../../outs/

I could be missing something here, but in my case none of the .dlg files are generated in either ./outs or ../../outs/

PeterEckmann1 commented 1 year ago

Hi, it does seem odd that you're not getting any dlg files generated. To address your questions:

  1. The -N parameter points to a folder which autodock dumps all its results in to, one .dlg file for each ligand processed. The .dlgs are named sequentially during a batch run, so they won't get overwritten during a batch autodock run. You are correct that if we instantiate autodock again, then the files will get overwritten, but autodock should only be instantiated once per call to smiles_to_affinity, so it shouldn't matter if the files get overwritten after that function returns.
  2. I believe the ../../outs/ in the autodock call is relative to the pdbqt file, so it would be relative to ligands/{device}/ligand*.pdbqt, meaning outs is in whatever directory ligands is in. Since utils.py is also in the directory ligands is in, the correct path relative to utils.py should indeed be ./outs

If you're running the code on a non-linux machine the file paths could be different, which potentially causes the error you're getting. It could also just be a silent error from autodock, which is why no dlg files are generating. Try removing all references to stdout=subprocess.DEVNULL and stderr=subprocess.DEVNULL in the subprocess calls, so that any errors that are generated will be shown. Then you can send them here for further debugging.

Let me know if that helps, and feel free to ask any follow up questions!

mikelee-dev commented 1 year ago

Hi Peter, thank you very much for your very clear explanation. It seems like the confusion came more from how AutoDock saves its results, and not your code. I resolved my issue, but in a slightly different way where I modified the calls to AutoDock to specify concrete file names for the outputs. So everything worked from here.

Thanks again for your help