aboutsummaryrefslogtreecommitdiff
path: root/examples/ex-tnpair/tnpair.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2020-04-10 09:47:44 +1000
committerJustin Bedo <cu@cua0.org>2020-04-10 09:47:44 +1000
commitcdb7056a14915354d879c519dd396204e4af3959 (patch)
tree8eb04d09f00c1c29455c9344c43307c85be8ebad /examples/ex-tnpair/tnpair.nix
parentd4fe5ce2aaea3f951fe21094ccfa90360c12c760 (diff)
update tnpair example to run on colo828
Diffstat (limited to 'examples/ex-tnpair/tnpair.nix')
-rw-r--r--examples/ex-tnpair/tnpair.nix56
1 files changed, 39 insertions, 17 deletions
diff --git a/examples/ex-tnpair/tnpair.nix b/examples/ex-tnpair/tnpair.nix
index 51cd703..70f5514 100644
--- a/examples/ex-tnpair/tnpair.nix
+++ b/examples/ex-tnpair/tnpair.nix
@@ -1,26 +1,48 @@
-# This is an example tumour-normal calling pipeline using strelka
-{ bionix ? import ./../.. {}
-, normal
-, tumour
-, ref
-}:
+{bionix ? import <bionix> {}, pair, fetch}:
with bionix;
with lib;
+with types;
+
+with minimap2;
+with samtools;
+with snpeff;
let
- input = mapAttrs (_: fetchFastQGZ);
-
- preprocess = flip pipe [
- input
- (bwa.align { ref = fetchFastA ref; })
- (samtools.fixmate {})
- (samtools.sort {})
- (samtools.markdup {})
+ preprocess = s: pipe s [
+ fetch
+ (align { preset = "sr"; ref = ref.grch38.seq; flags = "-R'@RG\\tID:${s.type}\\tSM:${s.type}'"; })
+ (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 {
- strelka = strelka.callSomatic {} {normal = preprocess normal; tumour = preprocess tumour;};
- "normal.bam" = preprocess normal;
- "tumour.bam" = preprocess tumour;
+ inherit variants;
+ alignments = linkOutputs (mapAttrs' (n: nameValuePair (n + ".bam")) bams);
+ cnvkit = cnvs;
}