Skip to content

Commit

Permalink
smina
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Duane Walker authored and Brandon Duane Walker committed Jun 11, 2024
1 parent 6d5007e commit ff7e360
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 0 deletions.
29 changes: 29 additions & 0 deletions utils/docking/smina/smina-docking-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/smina_docking/__init__.py]
4 changes: 4 additions & 0 deletions utils/docking/smina/smina-docking-tool/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.venv
out
tests
__pycache__
5 changes: 5 additions & 0 deletions utils/docking/smina/smina-docking-tool/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.pdb filter=lfs diff=lfs merge=lfs -text
*.pdbqt filter=lfs diff=lfs merge=lfs -text
*.mol2 filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.sdf filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions utils/docking/smina/smina-docking-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/smina/smina-docking-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/smina/smina-docking-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# docker build -f Dockerfile -t polusai/smina-tool .
FROM condaforge/mambaforge-pypy3

# Prevent being prompted for geographical region
ARG DEBIAN_FRONTEND=noninteractive

# Install essential packages
RUN apt-get update && apt-get install -y git build-essential libboost-all-dev libopenbabel-dev libeigen3-dev cmake
ENV PATH="${PATH}:/smina-code/build"

# Download Smina code and compile binary
## The URL (https://github.com/mwojcikowski/smina) is the Smina repo in GitHub and final updated in 2018
## The URL (https://git.code.sf.net/p/smina/code) is the Smina repo in original SourceForge \
## (https://sourceforge.net/p/smina/code/ci/master/tree/) and final updated in 2021.
RUN git clone https://git.code.sf.net/p/smina/code smina-code && \
cd smina-code && mkdir build && cd build && cmake .. && make -j12

RUN echo "alias smina=/smina-code/build/smina" >> ~/.bashrc
ADD Dockerfile .
18 changes: 18 additions & 0 deletions utils/docking/smina/smina-docking-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# smina_docking (0.1.0)

Smina docking tool to perform protein-ligand docking

## Options

This plugin takes 6 input arguments and 2 output argument:

| Name | Description | I/O | Type | Default |
|---------------|-------------------------|--------|--------|---------|
| receptor_file | Path to the input receptor file, Type: string?, File type: input, Accepted formats: pdb, pdbqt, sdf, mol, mol2 | Input | File | File |
| ligand_file | Path to the input ligand file, Type: string?, File type: input, Accepted formats: pdb, pdbqt, sdf, mol, mol2 | Input | File | File |
| ligand_box | Path to the input docking box file, Type: string?, File type: input, Accepted formats: pdb, pdbqt, sdf, mol, mol2 | Input | File | File |
| scoring | Which scoring function to use, can be vina, vinardo, or a customized scoring function | Input | string | string |
| output_dock_file | Output dock filename, contains docking poses | Input | string | string |
| output_path | Output file name | Input | string | string |
| output_dock_file | Output dock file, contains docking poses | Output | File | File |
| output_path | Output file | Output | File | File |
1 change: 1 addition & 0 deletions utils/docking/smina/smina-docking-tool/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
84 changes: 84 additions & 0 deletions utils/docking/smina/smina-docking-tool/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
specVersion: "0.1.0"
name: smina_docking
version: 0.1.0
container: smina-docking-tool
entrypoint:
title: smina_docking
description: Smina docking tool to perform protein-ligand docking
author: Brandon Walker, Nazanin Donyapour
contact: [email protected], [email protected]
repository:
documentation:
citation:

