Skip to content

Commit

Permalink
refactor combine structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Duane Walker authored and misterbrandonwalker committed Jul 30, 2024
1 parent b3f4953 commit c340772
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 26 deletions.
4 changes: 0 additions & 4 deletions utils/combine-structure-plugin/build-docker.sh

This file was deleted.

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/combine_structure_tool .
# docker build -f Dockerfile -t polusai/combine-structure-tool .
FROM condaforge/mambaforge

ENV EXEC_DIR="/opt/executables"
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/combine-structure-tool:${version}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ baseCommand: ["conda", "run", "-n", "project_env", "python", "-m", "polus.mm.uti

hints:
DockerRequirement:
dockerPull: mrbrandonwalker/combine_structure_tool
dockerPull: polusai/combine-structure-tool@sha256:860eac0403aaadc1d76a46ba1cb47e359f05338af6fc7be47ccb495f86764de0

inputs:
input_structure1:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
specVersion: "0.1.0"
name: combine_structure
version: 0.1.0
container: combine-structure-plugin
container: combine-structure-tool
entrypoint:
title: combine_structure
description: A tool that employs RDKit to combine two XYZ structures in a single PDB file.
author: Data Scientist
contact: [email protected]
author: Brandon Walker, Nazanin Donyapour
contact: [email protected], [email protected]
repository:
documentation:
citation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
typer = "^0.7.0"
python = ">=3.9,<3.12"
sophios = "0.1.1"
rdkit = "2024.3.3"

[tool.poetry.group.dev.dependencies]
bump2version = "^1.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
"""Tests for combine_structure."""
import sys
from pathlib import Path

from polus.mm.utils.combine_structure.combine_structure import combine_structure

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
from sophios.api.pythonapi import Step
from sophios.api.pythonapi import Workflow


def test_combine_structure() -> None:
Expand All @@ -24,16 +17,25 @@ def test_combine_structure() -> None:

def test_combine_structure_cwl() -> None:
"""Test combine_structure CWL."""
# Define paths and input properties
input_structure1 = Path(__file__).resolve().parent / Path("5umx_protein.xyz")
input_structure2 = Path(__file__).resolve().parent / Path("5umx_ligand.xyz")
output_structure_path = "combined_structure.xyz"
cwl_file_str = "combine_structure.cwl"
cwl_file_str = "combine_structure_0@1@0.cwl"
cwl_file = Path(__file__).resolve().parent.parent / Path(cwl_file_str)
input_to_props = parse_cwl_arguments(cwl_file)
input_to_props["input_structure1"]["path"] = str(input_structure1)
input_to_props["input_structure2"]["path"] = str(input_structure2)
input_yaml_path = Path("combine_structure.yml")
create_input_yaml(input_to_props, input_yaml_path)
call_cwltool(cwl_file, input_yaml_path)

# Create the CWL step
combine_structure_step = Step(clt_path=cwl_file)
combine_structure_step.input_structure1 = str(input_structure1)
combine_structure_step.input_structure2 = str(input_structure2)
combine_structure_step.output_structure_path = "system.pdb"

# Create the workflow and run it
steps = [combine_structure_step]
filename = "combine_structure_workflow"
workflow = Workflow(steps, filename)
workflow.run()

# Check for the expected output
assert Path(output_structure_path).exists()
Path(output_structure_path).unlink()
Path(output_structure_path).unlink() # Clean up the output file

0 comments on commit c340772

Please sign in to comment.