NiBoyang / AutoDock-SS

Use AutoDock for Ligand-based Virtual Screening
19 stars 2 forks source link

Incorrect Pathing // Folders Created in Wrong Dir #2

Closed cmwilson252 closed 3 months ago

cmwilson252 commented 3 months ago

Hello, the issue I am having seems to be fatal to the execution of the tool. I am having a hard time tracking down where the root cause is alone. I am going to share my current setup in hopes of starting a dialogue!

I have my global vars set like so:

dock_gpu_exec_path = "/home/AutoDock-GPU/bin/autodock_gpu_64wi" # directory of Autodock-GPU> lib_path = f'/home/test_compounds/' # directory of your VS library lig_path = f'/home//test_ligand/' # directory of your reference ligand path_of_scripts = "/home/AutoDock-SS/" # directory of Autodock-SS scripts

I start with the lib_path like so: /home/test_compounds/test.sdf.gz

Just a .sdf.gz as required.

I start with the lig_path like so: /home/test_ligand/6UCL.pdbqt

Just a .pdbqt as required.

I then activate the adss environment and run adss_main.py from the Autodock-SS folder. Following this I get this CLI output:

/home/test_ligand/6UCL.pdbqt Confirmation: The PDBQT file you input is : /home/test_ligand/6UCL.pdbqt 1 molecule converted 1 molecule converted [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] Explicit valence for atom # 36 N, 4, is greater than permitted [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] WARNING: not removing hydrogen atom without neighbors [18:26:22] Explicit valence for atom # 36 N, 4, is greater than permitted Finished creating 'grid.txt' Finished creating map files 1 molecule converted 1 molecule converted Sorry, there are no Gasteiger parameters available for atom 6UCL: :HOH3:O Sorry, there are no Gasteiger parameters available for atom 6UCL: :HOH32:O Warning: hydrogens, ['H', 'H', 'H', 'H', 'H'] , with no bonds! must specify ROOT before writing Traceback (most recent call last): File "/homeAutoDock-SS/ligandprep.py", line 218, in if mol.returnCode != 0: AttributeError: 'Protein' object has no attribute 'returnCode' AutoDock-GPU version: v1.5.3-73-gf5cf6ffdd0c5b3f113d5cc424fabee51df04da7e

Running 2 docking calculations

Cuda device: Tesla V100-SXM2-16GB Available memory on device: 15842 MB (total: 16151 MB)

CUDA Setup time 0.150074s

Running Job #1: Device: Tesla V100-SXM2-16GB Grid map file: /home/test_ligand/6UCL.maps.fld Ligand file: /home/test_compounds/Aspirin/Aspirin.pdbqt Output file: /home/test_ligand//Aspirin.dlg Using heuristics: (capped) number of evaluations set to 244898 Local-search chosen method is: ADADELTA (ad)

Rest of Setup time 0.016778s

Executing docking runs, stopping automatically after either reaching 0.15 kcal/mol standard deviation of the best molecules of the last 4 * 5 generations, 42000 generations, or 244898 evaluations:

Generations | Evaluations | Threshold | Average energy of best 10% | Samples | Best Inter + Intra ------------+--------------+------------------+------------------------------+---------+------------------- 0 | 150 | 3815.01 kcal/mol | 458.50 +/- 447.53 kcal/mol | 2 | 10.97 kcal/mol 5 | 23701 | 3815.01 kcal/mol | 134.82 +/- 305.20 kcal/mol | 22 | -9.33 kcal/mol 10 | 46908 | 342.91 kcal/mol | -8.87 +/- 0.91 kcal/mol | 6 | -9.55 kcal/mol 15 | 70100 | -6.60 kcal/mol | -9.21 +/- 0.39 kcal/mol | 7 | -9.84 kcal/mol 20 | 93229 | -8.38 kcal/mol | -10.00 +/- 0.76 kcal/mol | 9 | -11.13 kcal/mol 25 | 116295 | -8.74 kcal/mol | -10.31 +/- 0.53 kcal/mol | 5 | -11.13 kcal/mol 30 | 139380 | -8.72 kcal/mol | -10.71 +/- 0.66 kcal/mol | 8 | -11.54 kcal/mol 35 | 162435 | -9.47 kcal/mol | -11.32 +/- 0.19 kcal/mol | 5 | -11.54 kcal/mol 40 | 185450 | -10.75 kcal/mol | -11.23 +/- 0.22 kcal/mol | 4 | -11.54 kcal/mol 45 | 208450 | -10.39 kcal/mol | -11.28 +/- 0.33 kcal/mol | 8 | -11.71 kcal/mol 50 | 231440 | -10.66 kcal/mol | -11.71 +/- 0.20 kcal/mol | 6 | -12.04 kcal/mol 53 | 245230 | -11.21 kcal/mol | -11.77 +/- 0.18 kcal/mol | 13 | -12.04 kcal/mol ------------+--------------+------------------+------------------------------+---------+-------------------

                               Finished evaluation after reaching
                    245230 evaluations. Best inter + intra   -12.04 kcal/mol.

