aboutsummaryrefslogtreecommitdiff
path: root/tools/bwa-index2.nix
blob: f5cc69b95f7c35caeef1ab1ffab047e9354ca34c (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-index2";
  buildInputs = with pkgs; [ bionix.bwa.app2 ];
  buildCommand = ''
    ln -s ${ref} ref.fa
    bwa-mem2 index ${optionalString (flags != null) flags} ref.fa
    mkdir $out
    mv ref.fa.* $out
    grep '^>[^ \t]*_alt$' ref.fa | tr -d '^>' > $out/idxbase.alt || true
  '';
}