-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brandon Duane Walker
authored and
Brandon Duane Walker
committed
May 31, 2024
1 parent
6d5007e
commit 35bab23
Showing
16 changed files
with
369 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
utils/docking/onion-net/onionnet-sfct-tool/.bumpversion.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.venv | ||
out | ||
tests | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
poetry.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# CHANGELOG | ||
|
||
## 0.1.0 | ||
|
||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
119
utils/docking/onion-net/onionnet-sfct-tool/onionnet-sfct.cwl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [ | ||
"." | ||
] |
3 changes: 3 additions & 0 deletions
3
utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_ligand.pdb
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
utils/docking/onion-net/onionnet-sfct-tool/tests/5uv2_protein.pdb
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Tests for onionnet-sfct.""" |
29 changes: 29 additions & 0 deletions
29
utils/docking/onion-net/onionnet-sfct-tool/tests/test_onionnet_sfct.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |