diff --git a/utils/docking/onion-net/onionnet-sfct-tool/.bumpversion.cfg b/utils/docking/onion-net/onionnet-sfct-tool/.bumpversion.cfg new file mode 100644 index 00000000..71c7199d --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-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/onionnet-sfct/__init__.py] diff --git a/utils/docking/onion-net/onionnet-sfct-tool/.dockerignore b/utils/docking/onion-net/onionnet-sfct-tool/.dockerignore new file mode 100644 index 00000000..7c603f81 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/.dockerignore @@ -0,0 +1,4 @@ +.venv +out +tests +__pycache__ diff --git a/utils/docking/onion-net/onionnet-sfct-tool/.gitattributes b/utils/docking/onion-net/onionnet-sfct-tool/.gitattributes new file mode 100644 index 00000000..2fb87472 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/.gitattributes @@ -0,0 +1,2 @@ +*.pdb filter=lfs diff=lfs merge=lfs -text +*.pdbqt filter=lfs diff=lfs merge=lfs -text diff --git a/utils/docking/onion-net/onionnet-sfct-tool/.gitignore b/utils/docking/onion-net/onionnet-sfct-tool/.gitignore new file mode 100644 index 00000000..c04bc49f --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/.gitignore @@ -0,0 +1 @@ +poetry.lock diff --git a/utils/docking/onion-net/onionnet-sfct-tool/CHANGELOG.md b/utils/docking/onion-net/onionnet-sfct-tool/CHANGELOG.md new file mode 100644 index 00000000..b67793f7 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## 0.1.0 + +Initial release. diff --git a/utils/docking/onion-net/onionnet-sfct-tool/Dockerfile b/utils/docking/onion-net/onionnet-sfct-tool/Dockerfile new file mode 100644 index 00000000..b7ce3f3a --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/Dockerfile @@ -0,0 +1,19 @@ +# docker build -f Dockerfile -t mrbrandonwalker/onionnet-sfct-tool . +FROM condaforge/mambaforge + +RUN apt-get update && apt-get install -y wget git + +RUN mamba install -c conda-forge openbabel numpy pandas mdtraj biopandas -y + +# model saved required scikit-learn==1.0.2 +RUN pip install -U scikit-learn==1.0.2 rdkit-pypi + +RUN git clone https://github.com/zhenglz/OnionNet-SFCT.git + +WORKDIR /OnionNet-SFCT + +RUN mkdir -p data && cd data && wget -nv --no-clobber https://huggingface.co/cyangNYU/OnionNet-SFCT-final-model/resolve/main/sfct_std_final.model + +ADD Dockerfile . + +CMD ["--help"] diff --git a/utils/docking/onion-net/onionnet-sfct-tool/README.md b/utils/docking/onion-net/onionnet-sfct-tool/README.md new file mode 100644 index 00000000..a07436b5 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/README.md @@ -0,0 +1,20 @@ +# onionnet-sfct (0.1.0) + +OnionNet-SFCT tool for rescoring of docking poses + +## Options + +This plugin takes 6 input arguments and 4 output argument: + +| Name | Description | I/O | Type | Default | +|---------------|-------------------------|--------|--------|---------| +| receptor_path | Receptor file | Input | File | File | +| ligand_path | Ligand file | Input | File | File | +| model_path | model file | Input | string | string | +| pose_type | Type of pose ("vina", "smina", "gnina", "idock", "ledock") | Input | string | string | +| output_score_path | Output score filename | Input | string | string | +| output_path | Output file path | Input | string | string | +| output_score_path | Output score file | Output | File | File | +| output_path | Output file | Output | File | File | +| output_docking_score | Estimated Free Energy of Binding | Output | float | float | +| output_poses_rescore | Estimated Free Energy of Binding | Output | float | float | diff --git a/utils/docking/onion-net/onionnet-sfct-tool/VERSION b/utils/docking/onion-net/onionnet-sfct-tool/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/utils/docking/onion-net/onionnet-sfct-tool/ict.yml b/utils/docking/onion-net/onionnet-sfct-tool/ict.yml new file mode 100644 index 00000000..fbbe0ec3 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/ict.yml @@ -0,0 +1,87 @@ +specVersion: "0.1.0" +name: onionnet-sfct +version: 0.1.0 +container: onionnet-sfct-tool +entrypoint: +title: onionnet-sfct +description: OnionNet-SFCT tool for rescoring of docking poses +author: Brandon Walker, Nazanin Donyapour +contact: brandon.walker@axleinfo.com, nazanin.donyapour@axleinfo.com +repository: +documentation: +citation: + +inputs: + - name: receptor_path + required: true + description: + type: File + format: + uri: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816 + - name: ligand_path + required: true + description: + type: File + format: + uri: edam:format_1476 + - name: model_path + required: true + description: + type: string + defaultValue: /OnionNet-SFCT/data/sfct_std_final.model + - name: pose_type + required: true + description: + type: string + defaultValue: vina + - name: output_score_path + required: true + description: + type: string + defaultValue: sfct.txt + - name: output_path + required: true + description: + type: string +outputs: + - name: output_score_path + required: true + description: + type: File + - name: output_path + required: true + description: + type: File + - name: output_docking_score + required: true + description: Estimated Free Energy of Binding + type: float + - name: output_poses_rescore + required: true + description: Estimated Free Energy of Binding + type: float +ui: + - key: inputs.receptor_path + title: "receptor_path: " + description: "" + type: File + - key: inputs.ligand_path + title: "ligand_path: " + description: "" + type: File + - key: inputs.model_path + title: "model_path: " + description: "" + type: string + - key: inputs.pose_type + title: "pose_type: " + description: "" + type: string + - key: inputs.output_score_path + title: "output_score_path: " + description: "" + type: string + - key: inputs.output_path + title: "output_path: " + description: "" + type: string diff --git a/utils/docking/onion-net/onionnet-sfct-tool/onionnet-sfct.cwl b/utils/docking/onion-net/onionnet-sfct-tool/onionnet-sfct.cwl new file mode 100644 index 00000000..ab6dc52a --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/onionnet-sfct.cwl @@ -0,0 +1,119 @@ +#!/usr/bin/env cwl-runner + +cwlVersion: v1.0 +class: CommandLineTool + +label: OnionNet-SFCT tool for rescoring of docking poses + +baseCommand: ["python", "/OnionNet-SFCT/scorer.py"] + +hints: + DockerRequirement: + dockerPull: mrbrandonwalker/onionnet-sfct-tool + +requirements: + InlineJavascriptRequirement: {} + +inputs: + + receptor_path: + label: receptor structure in in pdb, pdbqt, mol, mol2, sdf format + type: File? + format: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816 + inputBinding: + prefix: -r + + ligand_path: + label: ligand docking poses structure in pdb or pdbqt format. + type: File? + format: edam:format_1476 + inputBinding: + prefix: -l + + model_path: + label: OnionNet-SFCT final model + type: string? + inputBinding: + prefix: --model + default: "/OnionNet-SFCT/data/sfct_std_final.model" + + pose_type: + label: docking poses type, can be ["vina", "smina", "gnina", "idock", "ledock"] + type: string? + inputBinding: + prefix: --stype + default: "vina" + + output_score_path: + label: text file contains docking_score and onionnet_rescore for each pose + type: string? + inputBinding: + prefix: -o + default: "sfct.txt" + +# Is this still necessary? + output_path: + type: string + +outputs: + + output_score_path: + type: File + outputBinding: + glob: $(inputs.output_score_path) + + output_path: + type: File + outputBinding: + glob: $(inputs.output_path) + + output_docking_score: + label: Estimated Free Energy of Binding (docking score) + doc: |- + Estimated Free Energy of Binding + type: float + outputBinding: + glob: $(inputs.output_score_path) + loadContents: true + outputEval: | + ${ + const lines = self[0].contents.split("\n"); + // The correct line should be of the form + // # name pose_index origin_score combined_score sfct + // docked_vina.pdb 0 -10.365 -4.137 2.090 + // pose_1 1 -9.973 -3.509 2.956 + const bfe_line = lines[1]; + const docking_score_string = bfe_line.split(" ").filter(function(s) {return !isNaN(parseFloat(s))})[1]; + const output_docking_score = parseFloat(docking_score_string); + return output_docking_score + } + + output_poses_rescore: + label: Estimated Free Energy of Binding (onionnet rescore) + doc: |- + Estimated Free Energy of Binding + type: float + outputBinding: + glob: $(inputs.output_score_path) + loadContents: true + outputEval: | + ${ + const lines = self[0].contents.split("\n"); + // The correct line should be of the form + // # name pose_index origin_score combined_score sfct + // docked_vina.pdb 0 -10.365 -4.137 2.090 + // pose_1 1 -9.973 -3.509 2.956 + const bfe_line = lines[1]; + const docking_score_string = bfe_line.split(" ").filter(function(s) {return !isNaN(parseFloat(s))})[2]; + const output_poses_rescore = parseFloat(docking_score_string); + return output_poses_rescore + } + +stdout: $(inputs.output_path) + +$namespaces: + edam: https://edamontology.org/ + cwltool: http://commonwl.org/cwltool# + +$schemas: +- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl diff --git a/utils/docking/onion-net/onionnet-sfct-tool/pyproject.toml b/utils/docking/onion-net/onionnet-sfct-tool/pyproject.toml new file mode 100644 index 00000000..307593ce --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/pyproject.toml @@ -0,0 +1,29 @@ +[tool.poetry] +name = "polus-mm-utils-onionnet-sfct" +version = "0.1.0" +description = "OnionNet-SFCT tool for rescoring of docking poses" +authors = ["Data Scientist "] +readme = "README.md" + +[tool.poetry.dependencies] +python = ">=3.9,<3.12" +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/docking/onion-net/onionnet-sfct-tool/tests/5uv2_ligand.pdb b/utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_ligand.pdb new file mode 100644 index 00000000..2e6fddf5 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_ligand.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05f1bf0be20fd7307479f243c7973bc48190d6bca6894d517a7c25f574071b62 +size 8238 diff --git a/utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_protein.pdb b/utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_protein.pdb new file mode 100644 index 00000000..762627b7 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_protein.pdb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a444060685900dbe521491c12a378eaccdfd0565eb128ec22ddfcb3f5e1f5957 +size 425797 diff --git a/utils/docking/onion-net/onionnet-sfct-tool/tests/__init__.py b/utils/docking/onion-net/onionnet-sfct-tool/tests/__init__.py new file mode 100644 index 00000000..6076fc76 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for onionnet-sfct.""" diff --git a/utils/docking/onion-net/onionnet-sfct-tool/tests/test_onionnet_sfct.py b/utils/docking/onion-net/onionnet-sfct-tool/tests/test_onionnet_sfct.py new file mode 100644 index 00000000..44fa9365 --- /dev/null +++ b/utils/docking/onion-net/onionnet-sfct-tool/tests/test_onionnet_sfct.py @@ -0,0 +1,29 @@ +"""Tests for onionnet-sfct.""" +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_onionnet_sfct() -> None: + """Test onionnet-sfct.""" + cwl_file = Path("onionnet-sfct.cwl") + input_to_props = parse_cwl_arguments(cwl_file) + file_path_str = "5uv2_protein.pdb" + file_path = str(Path(__file__).resolve().parent / Path(file_path_str)) + input_to_props["receptor_path"]["path"] = file_path + input_to_props["receptor_path"]["class"] = "File" + file_path_str = "5uv2_ligand.pdb" + file_path = str(Path(__file__).resolve().parent / Path(file_path_str)) + input_to_props["ligand_path"]["path"] = file_path + input_to_props["ligand_path"]["class"] = "File" + input_yaml_path = Path("onionnet-sfct.yml") + create_input_yaml(input_to_props, input_yaml_path) + stdout, stderr = call_cwltool(cwl_file, input_yaml_path) + assert Path("system.mol2").exists() diff --git a/utils/fitting/check-linear-fit-tool/README.md b/utils/fitting/check-linear-fit-tool/README.md new file mode 100644 index 00000000..4db3c504 --- /dev/null +++ b/utils/fitting/check-linear-fit-tool/README.md @@ -0,0 +1,17 @@ +# check_linear_fit (0.1.0) + +check_linear_fit + +## Options + +This plugin takes 6 input arguments and 1 output argument: + +| Name | Description | I/O | Type | Default | +|---------------|-------------------------|--------|--------|---------| +| script | | Input | string | string | +| xs | | Input | {'type': 'array', 'items': 'float'} | {'type': 'array', 'items': 'float'} | +| ys | | Input | {'type': 'array', 'items': 'float'} | {'type': 'array', 'items': 'float'} | +| tol_quad | | Input | float | float | +| slope_min | | Input | float | float | +| slope_max | | Input | float | float | +| success | | Output | boolean | boolean |