From d6f94a76b70ee303a267aba47e4c2a4299437411 Mon Sep 17 00:00:00 2001 From: Brandon Duane Walker Date: Fri, 3 May 2024 11:23:37 -0400 Subject: [PATCH] bash top --- .../amber/bash-top-tool/.bumpversion.cfg | 29 ++++++++++ .../amber/bash-top-tool/.dockerignore | 4 ++ .../amber/bash-top-tool/.gitignore | 1 + .../amber/bash-top-tool/CHANGELOG.md | 5 ++ .../amber/bash-top-tool/Dockerfile | 5 ++ .../amber/bash-top-tool/README.md | 14 +++++ .../amber/bash-top-tool/VERSION | 1 + .../amber/bash-top-tool/bash_top_0.1.0.cwl | 50 +++++++++++++++++ .../amber/bash-top-tool/build-docker.sh | 4 ++ .../gmx_add_topology_includes.sh | 20 +++++++ .../amber/bash-top-tool/ict.yml | 51 ++++++++++++++++++ .../amber/bash-top-tool/pyproject.toml | 28 ++++++++++ .../tests/ALL.Ala115Pro_step8_gio_gio.top | 54 +++++++++++++++++++ .../amber/bash-top-tool/tests/__init__.py | 1 + .../bash-top-tool/tests/test_bash_top.py | 30 +++++++++++ 15 files changed, 297 insertions(+) create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/.bumpversion.cfg create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/.dockerignore create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/.gitignore create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/CHANGELOG.md create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/Dockerfile create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/README.md create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/VERSION create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/bash_top_0.1.0.cwl create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/build-docker.sh create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/gmx_add_topology_includes.sh create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/ict.yml create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/pyproject.toml create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/tests/ALL.Ala115Pro_step8_gio_gio.top create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/tests/__init__.py create mode 100644 utils/molecular-dynamics/amber/bash-top-tool/tests/test_bash_top.py diff --git a/utils/molecular-dynamics/amber/bash-top-tool/.bumpversion.cfg b/utils/molecular-dynamics/amber/bash-top-tool/.bumpversion.cfg new file mode 100644 index 00000000..74a53e2b --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/.bumpversion.cfg @@ -0,0 +1,29 @@ +[bumpversion] +current_version = 0.1.0 +commit = False +tag = False +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)(?P\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] diff --git a/utils/molecular-dynamics/amber/bash-top-tool/.dockerignore b/utils/molecular-dynamics/amber/bash-top-tool/.dockerignore new file mode 100644 index 00000000..7c603f81 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/.dockerignore @@ -0,0 +1,4 @@ +.venv +out +tests +__pycache__ diff --git a/utils/molecular-dynamics/amber/bash-top-tool/.gitignore b/utils/molecular-dynamics/amber/bash-top-tool/.gitignore new file mode 100644 index 00000000..c04bc49f --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/.gitignore @@ -0,0 +1 @@ +poetry.lock diff --git a/utils/molecular-dynamics/amber/bash-top-tool/CHANGELOG.md b/utils/molecular-dynamics/amber/bash-top-tool/CHANGELOG.md new file mode 100644 index 00000000..b67793f7 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/CHANGELOG.md @@ -0,0 +1,5 @@ +# CHANGELOG + +## 0.1.0 + +Initial release. diff --git a/utils/molecular-dynamics/amber/bash-top-tool/Dockerfile b/utils/molecular-dynamics/amber/bash-top-tool/Dockerfile new file mode 100644 index 00000000..a09b5ff6 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/Dockerfile @@ -0,0 +1,5 @@ +# docker build -f Dockerfile -t polusai/bash-top-tool . +FROM bash + +ADD gmx_add_topology_includes.sh . +ADD Dockerfile . diff --git a/utils/molecular-dynamics/amber/bash-top-tool/README.md b/utils/molecular-dynamics/amber/bash-top-tool/README.md new file mode 100644 index 00000000..6b0ca987 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/README.md @@ -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 | diff --git a/utils/molecular-dynamics/amber/bash-top-tool/VERSION b/utils/molecular-dynamics/amber/bash-top-tool/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/utils/molecular-dynamics/amber/bash-top-tool/bash_top_0.1.0.cwl b/utils/molecular-dynamics/amber/bash-top-tool/bash_top_0.1.0.cwl new file mode 100644 index 00000000..8eeb6dba --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/bash_top_0.1.0.cwl @@ -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 diff --git a/utils/molecular-dynamics/amber/bash-top-tool/build-docker.sh b/utils/molecular-dynamics/amber/bash-top-tool/build-docker.sh new file mode 100644 index 00000000..fea1a3c9 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/build-docker.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +version=$("] +readme = "README.md" + +[tool.poetry.dependencies] +python = ">=3.9,<3.12" +sophios = "0.1.0" + +[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 = [ + "." +] diff --git a/utils/molecular-dynamics/amber/bash-top-tool/tests/ALL.Ala115Pro_step8_gio_gio.top b/utils/molecular-dynamics/amber/bash-top-tool/tests/ALL.Ala115Pro_step8_gio_gio.top new file mode 100644 index 00000000..5d86f4df --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/tests/ALL.Ala115Pro_step8_gio_gio.top @@ -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 diff --git a/utils/molecular-dynamics/amber/bash-top-tool/tests/__init__.py b/utils/molecular-dynamics/amber/bash-top-tool/tests/__init__.py new file mode 100644 index 00000000..0cf21055 --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for bash_top.""" diff --git a/utils/molecular-dynamics/amber/bash-top-tool/tests/test_bash_top.py b/utils/molecular-dynamics/amber/bash-top-tool/tests/test_bash_top.py new file mode 100644 index 00000000..a8f89dfe --- /dev/null +++ b/utils/molecular-dynamics/amber/bash-top-tool/tests/test_bash_top.py @@ -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.1.0.cwl" + 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}'."