diff --git a/utils/array-indices-plugin/tests/test_array_indices.py b/utils/array-indices-plugin/tests/test_array_indices.py deleted file mode 100644 index 4b51f9f5..00000000 --- a/utils/array-indices-plugin/tests/test_array_indices.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Tests for array_indices.""" -import json -import sys -from pathlib import Path - -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_array_indices() -> None: - """Test array_indices.""" - cwl_file = Path("array_indices.cwl") - input_to_props = parse_cwl_arguments(cwl_file) - input_to_props["input_indices"] = [1, 3] - input_to_props["input_array"] = [1, 2, 3, 4, 5] - input_yaml_path = Path("array_indices.yml") - create_input_yaml(input_to_props, input_yaml_path) - stdout, stderr = call_cwltool(cwl_file, input_yaml_path) - output_data = json.loads(stdout) - output_array = output_data["output_array"] - assert output_array == [2, 4] diff --git a/utils/array-indices-plugin/.bumpversion.cfg b/utils/post-process/array-subset/array-indices-tool/.bumpversion.cfg similarity index 100% rename from utils/array-indices-plugin/.bumpversion.cfg rename to utils/post-process/array-subset/array-indices-tool/.bumpversion.cfg diff --git a/utils/array-indices-plugin/.dockerignore b/utils/post-process/array-subset/array-indices-tool/.dockerignore similarity index 100% rename from utils/array-indices-plugin/.dockerignore rename to utils/post-process/array-subset/array-indices-tool/.dockerignore diff --git a/utils/array-indices-plugin/.gitignore b/utils/post-process/array-subset/array-indices-tool/.gitignore similarity index 100% rename from utils/array-indices-plugin/.gitignore rename to utils/post-process/array-subset/array-indices-tool/.gitignore diff --git a/utils/array-indices-plugin/CHANGELOG.md b/utils/post-process/array-subset/array-indices-tool/CHANGELOG.md similarity index 100% rename from utils/array-indices-plugin/CHANGELOG.md rename to utils/post-process/array-subset/array-indices-tool/CHANGELOG.md diff --git a/utils/array-indices-plugin/README.md b/utils/post-process/array-subset/array-indices-tool/README.md similarity index 100% rename from utils/array-indices-plugin/README.md rename to utils/post-process/array-subset/array-indices-tool/README.md diff --git a/utils/array-indices-plugin/VERSION b/utils/post-process/array-subset/array-indices-tool/VERSION similarity index 100% rename from utils/array-indices-plugin/VERSION rename to utils/post-process/array-subset/array-indices-tool/VERSION diff --git a/utils/array-indices-plugin/array_indices.cwl b/utils/post-process/array-subset/array-indices-tool/array_indices_0@1@0.cwl similarity index 100% rename from utils/array-indices-plugin/array_indices.cwl rename to utils/post-process/array-subset/array-indices-tool/array_indices_0@1@0.cwl diff --git a/utils/array-indices-plugin/ict.yml b/utils/post-process/array-subset/array-indices-tool/ict.yml similarity index 82% rename from utils/array-indices-plugin/ict.yml rename to utils/post-process/array-subset/array-indices-tool/ict.yml index b6f3974c..bc449300 100644 --- a/utils/array-indices-plugin/ict.yml +++ b/utils/post-process/array-subset/array-indices-tool/ict.yml @@ -1,12 +1,12 @@ specVersion: "0.1.0" name: array_indices version: 0.1.0 -container: array-indices-plugin +container: array-indices-tool entrypoint: title: array_indices description: return a subset from a array based on input indices -author: Data Scientist -contact: data.scientist@labshare.org +author: Brandon Walker, Nazanin Donyapour +contact: brandon.walker@axleinfo.com, nazanin.donyapour@axleinfo.com repository: documentation: citation: diff --git a/utils/array-indices-plugin/pyproject.toml b/utils/post-process/array-subset/array-indices-tool/pyproject.toml similarity index 92% rename from utils/array-indices-plugin/pyproject.toml rename to utils/post-process/array-subset/array-indices-tool/pyproject.toml index 2b1802b9..caaf5c38 100644 --- a/utils/array-indices-plugin/pyproject.toml +++ b/utils/post-process/array-subset/array-indices-tool/pyproject.toml @@ -8,8 +8,7 @@ readme = "README.md" [tool.poetry.dependencies] python = ">=3.9,<3.12" typer = "^0.7.0" -cwl-utils = "0.33" -cwltool = "3.1.20240404144621" +sophios = "0.1.1" [tool.poetry.group.dev.dependencies] bump2version = "^1.0.1" diff --git a/utils/array-indices-plugin/tests/__init__.py b/utils/post-process/array-subset/array-indices-tool/tests/__init__.py similarity index 100% rename from utils/array-indices-plugin/tests/__init__.py rename to utils/post-process/array-subset/array-indices-tool/tests/__init__.py diff --git a/utils/post-process/array-subset/array-indices-tool/tests/test_array_indices.py b/utils/post-process/array-subset/array-indices-tool/tests/test_array_indices.py new file mode 100644 index 00000000..a3cdfa88 --- /dev/null +++ b/utils/post-process/array-subset/array-indices-tool/tests/test_array_indices.py @@ -0,0 +1,26 @@ +"""Tests for array_indices.""" +from pathlib import Path + +from sophios.api.pythonapi import Step +from sophios.api.pythonapi import Workflow + + +def test_array_indices() -> None: + """Test array_indices.""" + # Define paths and input properties + cwl_file_str = "array_indices_0@1@0.cwl" + cwl_file = Path(__file__).resolve().parent.parent / Path(cwl_file_str) + input_props = {"input_indices": [1, 3], "input_array": [1, 2, 3, 4, 5]} + + # Create the CWL step + array_indices_step = Step(clt_path=cwl_file) + array_indices_step.input_indices = input_props["input_indices"] + array_indices_step.input_array = input_props["input_array"] + + # Create the workflow and run it + steps = [array_indices_step] + filename = "array_indices_workflow" + workflow = Workflow(steps, filename) + workflow.run() + + # cant process the output since no way to grab stdout