aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-nextflow/nextflow-example1.nix
blob: 0ec1cae42715ee594e1b253acfb6e7e53eb7cc60 (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 [
  splitSequences
  (each reverse)
] input