Skip to content

Commit

Permalink
score_pdb_structures
Browse files Browse the repository at this point in the history
  • Loading branch information
ndonyapour committed Sep 3, 2024
1 parent f8a4d5c commit 0e23d34
Show file tree
Hide file tree
Showing 16 changed files with 702 additions and 0 deletions.
29 changes: 29 additions & 0 deletions utils/score-pdb-structures-plugin/.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/score_pdb_structures/__init__.py]
4 changes: 4 additions & 0 deletions utils/score-pdb-structures-plugin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.venv
out
tests
__pycache__
1 change: 1 addition & 0 deletions utils/score-pdb-structures-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry.lock
5 changes: 5 additions & 0 deletions utils/score-pdb-structures-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 0.1.0

Initial release.
27 changes: 27 additions & 0 deletions utils/score-pdb-structures-plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM condaforge/mambaforge

ENV EXEC_DIR="/opt/executables"
ENV POLUS_LOG="INFO"
RUN mkdir -p ${EXEC_DIR}


# Work directory defined in the base container
# WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY CHANGELOG.md ${EXEC_DIR}

# Install needed packages here
# errors installing rdkit from poetry so using conda
COPY environment.yml ${EXEC_DIR}
RUN mamba env create -f ${EXEC_DIR}/environment.yml
RUN echo "source activate project_env" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH

COPY src ${EXEC_DIR}/src

RUN pip3 install ${EXEC_DIR} --no-cache-dir

CMD ["--help"]
18 changes: 18 additions & 0 deletions utils/score-pdb-structures-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# score_pdb_structures (0.1.0)

Fetches the PDB information from RCSB and scores PDB structures.

## Options

This plugin takes 6 input arguments and 2 output argument:

| Name | Description | I/O | Type | Default |
|---------------|-------------------------|--------|--------|---------|
| input_pdbids | List of input PDBIDs to score, Type: string[], File type: input, Accepted formats: list[string] | Input | ['null', {'type': 'array', 'items': 'string'}] | ['null', {'type': 'array', 'items': 'string'}] |
| min_row | The row min inex, Type: int | Input | int | int |
| max_row | The row max inex, Type: int | Input | int | int |
| output_txt_path | Path to the text dataset file, Type: string, File type: output, Accepted formats: txt | Input | string | string |
| timeout_duration | The maximum time in seconds to wait for a response from the API before timing out, Type: int | Input | int | int |
| max_retries | The maximum number of times to retry the request in case of failure, Type: int | Input | int | int |
| output_txt_path | Path to the txt file | Output | File | File |
| output_pdbids | The selected PDB IDs | Output | {'type': 'array', 'items': 'string'} | {'type': 'array', 'items': 'string'} |
1 change: 1 addition & 0 deletions utils/score-pdb-structures-plugin/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
4 changes: 4 additions & 0 deletions utils/score-pdb-structures-plugin/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

version=$(<VERSION)
docker build . -t polusai/score-pdb-structures-tool:${version}
89 changes: 89 additions & 0 deletions utils/score-pdb-structures-plugin/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
specVersion: "0.1.0"
name: score_pdb_structures
version: 0.1.0
container: score-pdb-structures-plugin
entrypoint:
title: score_pdb_structures
description: Fetches the PDB information from RCSB and scores PDB structures.
author: Brandon Walker, Nazanin Donyapour
contact: [email protected], [email protected]
repository:
documentation:
citation:

