aboutsummaryrefslogtreecommitdiff
path: root/tools/snver-call.nix
blob: 5d80719b4496f2e13c0c5762b0ca9c9dbb165b88 (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
33
34
35
36
37
38
39
40
{ bionix
, flags ? null
, ploidy
}:

inputs:

with bionix;
with lib;
with types;

let
  config = pkgs.writeText "pool.txt" (concatMapStringsSep "\n" (x: "${x}\t${toString ploidy}\t1") inputs);
  getref = f: matchFiletype "SNVer-call" { bam = {ref, ...}: ref; } f;
  refs = map getref inputs;
  ref = head refs;
in

assert (length (unique refs) == 1);

stage {
  name = "SNVerPool";
  buildInputs = [ snver.app ];
  outputs = [ "out" "log" "raw" "filter" "indelfilter" "indelraw" ];
  buildCommand = ''
    SNVerPool -i / -c ${config} -r ${ref} -o snver

    mkdir $out
    cp snver.failed.log $log
    ln -s $log $out/snver.failed.log
    cp snver.filter.vcf $filter
    ln -s $filter $out/snver.filter.vcf
    cp snver.indel.filter.vcf $indelfilter
    ln -s $indelfilter $out/snver.indel.filter.vcf
    cp snver.indel.raw.vcf $indelraw
    ln -s $indelraw $out/snver.indel.raw.vcf
    cp snver.raw.vcf $raw
    ln -s $raw $out/snver.raw.vcf
  '';
}