aboutsummaryrefslogtreecommitdiff
path: root/tools
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 /tools
parent352425b6065d752cd065fda5fbcd4b8d253d4626 (diff)
manta: init
Diffstat (limited to 'tools')
-rw-r--r--tools/manta-call.nix40
-rw-r--r--tools/manta.nix7
2 files changed, 47 insertions, 0 deletions
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;
+}