Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash top #132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-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/bash_top/__init__.py]
4 changes: 4 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/.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/molecular-dynamics/amber/bash-top-tool/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry.lock
5 changes: 5 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 0.1.0

Initial release.
5 changes: 5 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# docker build -f Dockerfile -t polusai/bash-top-tool .
FROM bash

ADD gmx_add_topology_includes.sh .
ADD Dockerfile .
14 changes: 14 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# bash_top (0.1.0)

Concatentate import statements in AMBER topology file

## Options

This plugin takes 3 input arguments and 1 output argument:

| Name | Description | I/O | Type | Default |
|---------------|-------------------------|--------|--------|---------|
| script | Bash script name | Input | string | string |
| input_top_path | Gromacs topology file | Input | File | File |
| output_top_path | Output topology file name | Input | string | string |
| output_top_path | Output topology file | Output | File | File |
1 change: 1 addition & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0

class: CommandLineTool

label: Concatentate import statements in AMBER topology file

doc: |
Concatentate import statements in AMBER topology file

baseCommand: bash

hints:
DockerRequirement:
dockerPull: polusai/bash-top-tool@sha256:881d3634bd000a931b3339e8328ee9701190e6ac7b1227082bd095e317d2e551

inputs:
script:
type: string
inputBinding:
position: 1

input_top_path:
type: File
format: edam:format_3880
inputBinding:
position: 2

output_top_path:
type: string?
format: edam:format_2330 # 'Textual format'
# inputBinding:
# position: 3
default: system.top

outputs:
output_top_path:
type: File
format: edam:format_3880
streamable: true
outputBinding:
glob: $(inputs.output_top_path)

stdout: $(inputs.output_top_path)

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

$schemas:
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl
4 changes: 4 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/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/bash-top-tool:${version}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -e
# NOTE: These include statements MUST be in this order. In particular, we
# cannot simply use cat $1 because we need to interleave the amber99sb-ildn.ff
# includes around ligand_GMX.itp, and because we need to remove the [ defaults ]
# directive (which is included in forcefield.itp)
echo '#include "amber99sb-ildn.ff/forcefield.itp"'

echo '#include "ligand_GMX.itp"'

echo '#include "amber99sb-ildn.ff/spce.itp"'
echo '#include "amber99sb-ildn.ff/ions.itp"'

echo "[ system ]"
echo " ligand "
echo ""
echo "[ molecules ]"
echo "; Compound nmols"
echo " ligand 1 "

#cat $1
51 changes: 51 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
specVersion: "0.1.0"
name: bash_top
version: 0.1.0
container: bash-top-tool
entrypoint:
title: bash_top
description: Concatentate import statements in AMBER topology file
author: Data Scientist
contact: [email protected]
repository:
documentation:
citation:

inputs:
- name: script
required: true
description:
type: string
- name: input_top_path
required: true
description:
type: File
format:
uri: edam:format_3880
- name: output_top_path
required: true
description:
type: string
defaultValue: system.top
format:
uri: edam:format_2330
outputs:
- name: output_top_path
required: true
description:
type: File
format:
uri: edam:format_3880
ui:
- key: inputs.script
title: "script: "
description: ""
type: string
- key: inputs.input_top_path
title: "input_top_path: "
description: ""
type: File
- key: inputs.output_top_path
title: "output_top_path: "
description: ""
type: string
28 changes: 28 additions & 0 deletions utils/molecular-dynamics/amber/bash-top-tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "polus-mm-utils-bash-top"
version = "0.1.0"
description = "Run a Bash script"
authors = ["Data Scientist <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
sophios = "0.1.1"

[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,54 @@
;
; File 'ALL.Ala115Pro_step4_p2g_p2g.top' was generated
; By user: unknown (3373)
; On host: s04r1b41
; At date: Tue Apr 10 08:32:54 2018

;
; This is a standalone topology file
;
; Created by:
; :-) GROMACS - gmx pdb2gmx, VERSION 5.1.2 (-:
;
; Executable: /gpfs/home/bsc23/bsc23210/gromacs/bin/gmx
; Data prefix: /gpfs/home/bsc23/bsc23210/gromacs
; Command line:
; gmx pdb2gmx -f /gpfs/scratch/bsc23/bsc23210/tmp.pjwGKiFyti/dd33c756-035a-41ec-9e5c-ad722dd9f4e7/s04r1b41-ib0/sandBox/job_203/mutated.pdb -o /gpfs/scratch/bsc23/bsc23210/tmp.pjwGKiFyti/dd33c756-035a-41ec-9e5c-ad722dd9f4e7/s04r1b41-ib0/sandBox/job_203/p2g.gro -p ALL.Ala115Pro_step4_p2g_p2g.top -water tip3p -ff amber99sb -i ALL.Ala115Pro_step4_p2g_p2g.itp -ignh
; Force field was read from the standard GROMACS share directory.
;

; Include forcefield parameters
#include "amber99sb.ff/forcefield.itp"

; Include chain topologies
#include "ALL.Ala115Pro_step4_p2g_p2g_Protein_chain_A.itp"
#include "ALL.Ala115Pro_step4_p2g_p2g_Protein_chain_B.itp"
#include "ALL.Ala115Pro_step4_p2g_p2g_Protein_chain_C.itp"
#include "ALL.Ala115Pro_step4_p2g_p2g_Protein_chain_D.itp"

; Include water topology
#include "amber99sb.ff/tip3p.itp"

#ifdef POSRES_WATER
; Position restraint for each water oxygen
[ position_restraints ]
; i funct fcx fcy fcz
1 1 1000 1000 1000
#endif

; Include topology for ions
#include "amber99sb.ff/ions.itp"

[ system ]
; Name
Protein in water

[ molecules ]
; Compound #mols
Protein_chain_A 1
Protein_chain_B 1
Protein_chain_C 1
Protein_chain_D 1
SOL 121173
NA 128
CL 120
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for bash_top."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Tests for bash_top."""
from pathlib import Path

from sophios.api.pythonapi import Step
from sophios.api.pythonapi import Workflow


def test_bash_top() -> None:
"""Test bash topology CWL."""
input_top_path = Path(__file__).resolve().parent / Path(
"ALL.Ala115Pro_step8_gio_gio.top",
)
cwl_file_str = "bash_top_0@[email protected]"
cwl_file = Path(__file__).resolve().parent.parent / Path(cwl_file_str)
bash_top = Step(clt_path=cwl_file)
bash_top.script = "/gmx_add_topology_includes.sh"
bash_top.input_top_path = input_top_path

steps = [bash_top]
filename = "bash_top"
viz = Workflow(steps, filename)

viz.run()

outdir = Path("outdir")
files = list(outdir.rglob("system.top"))

assert (
files
), f"The file 'system.top' does not exist in any subdirectory of '{outdir}'."
Loading