Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new version for pdb2pdbqt #117

Merged
merged 38 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9abaebd
for receptor pdb conver to pabqt
zhangplpl Apr 7, 2024
365ebd6
pdbtopdbqt
zhangplpl Apr 7, 2024
097990e
changed unidock.py
zhangplpl Apr 7, 2024
9ac7aa8
del docking_grids_generator_old.py and schrodinger_atom_types.py, cha…
zhangplpl Apr 7, 2024
4393607
del protein_prep/pdb2pdbqt.py
zhangplpl Apr 7, 2024
4891458
changed import path
zhangplpl Apr 7, 2024
b729f9e
changed test_receptor_processor.py
zhangplpl Apr 8, 2024
183dbd8
changed test_proprep.py and for mcdock.py del pdb2pdbqt add receptor_…
zhangplpl Apr 8, 2024
089cc4f
[bugfix] escape some pyright warnings and fix ad4 option parsing in a…
Apr 8, 2024
310ac93
[feature] rename file names for templates
Apr 8, 2024
507218f
[bugfix] add missing import
Apr 8, 2024
3311fcc
[bugfix] add required dependencies
Apr 8, 2024
767e023
pyproject.toml: add some dir; mcdock.py,unidock_pipeline.py: Path-->str
zhangplpl Apr 9, 2024
0ff8f65
unidock.py: del line 37
zhangplpl Apr 9, 2024
32c0890
Merge branch 'main' into main
Hong-Rui Apr 9, 2024
9988cd0
[bugfix] ad4 map path
Apr 9, 2024
466fd4f
[feature] receptor preprocessor options, deprecated PDBQT file format…
Apr 9, 2024
84c66d3
Merge branch 'main' into main
Hong-Rui Apr 12, 2024
41bdee1
[feature] dependencies
Apr 12, 2024
cc1bcdb
add_argument
zhangplpl Apr 12, 2024
dec951e
change receptor_preprocessor_runner.py args.covalent_residue_atom_info
zhangplpl Apr 12, 2024
292ac50
[feature] remove autogrid runner usage
Apr 15, 2024
8eaae7d
[bugfix] autogrid ruuner remove
Apr 15, 2024
378ef40
[feature] ad4 map unit test
Apr 16, 2024
62eb726
[bugfix] receptor processor option
Apr 16, 2024
0cca15a
[bugfix] pocket option
Apr 16, 2024
e009169
[bugfix] receptor option
Apr 16, 2024
85ab281
[bugfix] mcdock test
Apr 16, 2024
fd2a9ef
[bugfix] ut option
Apr 16, 2024
f10c2a1
changed : resiudue chain id; or atom type; or alternative position
zhangplpl Apr 16, 2024
ac8fbce
Merge branch 'main' of github.com:zhangplpl/Uni-Dock into main
zhangplpl Apr 16, 2024
5b98771
[bugfix] mcdock args
Apr 16, 2024
a5e23d6
[bugfix] unidock pipeline option
Apr 16, 2024
b510faf
[bugfix] upfate test case pdb
Apr 17, 2024
d9bfa99
[feature] update covalent receptor preparation for watvina/unidock st…
May 15, 2024
f2e3d5e
Merge branch 'main' into main
Hong-Rui May 15, 2024
8851345
Merge remote-tracking branch 'upstream/main'
dp-yuanyn Aug 6, 2024
b98768a
fix:pyright check; build:openmm with cuda-version
dp-yuanyn Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions unidock_tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ RUN wget --quiet -O CDPKit.sh https://github.com/molinfo-vienna/CDPKit/releases/
rm CDPKit.sh

WORKDIR /opt
RUN mamba install -y ipython requests tqdm python-lmdb openbabel ambertools openmm -c conda-forge
RUN mamba create -y -n mgltools mgltools autogrid -c bioconda
ENV PATH $PATH:/opt/conda/envs/mgltools/bin

RUN mamba install -y ipython requests tqdm python-lmdb openbabel ambertools openmm cuda-version=12.0 -c conda-forge