Docking time 0.393369s

Shutdown time 0.003852s

Job #1 took 0.414 sec after waiting 0.173 sec for setup

Error: Can't open ligand data file /home/test_compounds/6UCL/6UCL.pdbqt.

Error in init_liganddata, stopped job.

Error in setup of Job #2: ( Grid map file: /home/test_ligand/6UCL.maps.fld ) ( Ligand file: /home/test_compounds/6UCL/6UCL.pdbqt ) Run time of entire job set (2 files): 0.661 sec Processing time: 0.074 sec

Warning: The following jobs were not successful: Job 1: /home/test_compounds/6UCL/6UCL.pdbqt 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26/26 [00:00<00:00, 144.97it/s] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 5.48it/s] cats ['Aspirin'] cats Traceback (most recent call last): File "/home/AutoDock-SS/adss_main.py", line 303, in main() File "/home/AutoDock-SS/adss_main.py", line 289, in main sorted_name, sorted_score = normalize_and_sort_scores(name_lis, score_lis, ref_path) File "/home/AutoDock-SS/adss_main.py", line 201, in normalize_and_sort_scores ref_ind = name_lis.index(f"{Path(ref_path).stem}") ValueError: '6UCL' is not in list

For some reason a folder for the ligand is being made in the compound file path which is then trying to be accessed I guess? I am not really sure what is going on here, but it seems to be causing failures.

NiBoyang commented 3 months ago

Hi @cmwilson252 Thanks for trying AutoDock-SS. I would appreciate if you could upload your reference ligand and the library. I'm not 100% sure what happened but it seems like the AutoDock-GPU job of your reference ligand was unsuccessful Warning: The following jobs were not successful: Job 1: /home/test_compounds/6UCL/6UCL.pdbqt. So the 'docked' reference ligand was not in the lib_path where it should be, which led to the error.

NiBoyang commented 3 months ago

Hi @cmwilson252 , could you please try to use the below function to replace the old normalize_and_sort_scores function located line 198. I added an error check in it and if the reference ligand docked unsuccessfully, it would sort the results by the AutoDock scores.

def normalize_and_sort_scores(name_lis, score_lis, ref_path):

    """Normalizes and sorts scores."""

    try:
        ref_ind = name_lis.index(f"{Path(ref_path).stem}")
        ref_score = score_lis[ref_ind]
        del name_lis[ref_ind]
        del score_lis[ref_ind]

        normalized_score_lis = np.array(score_lis)/ref_score
        sorted_index = np.argsort(normalized_score_lis)[::-1]
        sorted_name = [name_lis[i] for i in sorted_index]
        sorted_score = [normalized_score_lis[i] for i in sorted_index]

    except ValueError:
        print("The docking of your reference ligand failed, no normalization will be done, results will be sorted by the AutoDock-GPU energy.")
        sorted_index = np.argsort(score_lis)
        sorted_name = [name_lis[i] for i in sorted_index]
        sorted_score = [score_lis[i] for i in sorted_index]

    return sorted_name, sorted_score
cmwilson252 commented 3 months ago

I think for the line:

    sorted_score = [normalized_score_lis[i] for i in sorted_index]

we cannot access normalized_score_lis as it hasn't been declared yet.

NiBoyang commented 3 months ago

Sorry my bad. It should be sorted_score = [score_lis[i] for i in sorted_index]

cmwilson252 commented 3 months ago

Okay, this worked. Thank you! I guess I will go and actually use compounds that work...

NiBoyang commented 3 months ago

No worries. Thanks again for trying AutoDock-SS. Raise the issue if you have any.