aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-12-16 20:43:04 +1100
committerJustin Bedo <cu@cua0.org>2019-12-16 20:45:31 +1100
commitc48e7b40c82326006136463282b803eebc648df0 (patch)
tree82542735f10c3909e79ecf99923f9fb13cd4d833
parent352425b6065d752cd065fda5fbcd4b8d253d4626 (diff)
manta: init
-rw-r--r--default.nix1
-rw-r--r--test-tnpair.nix3
-rw-r--r--tools/manta-call.nix40
-rw-r--r--tools/manta.nix7
4 files changed, 51 insertions, 0 deletions
diff --git a/default.nix b/default.nix
index 49de832..7ad804f 100644
--- a/default.nix
+++ b/default.nix
@@ -40,6 +40,7 @@ let
snver = callBionix ./tools/snver.nix {};
hisat2 = callBionix ./tools/hisat2.nix {};
xenomapper = callBionix ./tools/xenomapper.nix {};
+ manta = callBionix ./tools/manta.nix {};
slurm = attrs: bionix.extend (self: super: with self; rec {
slurmDefs = { ppn = 1; mem = 1; walltime = "24:00:00"; partition = null; slurmFlags = null; salloc = "/usr/bin/salloc"; srun = "/usr/bin/srun"; } // attrs;
diff --git a/test-tnpair.nix b/test-tnpair.nix
index f320f58..49c9bb9 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -74,6 +74,9 @@ let
strelka-indels = tnpairResult.variants.indels;
"strelka.snvs.vcf" = tnpairResult.variants.snvs;
"strelka.gl.vcf" = tnpairResult.glvariants;
+ manta = manta.call {} (with tnpairResult.alignments; {normals = [normal tumour]; });
+ mantaTN = manta.call {} (with tnpairResult.alignments; {normals = [normal]; tumour = tumour;});
+ mantaT = manta.call {} (with tnpairResult.alignments; {tumour = tumour;});
gridss = gridss.callVariants {} (with tnpairResult.alignments; [normal tumour]);
gridss2 = gridss.call (with tnpairResult.alignments; [normal tumour]);
gridss3 = gridss.callAndAssemble (with tnpairResult.alignments; [normal tumour]);
diff --git a/tools/manta-call.nix b/tools/manta-call.nix
new file mode 100644
index 0000000..e230a40
--- /dev/null
+++ b/tools/manta-call.nix
@@ -0,0 +1,40 @@
+{ bionix, indexAttrs ? {}, faidxAttrs ? {}, flags ? "" }:
+
+{ normals ? [], tumour ? null }:
+
+with bionix;
+with lib;
+with types;
+
+let
+ getref = matchFiletype "manta-call" { bam = x: x.ref; };
+ refs = map getref normals ++ optionals (tumour != null) [(getref tumour)];
+ ref = head refs;
+
+ renameAndIndex = f: stage {
+ name = "rename";
+ buildCommand = ''
+ mkdir $out
+ ln -s ${f} $out/sample.bam
+ ln -s ${samtools.index indexAttrs f} $out/sample.bam.bai
+ '';
+ };
+in
+
+assert (length (unique refs) == 1);
+
+stage {
+ name = "manta-call";
+ buildInputs = with pkgs; [ manta strace ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai
+ configManta.py ${optionalString (normals != null) (concatMapStringsSep " " (n: "--bam=${renameAndIndex n}/sample.bam") normals)} \
+ ${optionalString (tumour != null) "--tumourBam=${renameAndIndex tumour}/sample.bam"} \
+ --runDir=$TMPDIR \
+ --referenceFasta=ref.fa \
+ ${flags}
+ ./runWorkflow.py
+ cp -r results $out
+ '';
+}
diff --git a/tools/manta.nix b/tools/manta.nix
new file mode 100644
index 0000000..aa8b762
--- /dev/null
+++ b/tools/manta.nix
@@ -0,0 +1,7 @@
+{ bionix }:
+
+with bionix;
+
+{
+ call = callBionix ./manta-call.nix;
+}