blob: 9e6befef6bcfbfe449a76730049b9b74d7d1cfb0 (
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
41
42
43
44
45
46
47
48
49
|
{bionix ? import <bionix> {}, pair, fetch}:
with bionix;
with lib;
with types;
with minimap2;
with samtools;
with snpeff;
let
preprocess = s: pipe s [
fetch
(align { preset = "sr"; ref = ref.grch38.seq; flags = "-R'@RG\\tID:${s.type}\\tSM:${s.type}'"; })
(sort { nameSort = true; })
(fixmate {})
(sort { })
(markdup { })
];
dropErrors = input: stage {
name = "drop-errors";
buildCommand = ''
grep -v "ERROR_" ${input} > $out
'';
passthru.filetype = input.filetype;
};
bams = mapAttrs (_: preprocess) pair;
variants = let
somatic = strelka.callSomatic { } bams; in mapAttrs (_: flip pipe [
(compression.uncompress { })
(snpeff.annotate { db = ref.grch38.snpeff.db; })
dropErrors
(snpeff.dbnsfp { dbnsfp = ref.grch38.snpeff.dbnsfp; })
]) {
"snvs.vcf" = somatic.snvs;
"indels.vcf" = somatic.snvs;
"germline.vcf" = strelka.call { } [bams.normal];
};
cnvs = cnvkit.callCNV { } { normals = [ bams.normal ]; tumours = [ bams.tumour ]; };
in linkOutputs {
inherit variants;
alignments = linkOutputs (mapAttrs' (n: nameValuePair (n + ".bam")) bams);
cnvkit = cnvs;
}
|