Skip to content

Commit

Permalink
changed test_proprep.py and for mcdock.py del pdb2pdbqt add receptor_…
Browse files Browse the repository at this point in the history
…processor
  • Loading branch information
zhangplpl committed Apr 8, 2024
1 parent b729f9e commit 183dbd8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
9 changes: 6 additions & 3 deletions unidock_tools/src/unidock_tools/application/mcdock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

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 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 @@ -84,8 +85,10 @@ 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")
#pdb2pdbqt(receptor, workdir.joinpath(receptor.stem + ".pdbqt"))
#receptor = workdir.joinpath(receptor.stem + ".pdbqt")
receptor_pdbqt_file_name = receptor_preprocessor(receptor, working_dir_name=workdir)
self.receptor = receptor_pdbqt_file_name
if receptor.suffix != ".pdbqt":
logging.error("receptor file must be pdb/pdbqt format")
exit(1)
Expand Down
19 changes: 9 additions & 10 deletions unidock_tools/tests/applications/test_proprep.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import os
import shutil
import tempfile
import subprocess
import pytest
#from unidocktools.new_proteinprep import receptor_preprocessor

@pytest.fixture
def pdb_file():
temp_dir = tempfile.mkdtemp()
pdb_file = os.path.join(temp_dir, "protein.pdb")
yield pdb_file
shutil.rmtree(temp_dir)
return os.path.join(os.path.dirname(os.path.dirname(__file__)), "inputs", "protein.pdb")

def test_receptor_processor_app(pdb_file):
protein_pdbqt_file_name = "protein.pdbqt"
cmd = f"unidocktools proteinprep -r {pdb_file} -o {protein_pdbqt_file_name}"
subprocess.run(cmd, shell=True)
assert os.path.isfile(protein_pdbqt_file_name), "PDBQT file was not generated"
os.remove(protein_pdbqt_file_name)
with tempfile.TemporaryDirectory() as work_dir:
cmd = f"unidocktools proteinprep -r {pdb_file} -o {protein_pdbqt_file_name} -H -w {work_dir}"
subprocess.run(cmd, shell=True, cwd=work_dir)
assert os.path.isfile(os.path.join(work_dir, protein_pdbqt_file_name)), "PDBQT file was not generated"


if __name__ == "__main__":
pytest.main([__file__])

0 comments on commit 183dbd8

Please sign in to comment.