aboutsummaryrefslogtreecommitdiff
path: root/tools/bwa-index.nix
blob: 48a2556ca4de4477fb1ed3f98561ca186dcd919c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ bionix
, nixpkgs
, flags ? null
}:

ref:

with nixpkgs;
with lib;

stdenv.mkDerivation {
  name = "bwa-index";
  buildInputs = [ bwa ];
  buildCommand = ''
    ln -s ${ref.seq} ref.fa
    bwa index ${optionalString (flags != null) flags} ref.fa
    mkdir $out
    mv ref.fa.* $out
    grep '^>[^ \t]*_alt$' ref.fa | tr -d '^>' > $out/idxbase.alt || true
  '';
}