inputs:
- name: input_pdbids
required: true
description: List of input PDBIDs to score, Type string[], File type input, Accepted formats list[string]
type: ['null', {'type': 'array', 'items': 'string'}]
format:
uri: edam:format_2330
- name: min_row
required: true
description: The row min inex, Type int
type: int
format:
uri: edam:format_2330
- name: max_row
required: true
description: The row max inex, Type int
type: int
format:
uri: edam:format_2330
- name: output_txt_path
required: true
description: Path to the text dataset file, Type string, File type output, Accepted formats txt
type: string
defaultValue: system.log
format:
uri: edam:format_2330
- name: timeout_duration
required: true
description: The maximum time in seconds to wait for a response from the API before timing out, Type int
type: int
defaultValue: 10
format:
uri: edam:format_2330
- name: max_retries
required: true
description: The maximum number of times to retry the request in case of failure, Type int
type: int
defaultValue: 5
format:
uri: edam:format_2330
outputs:
- name: output_txt_path
required: true
description: Path to the txt file
type: File
format:
uri: edam:format_2330
- name: output_pdbids
required: true
description: The selected PDB IDs
type: {'type': 'array', 'items': 'string'}
ui:
- key: inputs.input_pdbids
title: "input_pdbids: "
description: "List of input PDBIDs to score, Type string[], File type input, Accepted formats list[string]"
type: ['null', {'type': 'array', 'items': 'string'}]
- key: inputs.min_row
title: "min_row: "
description: "The row min inex, Type int"
type: int
- key: inputs.max_row
title: "max_row: "
description: "The row max inex, Type int"
type: int
- key: inputs.output_txt_path
title: "output_txt_path: "
description: "Path to the text dataset file, Type string, File type output, Accepted formats txt"
type: string
- key: inputs.timeout_duration
title: "timeout_duration: "
description: "The maximum time in seconds to wait for a response from the API before timing out, Type int"
type: int
- key: inputs.max_retries
title: "max_retries: "
description: "The maximum number of times to retry the request in case of failure, Type int"
type: int
31 changes: 31 additions & 0 deletions utils/score-pdb-structures-plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.poetry]
name = "polus-mm-utils-score-pdb-structures"
version = "0.1.0"
description = "Fetches the PDB information from RCSB and scores PDB structures."
authors = ["Nazanin Donyapour <[email protected]>", "Brandon Walker <[email protected]>"]
readme = "README.md"
packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
typer = "^0.7.0"
sophios = "0.1.1"
pandas = "2.2.2"

[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 = [
"."
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0

class: CommandLineTool

label: Fetches the PDB information from RCSB and scores PDB structures.

doc: |-
Fetches the PDB information from RCSB and scores PDB structures.

baseCommand: ['python3', '/score_pdb_structures.py']

hints:
DockerRequirement:
dockerPull: ndonyapour/score_pdb_structures

requirements:
InlineJavascriptRequirement: {}


inputs:
input_pdbids:
label: List of input PDBIDs to score
doc: |-
List of input PDBIDs to score
Type: string[]
File type: input
Accepted formats: list[string]
type: ["null", {"type": "array", "items": "string"}]
format: edam:format_2330
inputBinding:
prefix: --input_pdbids
default: []

min_row:
label: The row min index
doc: |-
The row min inex
Type: int
type: int?
format:
- edam:format_2330
inputBinding:
prefix: --min_row

max_row:
label: The row max index
doc: |-
The row max inex
Type: int
type: int?
format:
- edam:format_2330
inputBinding:
prefix: --max_row

output_txt_path:
label: Path to the text dataset file
doc: |-
Path to the text dataset file
Type: string
File type: output
Accepted formats: txt
type: string
format:
- edam:format_2330
inputBinding:
prefix: --output_txt_path
default: system.log

timeout_duration:
label: The maximum time in seconds to wait for a response from the API before timing out
doc: |-
The maximum time in seconds to wait for a response from the API before timing out
Type: int
type: int?
format:
- edam:format_2330
inputBinding:
prefix: --timeout_duration
default: 10

max_retries:
label: The maximum number of times to retry the request in case of failure
doc: |-
The maximum number of times to retry the request in case of failure
Type: int
type: int?
format:
- edam:format_2330
inputBinding:
prefix: --max_retries
default: 5

outputs:
output_txt_path:
label: Path to the txt file
doc: |-
Path to the txt file
type: File
outputBinding:
glob: $(inputs.output_txt_path)
format: edam:format_2330

output_pdbids:
label: The selected PDB IDs
doc: |-
The selected PDB IDs
type:
type: array
items: string
outputBinding:
glob: $(inputs.output_txt_path)
loadContents: true
outputEval: |
${
// check if self[0] exists
if (!self[0]) {
return null;
}
var lines = self[0].contents.split("\n");
// remove black lines
lines = lines.filter(function(line) {return line.trim() !== '';});
// The outpus file has one line
// The format of the line is as follows: 6x7z,4yo7,5fyr,6ktl,4rxm,4irx,3v16,6b5z,4mio,7d5n
return lines[0].split(",").map(function(item) {return item.trim();});
}

$namespaces:
edam: https://edamontology.org/

$schemas:
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""score_pdb_structures."""

__version__ = "0.1.0"

from polus.mm.utils.score_pdb_structures.score_pdb_structures import ( # noqa # pylint: disable=unused-import
score_pdb_structures,
)
Loading

0 comments on commit 0e23d34

Please sign in to comment.