Multiple Ligand Docking
Jupyter Notebook is available at : Multiple Docking¶
In [ ]:
Copied!
from docksuitex.batch_docking import BatchProtein, BatchLigand, BatchPocketFinder, BatchVinaDocking, BatchAD4Docking
from docksuitex.utils import fetch_pdb, fetch_sdf, view_molecule, parse_vina_log_to_csv, parse_ad4_dlg_to_csv
from docksuitex.batch_docking import BatchProtein, BatchLigand, BatchPocketFinder, BatchVinaDocking, BatchAD4Docking
from docksuitex.utils import fetch_pdb, fetch_sdf, view_molecule, parse_vina_log_to_csv, parse_ad4_dlg_to_csv
Fetch and prepare Protein¶
In [ ]:
Copied!
# Fetch multiple protein structures (1HVR, 2TRX) in parallel
fetch_pdb(pdbid = ["1HVR", "2TRX"], save_to="proteins", parallel=2)
# Fetch multiple protein structures (1HVR, 2TRX) in parallel
fetch_pdb(pdbid = ["1HVR", "2TRX"], save_to="proteins", parallel=2)
In [ ]:
Copied!
# Initialize BatchProtein to process all proteins in the 'proteins' directory
# This cleans the PDB, removes water/heterogens, and adds hydrogens/charges
batch = BatchProtein(
inputs="proteins",
#Default parameters
fix_pdb=True,
remove_heterogens=True,
remove_water=True,
add_hydrogens=True,
add_charges=True,
preserve_charge_types=None, #eg: ["Zn", "Fe"]
)
# Run preparation for all proteins using 8 CPUs
batch.prepare_all(save_to="prepared_proteins", cpu = 8)
# Initialize BatchProtein to process all proteins in the 'proteins' directory
# This cleans the PDB, removes water/heterogens, and adds hydrogens/charges
batch = BatchProtein(
inputs="proteins",
#Default parameters
fix_pdb=True,
remove_heterogens=True,
remove_water=True,
add_hydrogens=True,
add_charges=True,
preserve_charge_types=None, #eg: ["Zn", "Fe"]
)
# Run preparation for all proteins using 8 CPUs
batch.prepare_all(save_to="prepared_proteins", cpu = 8)
Find Binding Pockets¶
In [ ]:
Copied!
# Identify binding pockets for all prepared proteins using P2Rank
batch = BatchPocketFinder(inputs="prepared_proteins", max_centres=3)
# Run pocket detection and return receptors with their pocket centers
receptors_with_centers = batch.run_all(save_to="pockets_output", cpu=8)
# Identify binding pockets for all prepared proteins using P2Rank
batch = BatchPocketFinder(inputs="prepared_proteins", max_centres=3)
# Run pocket detection and return receptors with their pocket centers
receptors_with_centers = batch.run_all(save_to="pockets_output", cpu=8)
Fetch and prepare Ligand¶
In [ ]:
Copied!
# Fetch multiple ligand structures (CIDs 228, 338, 339, 340) in parallel
fetch_sdf(cid = ["228", "338", "339", "340"], save_to="ligands", parallel=2)
# Fetch multiple ligand structures (CIDs 228, 338, 339, 340) in parallel
fetch_sdf(cid = ["228", "338", "339", "340"], save_to="ligands", parallel=2)
In [ ]:
Copied!
# Initialize BatchLigand to process all ligands in the 'ligands' directory
# This minimizes the structure, removes water and adds hydrogens/charges
batch = BatchLigand(
inputs="ligands",
#Default parameters
minimize=None, #Options: "mmff94", "mmff94s", "uff", "gaff"
remove_water=True,
add_hydrogens=True,
add_charges=True,
preserve_charge_types=None,
)
# Run preparation for all ligands using 8 CPUs
batch.prepare_all(save_to="prepared_ligands", cpu=8)
# Initialize BatchLigand to process all ligands in the 'ligands' directory
# This minimizes the structure, removes water and adds hydrogens/charges
batch = BatchLigand(
inputs="ligands",
#Default parameters
minimize=None, #Options: "mmff94", "mmff94s", "uff", "gaff"
remove_water=True,
add_hydrogens=True,
add_charges=True,
preserve_charge_types=None,
)
# Run preparation for all ligands using 8 CPUs
batch.prepare_all(save_to="prepared_ligands", cpu=8)
Dock each ligand against a each receptor at all the predicted protein pockets¶
Using Vina¶
In [ ]:
Copied!
# Initialize BatchVinaDocking with prepared receptors (and their pockets) and ligands
batch = BatchVinaDocking(
receptors_with_centers=receptors_with_centers,
ligands="prepared_ligands",
# Default Parameters
grid_size=(20,20,20),
exhaustiveness=8,
num_modes=9,
seed=42
)
# Run Vina docking for all receptor-ligand pairs using 8 CPUs
results_vina = batch.run_all(save_to="vina_batch_results", cpu=8)
# Parse all Vina output logs into a single CSV summary
parse_vina_log_to_csv(results_dir="vina_batch_results", output_csv="vina_batch_results/vina_summary.csv")
# Initialize BatchVinaDocking with prepared receptors (and their pockets) and ligands
batch = BatchVinaDocking(
receptors_with_centers=receptors_with_centers,
ligands="prepared_ligands",
# Default Parameters
grid_size=(20,20,20),
exhaustiveness=8,
num_modes=9,
seed=42
)
# Run Vina docking for all receptor-ligand pairs using 8 CPUs
results_vina = batch.run_all(save_to="vina_batch_results", cpu=8)
# Parse all Vina output logs into a single CSV summary
parse_vina_log_to_csv(results_dir="vina_batch_results", output_csv="vina_batch_results/vina_summary.csv")
Using AutoDock4¶
In [ ]:
Copied!
# Initialize BatchAD4Docking with prepared receptors (and their pockets) and ligands
batch_ad4 = BatchAD4Docking(
receptors_with_centers=receptors_with_centers,
ligands="prepared_ligands",
#Default Parameters
grid_size=(60,60,60),
spacing=0.375,
dielectric=-0.1465,
smooth=0.5,
ga_pop_size=150,
ga_num_evals=2500000,
ga_num_generations=27000,
ga_elitism=1,
ga_mutation_rate=0.02,
ga_crossover_rate=0.8,
ga_run=10,
rmstol=2.0,
seed=("pid", "time")
)
# Run AutoDock4 docking for all receptor-ligand pairs using 8 CPUs
results_ad4 = batch_ad4.run_all(save_to="ad4_batch_results", cpu=8)
# Parse all AD4 output logs into a single CSV summary
parse_ad4_dlg_to_csv(results_dir="ad4_batch_results", output_csv="ad4_batch_results/ad4_summary.csv")
# Initialize BatchAD4Docking with prepared receptors (and their pockets) and ligands
batch_ad4 = BatchAD4Docking(
receptors_with_centers=receptors_with_centers,
ligands="prepared_ligands",
#Default Parameters
grid_size=(60,60,60),
spacing=0.375,
dielectric=-0.1465,
smooth=0.5,
ga_pop_size=150,
ga_num_evals=2500000,
ga_num_generations=27000,
ga_elitism=1,
ga_mutation_rate=0.02,
ga_crossover_rate=0.8,
ga_run=10,
rmstol=2.0,
seed=("pid", "time")
)
# Run AutoDock4 docking for all receptor-ligand pairs using 8 CPUs
results_ad4 = batch_ad4.run_all(save_to="ad4_batch_results", cpu=8)
# Parse all AD4 output logs into a single CSV summary
parse_ad4_dlg_to_csv(results_dir="ad4_batch_results", output_csv="ad4_batch_results/ad4_summary.csv")