-
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
1 parent
8556c48
commit 759bfd2
Showing
15 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
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/bash_xvg/__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 @@ | ||
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,4 @@ | ||
FROM bash | ||
|
||
ADD replace_first_column.sh . | ||
ADD Dockerfile . |
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,14 @@ | ||
# bash_xvg (0.1.0) | ||
|
||
Replace a column in one file with a column from another using AWK | ||
|
||
## Options | ||
|
||
This plugin takes 3 input arguments and 1 output argument: | ||
|
||
| Name | Description | I/O | Type | Default | | ||
|---------------|-------------------------|--------|--------|---------| | ||
| input_xvg1_path | Path to the first XVG file | Input | File | File | | ||
| input_xvg2_path | Path to the second XVG file | Input | File | File | | ||
| output_xvg_path | Path to the output XVG file | Input | string | string | | ||
| output_xvg_path | Path to the output XVG file | Output | File | File | |
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,61 @@ | ||
#!/usr/bin/env cwl-runner | ||
cwlVersion: v1.0 | ||
|
||
class: CommandLineTool | ||
|
||
label: Replace a column in one file with a column from another using AWKK | ||
|
||
doc: | | ||
Replace a column in one file with a column from another using AWK | ||
|
||
baseCommand: ["bash", "/replace_first_column.sh"] | ||
|
||
hints: | ||
DockerRequirement: | ||
dockerPull: ndonyapour/replace_first_column | ||
|
||
inputs: | ||
input_xvg1_path: | ||
label: Path to the first XVG file | ||
doc: |- | ||
Path to the first XVG file | ||
type: File | ||
format: edam:format_2030 | ||
inputBinding: | ||
position: 1 | ||
|
||
input_xvg2_path: | ||
label: Path to the second XVG file | ||
doc: |- | ||
Path to the second XVG file | ||
type: File | ||
format: edam:format_2030 | ||
inputBinding: | ||
position: 2 | ||
|
||
output_xvg_path: | ||
label: Path to the output XVG file | ||
doc: |- | ||
Path to the output XVG file | ||
type: string | ||
format: edam:format_2030 | ||
default: system.xvg | ||
|
||
outputs: | ||
output_xvg_path: | ||
label: Path to the output XVG file | ||
doc: |- | ||
Path to the output XVG file | ||
type: File | ||
format: edam:format_2030 | ||
streamable: true | ||
outputBinding: | ||
glob: $(inputs.output_xvg_path) | ||
|
||
stdout: $(inputs.output_xvg_path) | ||
|
||
$namespaces: | ||
edam: https://edamontology.org/ | ||
|
||
$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,53 @@ | ||
specVersion: "0.1.0" | ||
name: bash_xvg | ||
version: 0.1.0 | ||
container: bash-xvg-plugin | ||
entrypoint: | ||
title: bash_xvg | ||
description: Replace a column in one file with a column from another using AWK | ||
author: Data Scientist | ||
contact: [email protected] | ||
repository: | ||
documentation: | ||
citation: | ||
|
||
inputs: | ||
- name: input_xvg1_path | ||
required: true | ||
description: Path to the first XVG file | ||
type: File | ||
format: | ||
uri: edam:format_2030 | ||
- name: input_xvg2_path | ||
required: true | ||
description: Path to the second XVG file | ||
type: File | ||
format: | ||
uri: edam:format_2030 | ||
- name: output_xvg_path | ||
required: true | ||
description: Path to the output XVG file | ||
type: string | ||
defaultValue: system.xvg | ||
format: | ||
uri: edam:format_2030 | ||
outputs: | ||
- name: output_xvg_path | ||
required: true | ||
description: Path to the output XVG file | ||
type: File | ||
format: | ||
uri: edam:format_2030 | ||
ui: | ||
- key: inputs.input_xvg1_path | ||
title: "input_xvg1_path: " | ||
description: "Path to the first XVG file" | ||
type: File | ||
- key: inputs.input_xvg2_path | ||
title: "input_xvg2_path: " | ||
description: "Path to the second XVG file" | ||
type: File | ||
- key: inputs.output_xvg_path | ||
title: "output_xvg_path: " | ||
description: "Path to the output XVG file" | ||
type: string |
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,30 @@ | ||
[tool.poetry] | ||
name = "polus-mm-utils-bash-xvg" | ||
version = "0.1.0" | ||
description = "Replace a column in one file with a column from another using AWK" | ||
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 = [ | ||
"." | ||
] |
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,6 @@ | ||
#!/bin/bash -e | ||
# See https://stackoverflow.com/questions/7846476/replace-column-in-one-file-with-column-from-another-using-awk | ||
|
||
grep -v "#" "$1" | grep -v "@" > tempone.txt | ||
grep -v "#" "$2" | grep -v "@" > temptwo.txt | ||
awk 'FNR==NR{a[NR]=$1;next}{$1=a[FNR]}1' temptwo.txt tempone.txt |
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 bash_xvg.""" |
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,28 @@ | ||
# This file was created Wed May 15 18:52:40 2024 | ||
# Created by: | ||
# :-) GROMACS - gmx rms, 2022.2-conda_forge (-: | ||
# | ||
# Executable: /usr/local/bin.AVX2_256/gmx | ||
# Data prefix: /usr/local | ||
# Working dir: /jAiJpn | ||
# Command line: | ||
# gmx rms -fit none -n /var/lib/cwl/stg854534b4-dcba-4641-a8e0-289ad164dad7/MOL.ndx -s /var/lib/cwl/stg2e049b7d-2261-481a-8b2e-f87a749a2820/complex.gro -f /var/lib/cwl/stg728ca10c-9429-421c-87f5-a5da2d92df29/prod_align_protein_ca.pdb -o rmsd_equil_ligand_notime.xvg | ||
# gmx rms is part of G R O M A C S: | ||
# | ||
# GROningen MAchine for Chemical Simulation | ||
# | ||
@ title "RMSD" | ||
@ xaxis label "Time (ps)" | ||
@ yaxis label "RMSD (nm)" | ||
@TYPE xy | ||
@ subtitle "resname_MOL after no fit" | ||
0.0000000 0.0005156 | ||
0.0000000 0.0296825 | ||
0.0000000 0.0469071 | ||
0.0000000 0.0253868 | ||
0.0000000 0.0279059 | ||
0.0000000 0.0438598 | ||
0.0000000 0.0250407 | ||
0.0000000 0.0494208 | ||
0.0000000 0.0510193 | ||
0.0000000 0.0347102 |
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,28 @@ | ||
# This file was created Wed May 15 18:52:40 2024 | ||
# Created by: | ||
# :-) GROMACS - gmx rms, 2022.2-conda_forge (-: | ||
# | ||
# Executable: /usr/local/bin.AVX2_256/gmx | ||
# Data prefix: /usr/local | ||
# Working dir: /jAiJpn | ||
# Command line: | ||
# gmx rms -fit none -n /var/lib/cwl/stg854534b4-dcba-4641-a8e0-289ad164dad7/MOL.ndx -s /var/lib/cwl/stg2e049b7d-2261-481a-8b2e-f87a749a2820/complex.gro -f /var/lib/cwl/stg728ca10c-9429-421c-87f5-a5da2d92df29/prod_align_protein_ca.pdb -o rmsd_equil_ligand_notime.xvg | ||
# gmx rms is part of G R O M A C S: | ||
# | ||
# GROningen MAchine for Chemical Simulation | ||
# | ||
@ title "RMSD" | ||
@ xaxis label "Time (ps)" | ||
@ yaxis label "RMSD (nm)" | ||
@TYPE xy | ||
@ subtitle "resname_MOL after no fit" | ||
0.0000000 0.0006156 | ||
0.0000000 0.0396825 | ||
0.0000000 0.0469065 | ||
0.0000000 0.0353868 | ||
0.0000000 0.0479059 | ||
0.0000000 0.0488598 | ||
0.0000000 0.0550407 | ||
0.0000000 0.0694208 | ||
0.0000000 0.0210193 | ||
0.0000000 0.0247102 |
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,31 @@ | ||
"""Tests for bash_xvg.""" | ||
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_bash_xvg() -> None: | ||
"""Test bash_xvg.""" | ||
cwl_file = Path("bash_xvg.cwl") | ||
input_to_props = parse_cwl_arguments(cwl_file) | ||
|
||
input_xvg1_path = "rmsd1.xvg" | ||
input_xvg1_path = str(Path(__file__).resolve().parent / Path(input_xvg1_path)) | ||
input_to_props["input_xvg1_path"]["path"] = input_xvg1_path | ||
|
||
input_xvg2_path = "rmsd2.xvg" | ||
input_xvg2_path = str(Path(__file__).resolve().parent / Path(input_xvg2_path)) | ||
input_to_props["input_xvg2_path"]["path"] = input_xvg2_path | ||
|
||
input_to_props["output_xvg_path"] = "output.xvg" | ||
input_yaml_path = Path("bash_xvg.yml") | ||
create_input_yaml(input_to_props, input_yaml_path) | ||
call_cwltool(cwl_file, input_yaml_path) | ||
assert Path("output.xvg").exists() |