aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-01-15 14:31:15 +1100
committerJustin Bedo <cu@cua0.org>2019-01-15 14:31:15 +1100
commit2bf74101a862d0417ccda2bafe55e0d2616d1e1a (patch)
tree159d71089e2057f711bf756e18fdea9a494b3825
parentddd1c7549995600ab32c5b7a9112334681d3ea8a (diff)
strelka: add germline calling
-rw-r--r--test-tnpair.nix4
-rw-r--r--tools/strelka-call.nix8
-rw-r--r--tools/strelka-callSomatic.nix45
-rw-r--r--tools/strelka.nix1
4 files changed, 52 insertions, 6 deletions
diff --git a/test-tnpair.nix b/test-tnpair.nix
index c531a83..8b268ec 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -15,7 +15,7 @@ let
sort = samtools.sort {};
flagstat = samtools.flagstat {};
check = fastqc.check {};
- callVariants = strelka.call {};
+ callVariants = strelka.callSomatic {};
markdup = samtools.markdup {};
fixmate = samtools.fixmate {};
@@ -35,6 +35,7 @@ let
processPair = { tumour, normal }: rec {
alignments = mapAttrs (_: x: markdup (sort (fixmate (alignWithRG x.name x.files)))) { inherit normal tumour; };
variants = callVariants alignments;
+ glvariants = strelka.call {} (builtins.attrValues alignments);
platypusVars = platypus.call {} (builtins.attrValues alignments);
};
@@ -43,6 +44,7 @@ let
testNaming = linkDrv [
(ln (facets.callCNV {} {vcf = tnpairResult.platypusVars; bams = with tnpairResult.alignments; [ normal tumour ];}) "facets")
(ln tnpairResult.variants "strelka")
+ (ln tnpairResult.glvariants "strelka-gl")
(ln (bowtie.align {inherit ref;} tnpair.normal.files) "alignments/bowtie-normal.bam")
(ln (gridss.callVariants {} (with tnpairResult.alignments; [normal tumour])) "gridss")
(ln (gridss.call (with tnpairResult.alignments; [normal tumour])) "gridss2")
diff --git a/tools/strelka-call.nix b/tools/strelka-call.nix
index 8505302..cbdcfb4 100644
--- a/tools/strelka-call.nix
+++ b/tools/strelka-call.nix
@@ -4,7 +4,7 @@
, flags ? null
}:
-{normal, tumour}:
+inputs:
with bionix;
with lib;
@@ -13,7 +13,6 @@ with types;
let
filename = path: last (splitString "/" path);
getref = f: matchFiletype "strelka-call" { bam = x: x.ref; } f;
- inputs = [ normal tumour ];
refs = map getref inputs;
ref = head refs;
@@ -30,9 +29,8 @@ stage {
${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
- configureStrelkaSomaticWorkflow.py \
- --normalBam ${filename normal}.bam \
- --tumourBam ${filename tumour}.bam \
+ configureStrelkaGermlineWorkflow.py \
+ ${concatMapStringsSep " " (i: "--bam ${filename i}.bam") inputs} \
--ref ref.fa \
--runDir $TMPDIR
diff --git a/tools/strelka-callSomatic.nix b/tools/strelka-callSomatic.nix
new file mode 100644
index 0000000..8505302
--- /dev/null
+++ b/tools/strelka-callSomatic.nix
@@ -0,0 +1,45 @@
+{ bionix
+, indexAttrs ? {}
+, bamIndexAttrs ? {}
+, flags ? null
+}:
+
+{normal, tumour}:
+
+with bionix;
+with lib;
+with types;
+
+let
+ filename = path: last (splitString "/" path);
+ getref = f: matchFiletype "strelka-call" { bam = x: x.ref; } f;
+ inputs = [ normal tumour ];
+ refs = map getref inputs;
+ ref = head refs;
+
+in
+
+assert (length (unique refs) == 1);
+
+stage {
+ name = "strelka";
+ buildInputs = with pkgs; [ strelka ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx indexAttrs ref} ref.fa.fai
+ ${concatMapStringsSep "\n" (p: "ln -s ${p} ${filename p}.bam") inputs}
+ ${concatMapStringsSep "\n" (p: "ln -s ${bionix.samtools.index bamIndexAttrs p} ${filename p}.bai") inputs}
+
+ configureStrelkaSomaticWorkflow.py \
+ --normalBam ${filename normal}.bam \
+ --tumourBam ${filename tumour}.bam \
+ --ref ref.fa \
+ --runDir $TMPDIR
+
+ ./runWorkflow.py \
+ -m local \
+ -j $NIX_BUILD_CORES
+
+ cp -r results $out
+ '';
+}
diff --git a/tools/strelka.nix b/tools/strelka.nix
index 47d5832..04facb9 100644
--- a/tools/strelka.nix
+++ b/tools/strelka.nix
@@ -3,5 +3,6 @@
with bionix;
{
+ callSomatic = callBionixE ./strelka-callSomatic.nix;
call = callBionixE ./strelka-call.nix;
}