COPY . /opt/unidock_tools
RUN cd /opt/unidock_tools && \
Expand Down
10 changes: 7 additions & 3 deletions unidock_tools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ version = "0.0.1"
keywords = [ "Docking" ]
authors = [
{ name = "Yannan Yuan", email = "yuanyn@dp.tech" },
{ name = "Hang Zheng", email = "zhengh@dp.tech" }
{ name = "Hang Zheng", email = "zhengh@dp.tech" },
{ name = "Hong-Rui Lin", email = "linhongrui@dp.tech" },
{ name = "Pengli Zhang", email = "zhangpengli@dp.tech" }
]
description = "Several docking-related applications based on Uni-Dock."
readme = "README.md"
Expand All @@ -31,7 +33,8 @@ classifiers = [
]

[tool.setuptools.package-data]
"*" = ["*.dat"]
"*" = ["*/templates/*", "*/receptor_topology/bin/*","*/receptor_topology/data/*"]


[project.urls]
Homepage = "https://github.com/dptech-corp/Uni-Dock"
Expand All @@ -55,4 +58,5 @@ reportMissingImports = false
reportMissingModuleSource = false
reportAttributeAccessIssue = false
reportIncompatibleMethodOverride = false
reportCallIssue = false
reportCallIssue = false
reportArgumentType = false
32 changes: 24 additions & 8 deletions unidock_tools/src/unidock_tools/application/mcdock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Union, Tuple
from typing import List, Tuple, Union, Optional
from pathlib import Path
import os
import time
Expand All @@ -10,7 +10,7 @@

