Skip to content

Commit

Permalink
pdb_fixer clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Duane Walker authored and misterbrandonwalker committed Aug 5, 2024
1 parent 6b3ed2b commit dcded8d
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 73 deletions.
67 changes: 0 additions & 67 deletions utils/pdbfixer-plugin/tests/test_pdbfixer.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

version=$(<VERSION)
docker build . -t polusai/pdbfixer-tool:${version}
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:a44142a9b23b60950bdc2cb7d6c760f4216cc7f59dad0468f92ff87a976f3ab2

inputs:
input_pdb_path:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""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 = Path("pdb_fixer_0@[email protected]")

# 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}'."

0 comments on commit dcded8d

Please sign in to comment.