diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ex-nextflow/nextflow-example1.nix | 30 | ||||
-rwxr-xr-x | examples/ex-tnpair/tnpair (renamed from examples/tnpair) | 0 | ||||
-rw-r--r-- | examples/ex-tnpair/tnpair.nix (renamed from examples/tnpair.nix) | 0 | ||||
-rw-r--r-- | examples/ex-wdl/wdl-scatter-gather.nix | 33 |
4 files changed, 63 insertions, 0 deletions
diff --git a/examples/ex-nextflow/nextflow-example1.nix b/examples/ex-nextflow/nextflow-example1.nix new file mode 100644 index 0000000..b31984a --- /dev/null +++ b/examples/ex-nextflow/nextflow-example1.nix @@ -0,0 +1,30 @@ +# This is a translation of the Nextflow example found at +# https://www.nextflow.io/example1.html +{ bionix ? import <bionix> {} +, input ? ./sample.fa}: + +with bionix; +with lib; + +let + splitSequences = fa: stage { + name = "splitSequences"; + buildInputs = [ pkgs.gawk ]; + buildCommand = '' + awk '/^>/{f="seq_"++d} {print > f}' ${fa} + mkdir $out + cp seq* $out + ''; + }; + + reverse = fa: stage { + name = "reverse"; + buildCommand = '' + ${pkgs.utillinux}/bin/rev ${fa} > $out + ''; + }; + +in pipe [ + splitSequences + (each reverse) +] input diff --git a/examples/tnpair b/examples/ex-tnpair/tnpair index 5b84d5c..5b84d5c 100755 --- a/examples/tnpair +++ b/examples/ex-tnpair/tnpair diff --git a/examples/tnpair.nix b/examples/ex-tnpair/tnpair.nix index 2939db4..2939db4 100644 --- a/examples/tnpair.nix +++ b/examples/ex-tnpair/tnpair.nix diff --git a/examples/ex-wdl/wdl-scatter-gather.nix b/examples/ex-wdl/wdl-scatter-gather.nix new file mode 100644 index 0000000..387d382 --- /dev/null +++ b/examples/ex-wdl/wdl-scatter-gather.nix @@ -0,0 +1,33 @@ +# The scatter-gather example from https://github.com/openwdl/wdl +# translated to bionix +{ bionix ? import <bionix> {} }: + +with bionix; +with lib; + +let + + prepare = splitString "\n" (removeSuffix "\n" (readFile (stage { + name = "prepare"; + buildInputs = [ pkgs.python3 ]; + buildCommand = '' + python -c "print('one\ntwo\nthree\nfour', end=''')" > $out + ''; + }))); + + analysis = str: removeSuffix "\n" (readFile (stage { + name = "analysis"; + buildInputs = [ pkgs.python ]; + buildCommand = '' + python -c "print('_${str}_')" > $out + ''; + })); + + gather = strs: stage { + name = "gather"; + buildCommand = '' + echo ${concatStringsSep " " strs} > $out + ''; + }; + +in gather (map analysis prepare) |