diff --git a/utils/pdbfixer-plugin/tests/test_pdbfixer.py b/utils/pdbfixer-plugin/tests/test_pdbfixer.py deleted file mode 100644 index 2a260bd6..00000000 --- a/utils/pdbfixer-plugin/tests/test_pdbfixer.py +++ /dev/null @@ -1,67 +0,0 @@ -"""Tests for pdbfixer.""" -import sys -from pathlib import Path - -from polus.mm.utils.pdbfixer.pdbfixer import runpdbfixer - -current_dir = Path(__file__).resolve().parent -target_dir = current_dir.parent.parent.parent / "cwl_utils" -sys.path.append(str(target_dir)) - -from cwl_utilities import call_cwltool # noqa: E402 -from cwl_utilities import create_input_yaml # noqa: E402 -from cwl_utilities import parse_cwl_arguments # noqa: E402 - - -def test_pdbfixer() -> None: - """Test pdbfixer.""" - add_atoms = "all" - add_residues = True - pdbid = "" - url = "" - replace_nonstandard = True - keep_heterogens = "all" - input_pdb_path = "1msn_protein.pdb" - input_helper_pdb_path = "1msn_protein.pdb" - input_pdb_path = str(Path(__file__).resolve().parent / Path(input_pdb_path)) - input_helper_pdb_path = str( - Path(__file__).resolve().parent / Path(input_helper_pdb_path), - ) - output_pdb_path = "test.pdb" - output_pdb_path = str(Path(__file__).resolve().parent / Path(output_pdb_path)) - - runpdbfixer( - input_pdb_path, - input_helper_pdb_path, - output_pdb_path, - add_atoms, - add_residues, - pdbid, - url, - replace_nonstandard, - keep_heterogens, - ) - - assert Path(output_pdb_path).exists() - - -def test_cwl_pdb_fixer() -> None: - """Test the pdbfixer function in cwltool.""" - cwl_file = Path("pdb_fixer.cwl") - input_to_props = parse_cwl_arguments(cwl_file) - input_pdb_path = "1msn_protein.pdb" - input_pdb_path = str(Path(__file__).resolve().parent / Path(input_pdb_path)) - input_to_props["input_pdb_path"]["path"] = input_pdb_path - input_to_props["input_pdb_path"]["class"] = "File" - input_helper_pdb_path = "1msn_protein.pdb" - input_helper_pdb_path = str( - Path(__file__).resolve().parent / Path(input_helper_pdb_path), - ) - input_to_props["input_helper_pdb_path"]["path"] = input_helper_pdb_path - input_to_props["input_helper_pdb_path"]["class"] = "File" - input_to_props["output_pdb_path"] = "output.pdb" - input_yaml_path = Path("pdb_fixer.yml") - create_input_yaml(input_to_props, input_yaml_path) - stdout, stderr = call_cwltool(cwl_file, input_yaml_path) - - assert Path("output.pdb").exists() diff --git a/utils/pdbfixer-plugin/.bumpversion.cfg b/utils/pre-process/structure-changes/pdbfixer-tool/.bumpversion.cfg similarity index 100% rename from utils/pdbfixer-plugin/.bumpversion.cfg rename to utils/pre-process/structure-changes/pdbfixer-tool/.bumpversion.cfg diff --git a/utils/pdbfixer-plugin/.dockerignore b/utils/pre-process/structure-changes/pdbfixer-tool/.dockerignore similarity index 100% rename from utils/pdbfixer-plugin/.dockerignore rename to utils/pre-process/structure-changes/pdbfixer-tool/.dockerignore diff --git a/utils/pdbfixer-plugin/.gitignore b/utils/pre-process/structure-changes/pdbfixer-tool/.gitignore similarity index 100% rename from utils/pdbfixer-plugin/.gitignore rename to utils/pre-process/structure-changes/pdbfixer-tool/.gitignore diff --git a/utils/pdbfixer-plugin/CHANGELOG.md b/utils/pre-process/structure-changes/pdbfixer-tool/CHANGELOG.md similarity index 100% rename from utils/pdbfixer-plugin/CHANGELOG.md rename to utils/pre-process/structure-changes/pdbfixer-tool/CHANGELOG.md diff --git a/utils/pdbfixer-plugin/Dockerfile b/utils/pre-process/structure-changes/pdbfixer-tool/Dockerfile similarity index 89% rename from utils/pdbfixer-plugin/Dockerfile rename to utils/pre-process/structure-changes/pdbfixer-tool/Dockerfile index 7111a1a9..ca2a8886 100644 --- a/utils/pdbfixer-plugin/Dockerfile +++ b/utils/pre-process/structure-changes/pdbfixer-tool/Dockerfile @@ -1,4 +1,4 @@ -# docker build -f Dockerfile -t mrbrandonwalker/pdbfixer . +# docker build -f Dockerfile -t polusai/pdbfixer-tool:0.1.0 . FROM condaforge/mambaforge # pdbfixer not installable with poetry diff --git a/utils/pdbfixer-plugin/README.md b/utils/pre-process/structure-changes/pdbfixer-tool/README.md similarity index 100% rename from utils/pdbfixer-plugin/README.md rename to utils/pre-process/structure-changes/pdbfixer-tool/README.md diff --git a/utils/pdbfixer-plugin/VERSION b/utils/pre-process/structure-changes/pdbfixer-tool/VERSION similarity index 100% rename from utils/pdbfixer-plugin/VERSION rename to utils/pre-process/structure-changes/pdbfixer-tool/VERSION diff --git a/utils/pre-process/structure-changes/pdbfixer-tool/build-docker.sh b/utils/pre-process/structure-changes/pdbfixer-tool/build-docker.sh new file mode 100644 index 00000000..fe5c781d --- /dev/null +++ b/utils/pre-process/structure-changes/pdbfixer-tool/build-docker.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +version=$( None: + """Test pdbfixer.""" + add_atoms = "all" + add_residues = True + pdbid = "" + url = "" + replace_nonstandard = True + keep_heterogens = "all" + input_pdb_path = "1msn_protein.pdb" + input_helper_pdb_path = "1msn_protein.pdb" + input_pdb_path = str(Path(__file__).resolve().parent / Path(input_pdb_path)) + input_helper_pdb_path = str( + Path(__file__).resolve().parent / Path(input_helper_pdb_path), + ) + output_pdb_path = "test.pdb" + output_pdb_path = str(Path(__file__).resolve().parent / Path(output_pdb_path)) + + runpdbfixer( + input_pdb_path, + input_helper_pdb_path, + output_pdb_path, + add_atoms, + add_residues, + pdbid, + url, + replace_nonstandard, + keep_heterogens, + ) + + assert Path(output_pdb_path).exists() + + +def test_cwl_pdb_fixer() -> None: + """Test the pdbfixer function in cwltool.""" + cwl_file = Path("pdb_fixer_0@1@0.cwl") + + # Create a Step instance + pdb_fixer_step = Step(clt_path=cwl_file) + + # Define input paths and parameters + input_pdb_path = str(Path(__file__).resolve().parent / "1msn_protein.pdb") + input_helper_pdb_path = str(Path(__file__).resolve().parent / "1msn_protein.pdb") + output_pdb_path = "output.pdb" + + # Assign inputs to the step + pdb_fixer_step.input_pdb_path = input_pdb_path + pdb_fixer_step.input_helper_pdb_path = input_helper_pdb_path + pdb_fixer_step.output_pdb_path = output_pdb_path + + # Create a Workflow instance + steps = [pdb_fixer_step] + viz = Workflow(steps, "pdb_fixer") + + # Run the workflow + viz.run() + + # Check if the expected output file exists + outdir = Path("outdir") + files = list(outdir.rglob(output_pdb_path)) + + assert ( + files + ), f"The file '{output_pdb_path}' does not exist in any subdirectory of '{outdir}'."