Skip to content

Commit

Permalink
onionnet-scft
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Duane Walker authored and Brandon Duane Walker committed May 31, 2024
1 parent 6d5007e commit 35bab23
Show file tree
Hide file tree
Showing 16 changed files with 369 additions and 0 deletions.
29 changes: 29 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[bumpversion]
current_version = 0.1.0
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\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]
4 changes: 4 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.venv
out
tests
__pycache__
2 changes: 2 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pdb filter=lfs diff=lfs merge=lfs -text
*.pdbqt filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry.lock
5 changes: 5 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 0.1.0

Initial release.
19 changes: 19 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 20 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/README.md
Original file line number Diff line number Diff line change
@@ -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 |
1 change: 1 addition & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
87 changes: 87 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/ict.yml
Original file line number Diff line number Diff line change
@@ -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: [email protected], [email protected]
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
119 changes: 119 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/onionnet-sfct.cwl
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions utils/docking/onion-net/onionnet-sfct-tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
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 = [
"."
]
Git LFS file not shown
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for onionnet-sfct."""
Original file line number Diff line number Diff line change
@@ -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()
17 changes: 17 additions & 0 deletions utils/fitting/check-linear-fit-tool/README.md
Original file line number Diff line number Diff line change
@@ -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 |

0 comments on commit 35bab23

Please sign in to comment.