aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-nextflow/nextflow-example1.nix
blob: 687505cc4f4d1912ee2b48fcac510459fc2f2ab6 (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
31
32
# 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)
]