aboutsummaryrefslogtreecommitdiff
path: root/tools/octopus-call.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-06-19 11:24:38 +1000
committerJustin Bedo <cu@cua0.org>2019-07-03 14:59:27 +1000
commit0b6b3fa8fc20461b41a368b82c62c2f9d7472b31 (patch)
tree5c0e9aaf7fce678f1b930c3d27bfafb88ffc7a27 /tools/octopus-call.nix
parent999743ce240460dc25b29ed1a4db0989fd3e955c (diff)
octopus: initial functions
Diffstat (limited to 'tools/octopus-call.nix')
-rw-r--r--tools/octopus-call.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/octopus-call.nix b/tools/octopus-call.nix
new file mode 100644
index 0000000..f88960c
--- /dev/null
+++ b/tools/octopus-call.nix
@@ -0,0 +1,37 @@
+{ bionix
+, faidxAttrs ? {}
+, indexAttrs ? {}
+, flags ? ""}:
+
+with bionix;
+with lib;
+with types;
+
+inputs:
+
+let
+ getref = f: matchFiletype "octopus-callSomatic" { bam = {ref, ...}: ref; cram = {ref, ...}: ref;} f;
+ refs = map getref inputs;
+ ref = head refs;
+
+in
+
+assert (length (unique refs) == 1);
+
+stage {
+ name = "octopus-call";
+ buildInputs = with pkgs; [ octopus-caller ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ ln -s ${samtools.faidx faidxAttrs ref} ref.fai
+ ${concatMapStringsSep "\n" (i: ''
+ ln -s ${i} $(basename ${i}).bam
+ ln -s ${samtools.index indexAttrs i} $(basename ${i}).bai
+ '') inputs}
+ octopus -R ref.fa -I *.bam -o $out \
+ --threads=$NIX_BUILD_CORES \
+ ${flags}
+ '';
+ passthru.filtype = filetype.vcf {ref = ref;};
+ passthru.multicore = true;
+}