from unidock_tools.utils import time_logger, randstr, make_tmp_dir, MolGroup
from unidock_tools.modules.confgen import generate_conf
from unidock_tools.modules.protein_prep import pdb2pdbqt
from unidock_tools.modules.protein_prep import receptor_preprocessor
from unidock_tools.modules.ligand_prep import TopologyBuilder
from unidock_tools.modules.docking import run_unidock
from .unidock_pipeline import Base, UniDock
Expand Down Expand Up @@ -61,6 +61,11 @@ def __init__(self,
size_x: float = 22.5,
size_y: float = 22.5,
size_z: float = 22.5,
kept_ligand_resname_list: Optional[List[str]] = None,
prepared_hydrogen: bool = True,
preserve_original_resname: bool = True,
covalent_residue_atom_info_list: Optional[List[Tuple[str, str]]] = None,
generate_ad4_grids: bool = False,
gen_conf: bool = True,
max_nconf: int = 1000,
min_rmsd: float = 0.5,
Expand All @@ -70,7 +75,7 @@ def __init__(self,
Initializes a MultiConfDock object.

Args:
receptor (Path): Path to the receptor file in pdbqt format.
receptor (Path): Path to the receptor file in PDB format.
ligands (List[Path]): List of paths to the ligand files in sdf format.
center_x (float): X-coordinate of the center of the docking box.
center_y (float): Y-coordinate of the center of the docking box.
Expand All @@ -84,11 +89,22 @@ def __init__(self,
self.workdir = workdir
self.workdir.mkdir(parents=True, exist_ok=True)
if receptor.suffix == ".pdb":
pdb2pdbqt(receptor, workdir.joinpath(receptor.stem + ".pdbqt"))
receptor = workdir.joinpath(receptor.stem + ".pdbqt")
if receptor.suffix != ".pdbqt":
logging.error("receptor file must be pdb/pdbqt format")
receptor_pdbqt_file_name, protein_grid_prefix = receptor_preprocessor(str(receptor),
kept_ligand_resname_list=kept_ligand_resname_list,
prepared_hydrogen=prepared_hydrogen,
preserve_original_resname=preserve_original_resname,
target_center=(center_x, center_y, center_z),
box_size=(size_x, size_y, size_z),
covalent_residue_atom_info_list=covalent_residue_atom_info_list,
generate_ad4_grids=generate_ad4_grids,
working_dir_name=str(workdir))

self.receptor = receptor_pdbqt_file_name
self.ad4_map_prefix = protein_grid_prefix
else:
logging.error("receptor file must be PDB format!!")
exit(1)

self.receptor = receptor
self.mol_group = MolGroup(ligands)
self.build_topology()
Expand Down Expand Up @@ -194,7 +210,7 @@ def run_unidock(self,
receptor=self.receptor, ligands=ligand_list, output_dir=output_dir,
center_x=self.center_x, center_y=self.center_y, center_z=self.center_z,
size_x=self.size_x, size_y=self.size_y, size_z=self.size_z,
scoring=scoring_function, num_modes=num_modes,
scoring=scoring_function, ad4_map_prefix=self.ad4_map_prefix, num_modes=num_modes,
search_mode=search_mode, exhaustiveness=exhaustiveness, max_step=max_step,
seed=seed, refine_step=refine_step, energy_range=energy_range,
score_only=score_only, local_only=local_only,
Expand Down
69 changes: 54 additions & 15 deletions unidock_tools/src/unidock_tools/application/proteinprep.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
import logging
import argparse
from unidock_tools.modules.protein_prep import pdb2pdbqt

import logging
import shutil
import os
from unidock_tools.modules.protein_prep import receptor_preprocessor
from typing import List, Tuple, Dict, Optional

def main(args: dict):
pdb2pdbqt(args["receptor_file"], args["output_file"])

def parse_covalent_residue_atom_info(covalent_residue_atom_info_str: str) -> List[List[Tuple[str, str, int, str]]]:
residue_info_list = []
residue_atoms = covalent_residue_atom_info_str.split(',')
for residue_atom in residue_atoms:
residue_info = residue_atom.strip().split()
chain_id, residue_name, residue_number, atom_name = residue_info
residue_info_list.append((chain_id, residue_name, int(residue_number), atom_name))
return residue_info_list

protein_pdbqt_file_name, protein_grid_prefix = receptor_preprocessor(
protein_pdb_file_name=args['protein_pdb'],
kept_ligand_resname_list=args['kept_ligand_resname_list'],
prepared_hydrogen=args['prepared_hydrogen'],
preserve_original_resname=args['preserve_resname'],
target_center=tuple(args['target_center']),
box_size=tuple(args['box_size']),
generate_ad4_grids=args['generate_grids'],
covalent_residue_atom_info_list = parse_covalent_residue_atom_info(args['covalent_residue_atom_info']) if args['covalent_residue_atom_info'] is not None else None,
working_dir_name=args['working_dir']
)

protein_pdbqt_dst = os.path.join(args['working_dir'], args['protein_pdbqt'])
shutil.copy(protein_pdbqt_file_name, protein_pdbqt_dst)

def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--receptor_file", type=str, required=True,
help="Input receptor file in PDB format")
parser.add_argument("-o", "--output_file", type=str, default="output.pdbqt",
help="Output file in PDBQT format")
def get_parser():
parser = argparse.ArgumentParser(description="Receptor Preprocessor")
parser.add_argument("-r", "--protein_pdb", type=str, required=True,
help="protein PDB file name")
parser.add_argument("-kr", "--kept_ligand_resname_list", type=str, nargs="+", default=None,
help="list of ligand residue names to keep. To use it like this: -kr Lig1 Lig2 ")
parser.add_argument("-ph", "--prepared_hydrogen", action="store_false",
help="prepare hydrogen atoms")
parser.add_argument("-pr", "--preserve_resname", action="store_false",
help="preserve original residue names")
parser.add_argument("-c", "--target_center", nargs=3, type=float, default=[0.0, 0.0, 0.0],
help="target center coordinates (x, y, z)")
parser.add_argument("-s", "--box_size", nargs=3, type=float, default=[22.5, 22.5, 22.5],
help="box size")
parser.add_argument("-g", "--generate_grids", action="store_true",
help="generate AD4 grids")
parser.add_argument("-cra", "--covalent_residue_atom_info", type=str, default=None,
help="Atom information for covalent residues during receptor preprocessing. To use it like this: -cra 'A VAL 1 CA, A VAL 1 CB, A VAL 1 O'((chain_id, residue_name, residue_number, atom_name)")
parser.add_argument("-wd", "--working_dir", type=str, default=".",
help="working directory")
parser.add_argument("-o", "--protein_pdbqt", type=str, required=True,
help="protein PDBQT file name")
return parser


def main_cli():
parser = get_parser()
args = parser.parse_args().__dict__
logging.info(f"[Params] {args}")
main(args)
args = vars(parser.parse_args())

logging.info(f"Running receptor_preprocessor with args: {args}")
main(args)

if __name__ == "__main__":
main_cli()
main_cli()
Loading