From 616c2189ab49e88e50fe602874dc484a132e1d84 Mon Sep 17 00:00:00 2001 From: Brandon Walker <43654521+misterbrandonwalker@users.noreply.github.com> Date: Wed, 29 May 2024 07:32:36 -0500 Subject: [PATCH] fix-side-chain (#68) Co-authored-by: Brandon Duane Walker --- .../fix-side-chain-tool/.bumpversion.cfg | 29 ++++++++ .../fix-side-chain-tool/.dockerignore | 4 ++ .../fix-side-chain-tool/.gitattributes | 3 + .../fix-side-chain-tool/.gitignore | 1 + .../fix-side-chain-tool/CHANGELOG.md | 5 ++ .../fix-side-chain-tool/README.md | 14 ++++ .../fix-side-chain-tool/VERSION | 1 + .../fix-side-chain-tool/fix_side_chain.cwl | 69 +++++++++++++++++++ .../fix-side-chain-tool/ict.yml | 51 ++++++++++++++ .../fix-side-chain-tool/pyproject.toml | 30 ++++++++ .../fix-side-chain-tool/tests/2ki5.pdb | 3 + .../fix-side-chain-tool/tests/__init__.py | 1 + .../tests/test_fix_side_chain.py | 24 +++++++ 13 files changed, 235 insertions(+) create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/.bumpversion.cfg create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/.dockerignore create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/.gitattributes create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/.gitignore create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/CHANGELOG.md create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/README.md create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/VERSION create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/fix_side_chain.cwl create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/ict.yml create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/pyproject.toml create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/tests/2ki5.pdb create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/tests/__init__.py create mode 100644 utils/pre-process/structure-change/fix-side-chain-tool/tests/test_fix_side_chain.py diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/.bumpversion.cfg b/utils/pre-process/structure-change/fix-side-chain-tool/.bumpversion.cfg new file mode 100644 index 00000000..5499449d --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/.bumpversion.cfg @@ -0,0 +1,29 @@ +[bumpversion] +current_version = 0.1.0 +commit = False +tag = False +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)(?P\d+))? +serialize = + {major}.{minor}.{patch}-{release}{dev} + {major}.{minor}.{patch} + +[bumpversion:part:release] +optional_value = _ +first_value = dev +values = + dev + _ + +[bumpversion:part:dev] + +[bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:VERSION] + +[bumpversion:file:README.md] + +[bumpversion:file:plugin.json] + +[bumpversion:file:src/polus/mm/utils/fix_side_chain/__init__.py] diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/.dockerignore b/utils/pre-process/structure-change/fix-side-chain-tool/.dockerignore new file mode 100644 index 00000000..7c603f81 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/.dockerignore @@ -0,0 +1,4 @@ +.venv +out +tests +__pycache__ diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/.gitattributes b/utils/pre-process/structure-change/fix-side-chain-tool/.gitattributes new file mode 100644 index 00000000..0653a6d1 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/.gitattributes @@ -0,0 +1,3 @@ +*.pdb filter=lfs diff=lfs merge=lfs -text +*.pdbqt filter=lfs diff=lfs merge=lfs -text +*.mol2 filter=lfs diff=lfs merge=lfs -text diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/.gitignore b/utils/pre-process/structure-change/fix-side-chain-tool/.gitignore new file mode 100644 index 00000000..c04bc49f --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/.gitignore @@ -0,0 +1 @@ +poetry.lock diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/CHANGELOG.md b/utils/pre-process/structure-change/fix-side-chain-tool/CHANGELOG.md new file mode 100644 index 00000000..b67793f7 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## 0.1.0 + +Initial release. diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/README.md b/utils/pre-process/structure-change/fix-side-chain-tool/README.md new file mode 100644 index 00000000..f1bd5320 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/README.md @@ -0,0 +1,14 @@ +# fix_side_chain (0.1.0) + +Class to model the missing atoms in amino acid side chains of a PDB. + +## Options + +This plugin takes 3 input arguments and 1 output argument: + +| Name | Description | I/O | Type | Default | +|---------------|-------------------------|--------|--------|---------| +| input_pdb_path | Input PDB file path, Type: string, File type: input, Accepted formats: pdb, Example file: https://github.com/bioexcel/biobb_model/raw/master/biobb_model/test/data/model/2ki5.pdb | Input | File | File | +| output_pdb_path | Output PDB file path, Type: string, File type: output, Accepted formats: pdb, Example file: https://github.com/bioexcel/biobb_model/raw/master/biobb_model/test/reference/model/output_pdb_path.pdb | Input | string | string | +| config | Advanced configuration options for biobb_model FixSideChain. This should be passed as a string containing a dict. The possible options to include here are listed under 'properties' in the biobb_model FixSideChain documentation: https://biobb-model.readthedocs.io/en/latest/model.html#module-model.fix_side_chain | Input | string | string | +| output_pdb_path | Output PDB file path | Output | File | File | diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/VERSION b/utils/pre-process/structure-change/fix-side-chain-tool/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/fix_side_chain.cwl b/utils/pre-process/structure-change/fix-side-chain-tool/fix_side_chain.cwl new file mode 100644 index 00000000..bc1217c4 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/fix_side_chain.cwl @@ -0,0 +1,69 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.0 + +class: CommandLineTool + +label: Class to model the missing atoms in amino acid side chains of a PDB. + +doc: |- + Model the missing atoms in amino acid side chains of a PDB using biobb_structure_checking if the use_modeller property is added the Modeller suite will also be used to rebuild the missing atoms. + +baseCommand: fix_side_chain + +hints: + DockerRequirement: + dockerPull: quay.io/biocontainers/biobb_model:4.0.1--pyhdfd78af_0 + +inputs: + input_pdb_path: + label: Input PDB file path + doc: |- + Input PDB file path + Type: string + File type: input + Accepted formats: pdb + Example file: https://github.com/bioexcel/biobb_model/raw/master/biobb_model/test/data/model/2ki5.pdb + type: File + format: edam:format_1476 + inputBinding: + position: 1 + prefix: --input_pdb_path + + output_pdb_path: + label: Output PDB file path + doc: |- + Output PDB file path + Type: string + File type: output + Accepted formats: pdb + Example file: https://github.com/bioexcel/biobb_model/raw/master/biobb_model/test/reference/model/output_pdb_path.pdb + type: string + format: edam:format_1476 + inputBinding: + position: 2 + prefix: --output_pdb_path + default: system.pdb + + config: + label: Advanced configuration options for biobb_model FixSideChain + doc: |- + Advanced configuration options for biobb_model FixSideChain. This should be passed as a string containing a dict. The possible options to include here are listed under 'properties' in the biobb_model FixSideChain documentation: https://biobb-model.readthedocs.io/en/latest/model.html#module-model.fix_side_chain + type: string? + inputBinding: + prefix: --config + +outputs: + output_pdb_path: + label: Output PDB file path + doc: |- + Output PDB file path + type: File + outputBinding: + glob: $(inputs.output_pdb_path) + format: edam:format_1476 + +$namespaces: + edam: https://edamontology.org/ + +$schemas: +- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/ict.yml b/utils/pre-process/structure-change/fix-side-chain-tool/ict.yml new file mode 100644 index 00000000..9220755b --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/ict.yml @@ -0,0 +1,51 @@ +specVersion: "0.1.0" +name: fix_side_chain +version: 0.1.0 +container: fix-side-chain-tool +entrypoint: +title: fix_side_chain +description: Class to model the missing atoms in amino acid side chains of a PDB. +author: Data Scientist +contact: data.scientist@labshare.org +repository: +documentation: +citation: + +inputs: + - name: input_pdb_path + required: true + description: Input PDB file path, Type string, File type input, Accepted formats pdb, Example file https//github.com/bioexcel/biobb_model/raw/master/biobb_model/test/data/model/2ki5.pdb + type: File + format: + uri: edam:format_1476 + - name: output_pdb_path + required: true + description: Output PDB file path, Type string, File type output, Accepted formats pdb, Example file https//github.com/bioexcel/biobb_model/raw/master/biobb_model/test/reference/model/output_pdb_path.pdb + type: string + defaultValue: system.pdb + format: + uri: edam:format_1476 + - name: config + required: true + description: Advanced configuration options for biobb_model FixSideChain. This should be passed as a string containing a dict. The possible options to include here are listed under 'properties' in the biobb_model FixSideChain documentation https//biobb-model.readthedocs.io/en/latest/model.html#module-model.fix_side_chain + type: string +outputs: + - name: output_pdb_path + required: true + description: Output PDB file path + type: File + format: + uri: edam:format_1476 +ui: + - key: inputs.input_pdb_path + title: "input_pdb_path: " + description: "Input PDB file path, Type string, File type input, Accepted formats pdb, Example file https//github.com/bioexcel/biobb_model/raw/master/biobb_model/test/data/model/2ki5.pdb" + type: File + - key: inputs.output_pdb_path + title: "output_pdb_path: " + description: "Output PDB file path, Type string, File type output, Accepted formats pdb, Example file https//github.com/bioexcel/biobb_model/raw/master/biobb_model/test/reference/model/output_pdb_path.pdb" + type: string + - key: inputs.config + title: "config: " + description: "Advanced configuration options for biobb_model FixSideChain. This should be passed as a string containing a dict. The possible options to include here are listed under 'properties' in the biobb_model FixSideChain documentation https//biobb-model.readthedocs.io/en/latest/model.html#module-model.fix_side_chain" + type: string diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/pyproject.toml b/utils/pre-process/structure-change/fix-side-chain-tool/pyproject.toml new file mode 100644 index 00000000..a1b4e58f --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/pyproject.toml @@ -0,0 +1,30 @@ +[tool.poetry] +name = "polus-mm-utils-fix-side-chain" +version = "0.1.0" +description = "Class to model the missing atoms in amino acid side chains of a PDB." +authors = ["Data Scientist "] +readme = "README.md" + +[tool.poetry.dependencies] +python = ">=3.9,<3.12" +typer = "^0.7.0" +cwl-utils = "0.33" +cwltool = "3.1.20240404144621" + +[tool.poetry.group.dev.dependencies] +bump2version = "^1.0.1" +pytest = "^7.4" +pytest-sugar = "^0.9.6" +pre-commit = "^3.2.1" +black = "^23.3.0" +mypy = "^1.1.1" +ruff = "^0.0.270" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.pytest.ini_options] +pythonpath = [ + "." +] diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/tests/2ki5.pdb b/utils/pre-process/structure-change/fix-side-chain-tool/tests/2ki5.pdb new file mode 100644 index 00000000..6b104a42 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/tests/2ki5.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b57a075a180c2f1656312b10fe7aaeaf3e0c0555180344a35fa9ed1ea40aeab +size 422213 diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/tests/__init__.py b/utils/pre-process/structure-change/fix-side-chain-tool/tests/__init__.py new file mode 100644 index 00000000..8ea82816 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for fix_side_chain.""" diff --git a/utils/pre-process/structure-change/fix-side-chain-tool/tests/test_fix_side_chain.py b/utils/pre-process/structure-change/fix-side-chain-tool/tests/test_fix_side_chain.py new file mode 100644 index 00000000..6a0822c1 --- /dev/null +++ b/utils/pre-process/structure-change/fix-side-chain-tool/tests/test_fix_side_chain.py @@ -0,0 +1,24 @@ +"""Tests for fix_side_chain.""" +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_fix_side_chain() -> None: + """Test fix_side_chain.""" + cwl_file = Path("fix_side_chain.cwl") + input_to_props = parse_cwl_arguments(cwl_file) + file_path_str = "2ki5.pdb" + file_path = str(Path(__file__).resolve().parent / Path(file_path_str)) + input_to_props["input_pdb_path"]["path"] = file_path + input_yaml_path = Path("fix_side_chain.yml") + create_input_yaml(input_to_props, input_yaml_path) + stdout, stderr = call_cwltool(cwl_file, input_yaml_path) + assert Path("system.pdb").exists()