From d517a934f570427e46be8d83aa2ae4b045b069e8 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Tue, 30 Apr 2019 13:05:17 +1000 Subject: Add examples and example README --- examples/README.md | 30 ++++++++++++++++++++++++++++++ examples/call.nix | 2 +- examples/default.nix | 2 +- examples/ex-nextflow/nextflow-example1.nix | 2 +- examples/ex-tnpair/tnpair | 2 +- examples/ex-tnpair/tnpair.nix | 4 ++-- examples/ex-wdl/wdl-scatter-gather.nix | 2 +- 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..66ed04f --- /dev/null +++ b/examples/README.md @@ -0,0 +1,30 @@ +# Bionix examples + +This directory has a few example workflows in bionix along with example data. +A basic workflow is defined in `call.nix`, and an example of applying it to the +sample data is in `default.nix`. To build the `default.nix` workflow, run +``` +nix build +``` +from this directory. + +## NextFlow and WDL translations + +The directories `ex-nextflow` and `ex-wdl` contain translated examples from the +NextFlow and WDL documentation respectively. + +The NextFlow translated example does not come with example data. It can be built with +``` +nix build -f nextflow-example1.nix --arg input /path/to/sample.fa +``` + +The WDL example requires no extra data and can be built with +``` +nix build -f wdl-scatter-gather.nix +``` + +## Example script wrapper + +`ex-tnpair` contains a shell script based example on how a front-end for users +might be constructed. It is a simple tumour-normal somatic calling workflow +using the Strelka variant caller. diff --git a/examples/call.nix b/examples/call.nix index 2b63ae2..212f430 100644 --- a/examples/call.nix +++ b/examples/call.nix @@ -2,7 +2,7 @@ # with the Platypus variant caller. Each input is preprocessed by aligning # against a reference genome (defaults to GRCH38), fixing mate information, and # marking duplicates. Finally platypus is called over all samples. -{bionix ? import {} +{bionix ? import ./.. {} ,inputs ,ref ? null}: diff --git a/examples/default.nix b/examples/default.nix index d196528..5b3b523 100644 --- a/examples/default.nix +++ b/examples/default.nix @@ -1,6 +1,6 @@ # This example uses the pipelines specified in the call.nix file on the # synthetic data in this directory. -with import {}; +with import ./.. {}; let diff --git a/examples/ex-nextflow/nextflow-example1.nix b/examples/ex-nextflow/nextflow-example1.nix index b31984a..0ec1cae 100644 --- a/examples/ex-nextflow/nextflow-example1.nix +++ b/examples/ex-nextflow/nextflow-example1.nix @@ -1,6 +1,6 @@ # This is a translation of the Nextflow example found at # https://www.nextflow.io/example1.html -{ bionix ? import {} +{ bionix ? import ./../.. {} , input ? ./sample.fa}: with bionix; diff --git a/examples/ex-tnpair/tnpair b/examples/ex-tnpair/tnpair index 5b84d5c..d90374b 100755 --- a/examples/ex-tnpair/tnpair +++ b/examples/ex-tnpair/tnpair @@ -55,4 +55,4 @@ import ./tnpair.nix { } EOF -nix build --keep-going "(import ./tnpair-$$)" +nix build --keep-going "(import ./tnpair-$$)" --no-sandbox diff --git a/examples/ex-tnpair/tnpair.nix b/examples/ex-tnpair/tnpair.nix index 2939db4..c42fe95 100644 --- a/examples/ex-tnpair/tnpair.nix +++ b/examples/ex-tnpair/tnpair.nix @@ -1,5 +1,5 @@ # This is an example tumour-normal calling pipeline using strelka -{ bionix ? import {} +{ bionix ? import ./../.. {} , normal , tumour , ref @@ -20,7 +20,7 @@ let ]; in linkDrv [ - (ln (strelka.call {} {normal = preprocess normal; tumour = preprocess tumour;}) "strelka") + (ln (strelka.callSomatic {} {normal = preprocess normal; tumour = preprocess tumour;}) "strelka") (ln (preprocess normal) "normal.bam") (ln (preprocess tumour) "tumour.bam") ] diff --git a/examples/ex-wdl/wdl-scatter-gather.nix b/examples/ex-wdl/wdl-scatter-gather.nix index 387d382..61dc441 100644 --- a/examples/ex-wdl/wdl-scatter-gather.nix +++ b/examples/ex-wdl/wdl-scatter-gather.nix @@ -1,6 +1,6 @@ # The scatter-gather example from https://github.com/openwdl/wdl # translated to bionix -{ bionix ? import {} }: +{ bionix ? import ./../.. {} }: with bionix; with lib; -- cgit v1.2.3