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

ref:

with bionix;
with lib;
with types;

assert (matchFiletype "bwa-index" { fa = _: true; } ref);

stage {
  name = "bwa-index";
  buildInputs = with pkgs; [ bwa ];
  buildCommand = ''
    ln -s ${ref} 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
  '';
}