aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-nextflow
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ex-nextflow')
-rw-r--r--examples/ex-nextflow/nextflow-example1.nix30
1 files changed, 30 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