diff --git a/.travis.yml b/.travis.yml index 609d331..1bff60e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,10 @@ sudo: required services: - docker +env: + - LANGUAGE=cwl + - LANGUAGE=wdl + notifications: slack: on_success: never @@ -16,10 +20,10 @@ jdk: before_install: - docker build -t quay.io/collaboratory/dockstore-tool-bamstats . - - pip2.7 install --user setuptools==24.0.3 + - bash before-install.sh install: - - pip2.7 install --user cwl-runner cwltool==1.0.20160712154127 schema-salad==1.14.20160708181155 avro==1.8.1 + - bash install.sh script: - - cwltool --non-strict Dockstore.cwl test.json + - bash script.sh diff --git a/Dockstore.wdl b/Dockstore.wdl new file mode 100644 index 0000000..7b98792 --- /dev/null +++ b/Dockstore.wdl @@ -0,0 +1,27 @@ +task bamstats { + File bam_input + Int mem_gb + + command { + bash /usr/local/bin/bamstats ${mem_gb} ${bam_input} + } + + output { + File bamstats_report = "bamstats_report.zip" + } + + runtime { + docker: "quay.io/collaboratory/dockstore-tool-bamstats:1.25-6_1.0" + memory: mem_gb + "GB" + } + + meta { + author: "Andrew Duncan" + } +} + +workflow bamstatsWorkflow { + File bam_input + Int mem_gb + call bamstats { input: bam_input=bam_input, mem_gb=mem_gb } +} diff --git a/README.md b/README.md index f449cf5..5188e36 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,11 @@ You'll then see a file, `bamstats_report.zip`, in the current directory, that's ## Running Through the Dockstore CLI This tool can be found at the [Dockstore](https://dockstore.org), login with your GitHub account and follow the -directions to setup the CLI. It lets you run a Docker container with a CWL descriptor locally, using Docker and the CWL command line utility. This is great for testing. +directions to setup the CLI. It lets you run a Docker container with a CWL/WDL descriptor locally, using Docker and the CWL/WDL command line utility. This is great for testing. -### Make a Parameters JSON +### With CWL + +#### Make a Parameters JSON This is the parameterization of the BAM stat tool, a copy is present in this repo called `sample_configs.json`: @@ -62,7 +64,7 @@ This is the parameterization of the BAM stat tool, a copy is present in this rep } ``` -### Run with the CLI +#### Run with the CLI Run it using the `dockstore` CLI: @@ -75,3 +77,29 @@ $> dockstore tool convert cwl2json --cwl Dockstore.cwl > Dockstore.json # run it locally with the Dockstore CLI $> dockstore tool launch --entry quay.io/collaboratory/dockstore-tool-bamstats:1.25-3 --json Dockstore.json ``` + +### With WDL +#### Make a Parameters JSON + +This is the parameterization of the BAM stat tool, a copy is present in this repo called `test.wdl.json`: + +``` +{ + "bamstatsWorkflow.bam_input": "rna.SRR948778.bam", + "bamstatsWorkflow.mem_gb": "4" +} +``` + +#### Run with the CLI + +Run it using the `dockstore` CLI: + +``` +Usage: +# fetch WDL +$> dockstore tool wdl --entry quay.io/collaboratory/dockstore-tool-bamstats > Dockstore.wdl +# make a runtime JSON template and edit it (or use the content of test.wdl.json above) +$> dockstore tool convert wdl2json --wdl Dockstore.wdl > Dockstore.json +# run it locally with the Dockstore CLI +$> dockstore tool launch --entry quay.io/collaboratory/dockstore-tool-bamstats --json Dockstore.json +``` \ No newline at end of file diff --git a/before-install.sh b/before-install.sh new file mode 100755 index 0000000..fdfd49c --- /dev/null +++ b/before-install.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + +if [[ "${LANGUAGE}" == "cwl" ]]; then + pip2.7 install --user setuptools==24.0.3 +fi \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..2b11a3f --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + +if [[ "${LANGUAGE}" == "cwl" ]]; then + pip2.7 install --user cwl-runner cwltool==1.0.20160712154127 schema-salad==1.14.20160708181155 avro==1.8.1 +elif [[ "${LANGUAGE}" == "wdl" ]]; then + wget https://github.com/broadinstitute/cromwell/releases/download/32/cromwell-32.jar +fi \ No newline at end of file diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..9f2d50d --- /dev/null +++ b/script.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail +set -o nounset +set -o xtrace + +if [[ "${LANGUAGE}" == "cwl" ]]; then + cwltool --non-strict Dockstore.cwl test.json +elif [[ "${LANGUAGE}" == "wdl" ]]; then + java -jar cromwell-32.jar run Dockstore.wdl --inputs test.wdl.json +fi \ No newline at end of file diff --git a/test.wdl.json b/test.wdl.json new file mode 100644 index 0000000..d4382eb --- /dev/null +++ b/test.wdl.json @@ -0,0 +1,4 @@ +{ + "bamstatsWorkflow.bam_input": "rna.SRR948778.bam", + "bamstatsWorkflow.mem_gb": "4" +}