aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-nextflow/nextflow-example1.nix
blob: 4f00431f5e84333a0ea5d481beac9be5c5101724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This is a translation of the Nextflow example found at
# https://www.nextflow.io/example1.html
{ bionix ? import ./../.. {}
, 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 input [
  splitSequences
  (each reverse)
]