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

refactor pdbfixer #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 0 additions & 25 deletions utils/pdbfixer-plugin/Dockerfile

This file was deleted.

67 changes: 0 additions & 67 deletions utils/pdbfixer-plugin/tests/test_pdbfixer.py

This file was deleted.

31 changes: 31 additions & 0 deletions utils/pre-process/structure-change/pdbfixer-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# docker build -f Dockerfile -t polusai/pdbfixer-tool .

FROM condaforge/mambaforge

ENV EXEC_DIR="/opt/executables"
ENV POLUS_LOG="INFO"
RUN mkdir -p ${EXEC_DIR}


# Work directory defined in the base container
# WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY CHANGELOG.md ${EXEC_DIR}

# Install needed packages here
# errors installing pdbfixer from poetry so using conda
COPY environment.yml ${EXEC_DIR}
RUN mamba env create -f ${EXEC_DIR}/environment.yml
RUN echo "source activate project_env" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH

COPY src ${EXEC_DIR}/src

ADD Dockerfile .

RUN conda run -n project_env pip install ${EXEC_DIR} --no-cache-dir

CMD ["--help"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This plugin takes 9 input arguments and 1 output argument:
| input_helper_pdb_path | Template input PDB path | Input | File | File |
| pdbid | PDB id from RCSB? | Input | string | string |
| url | URL to retrieve PDB from | Input | string | string |
| output_pdb_path | | Input | string | string |
| output_pdb_path | Output protein file path name | Input | string | string |
| add_atoms | What missing atoms to add, all, heavy or none | Input | string | string |
| add_residues | If set to True, adds missing residue | Input | boolean | boolean |
| replace_nonstandard | Replace nonstandard residues with standard equivalents | Input | boolean | boolean |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ dependencies:
- pdbfixer==1.9
- ruamel.yaml==0.17.21
- pytest==8.1.1
- cwltool==3.1.20240404144621
- cwl-utils==0.33
- pip
- pip:
- sophios==0.1.1
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
specVersion: 0.1.0
name: labshare/pdbfixer
version: 0.1.0
container: polusai/pdbfixer-plugin:0.1.0
container: polusai/pdbfixer-tool:0.1.0
entrypoint: ""
title: pdbfixer
description: Fix pdbfiles.
author: Data Scientist ([email protected])
author: Brandon Walker, Nazanin Donyapour
contact: [email protected], [email protected]
repository: https://github.com/labshare/mmtools
documentation: https://ncats.nih.gov/preclinical/core/informatics
citation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ baseCommand: ["python", "-m", "polus.mm.utils.pdbfixer"]

hints:
DockerRequirement:
dockerPull: mrbrandonwalker/pdbfixer
dockerPull: polusai/pdbfixer-tool@sha256:8c4c7756a3981799da1b7699a471be59684890c365fa4e30c62c96d256eb089f

inputs:
input_pdb_path:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""Tests for pdbfixer."""
from pathlib import Path

from polus.mm.utils.pdbfixer.pdbfixer import runpdbfixer
from sophios.api.pythonapi import Step
from sophios.api.pythonapi import Workflow


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_str = "pdb_fixer_0@[email protected]"
cwl_file = Path(__file__).resolve().parent / Path(cwl_file_str)
# Create a Step instance for pdb_fixer
pdb_fixer = Step(clt_path=cwl_file)

# Set input properties
pdb_fixer.input_pdb_path = str(Path(__file__).resolve().parent / "1msn_protein.pdb")
pdb_fixer.input_helper_pdb_path = str(
Path(__file__).resolve().parent / "1msn_protein.pdb",
)
pdb_fixer.output_pdb_path = "output.pdb"

# Define the workflow
steps = [pdb_fixer]
filename = "pdb_fixer"
workflow = Workflow(steps, filename)

# Run the workflow
workflow.run()

# Check if the output file exists
assert Path("output.pdb").exists(), "The file 'output.pdb' does not exist."
Loading