inputs:
- name: receptor_file
required: true
description: Path to the input receptor file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2
type: File
format:
uri: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
- name: ligand_file
required: true
description: Path to the input ligand file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2
type: File
format:
uri: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
- name: ligand_box
required: true
description: Path to the input docking box file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2
type: File
format:
uri: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
- name: scoring
required: true
description:
type: string
defaultValue: vina
- name: output_dock_file
required: true
description:
type: string
defaultValue: docked.pdb
format:
uri: edam:format_1476
- name: output_path
required: true
description:
type: string
outputs:
- name: output_dock_file
required: true
description:
type: File
format:
uri: edam:format_1476
- name: output_path
required: true
description:
type: File
ui:
- key: inputs.receptor_file
title: "receptor_file: "
description: "Path to the input receptor file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2"
type: File
- key: inputs.ligand_file
title: "ligand_file: "
description: "Path to the input ligand file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2"
type: File
- key: inputs.ligand_box
title: "ligand_box: "
description: "Path to the input docking box file, Type string?, File type input, Accepted formats pdb, pdbqt, sdf, mol, mol2"
type: File
- key: inputs.scoring
title: "scoring: "
description: ""
type: string
- key: inputs.output_dock_file
title: "output_dock_file: "
description: ""
type: string
- key: inputs.output_path
title: "output_path: "
description: ""
type: string
30 changes: 30 additions & 0 deletions utils/docking/smina/smina-docking-tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tool.poetry]
name = "polus-mm-utils-smina-docking"
version = "0.1.0"
description = "Smina docking tool to perform protein-ligand docking"
authors = ["Data Scientist <[email protected]>"]
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 = [
"."
]
103 changes: 103 additions & 0 deletions utils/docking/smina/smina-docking-tool/smina_docking_0.1.0.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool

label: Smina docking tool to perform protein-ligand docking

baseCommand: ["smina"]

hints:
DockerRequirement:
dockerPull: polusai/smina-tool@sha256:c75dab4e45a2881ada98b10679f3fde27ed9948a673192bcf0acf942417c8631

requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing:
- $(inputs.ligand_file)

inputs:

receptor_file:
label: receptor structure.
doc: |-
Path to the input receptor file
Type: string?
File type: input
Accepted formats: pdb, pdbqt, sdf, mol, mol2
type: File?
format: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
inputBinding:
position: 1
prefix: -r

ligand_file:
label: ligand structure.
doc: |-
Path to the input ligand file
Type: string?
File type: input
Accepted formats: pdb, pdbqt, sdf, mol, mol2
type: File?
format: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
inputBinding:
position: 2
prefix: -l

ligand_box:
label: 3D structure to define ligand box center and size
doc: |-
Path to the input docking box file
Type: string?
File type: input
Accepted formats: pdb, pdbqt, sdf, mol, mol2
type: File?
format: edam:format_1476, edam:format_3814, edam:format_3815, edam:format_3816
inputBinding:
position: 3
prefix: --autobox_ligand

scoring:
label: scoring function option, default is vina, options can be (vina, vinardo, or a customized scoring function)
type: string?
inputBinding:
position: 4
prefix: --scoring
default: "vina"

output_dock_file:
label: output docking poses.
type: string?
format: edam:format_1476
inputBinding:
position: 5
prefix: -o
default: "docked.pdb"

# Is this still necessary?
output_path:
type: string

outputs:

output_dock_file:
type: File
outputBinding:
glob: $(inputs.output_dock_file)
format: edam:format_1476

output_path:
type: File
outputBinding:
glob: $(inputs.output_path)


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
3 changes: 3 additions & 0 deletions utils/docking/smina/smina-docking-tool/tests/5umx_ligand.sdf
Git LFS file not shown
3 changes: 3 additions & 0 deletions utils/docking/smina/smina-docking-tool/tests/5umx_protein.pdb
Git LFS file not shown
1 change: 1 addition & 0 deletions utils/docking/smina/smina-docking-tool/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for smina_docking."""
31 changes: 31 additions & 0 deletions utils/docking/smina/smina-docking-tool/tests/test_smina_docking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Tests for smina_docking."""
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_smina_docking() -> None:
"""Test smina_docking."""
cwl_file = Path("smina_docking_0.1.0.cwl")
input_to_props = parse_cwl_arguments(cwl_file)
file_path_str = "5umx_protein.pdb"
file_path = str(Path(__file__).resolve().parent / Path(file_path_str))
input_to_props["receptor_file"]["path"] = file_path
input_to_props["receptor_file"]["class"] = "File"
file_path_str = "5umx_ligand.sdf"
file_path = str(Path(__file__).resolve().parent / Path(file_path_str))
input_to_props["ligand_file"]["path"] = file_path
input_to_props["ligand_file"]["class"] = "File"
input_to_props["ligand_box"]["path"] = file_path
input_to_props["ligand_box"]["class"] = "File"
input_yaml_path = Path("smina_docking_0.1.0.yml")
create_input_yaml(input_to_props, input_yaml_path)
stdout, stderr = call_cwltool(cwl_file, input_yaml_path)
assert Path("string").exists()

0 comments on commit ff7e360

Please sign in to comment.