aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-12-17 12:51:51 +1100
committerJustin Bedo <cu@cua0.org>2019-12-17 12:52:04 +1100
commit123d38340bd38524f0c53a52ccb3d57d43e6fb6d (patch)
tree9e2700e16a26b582f87c239a3a031ee394e9ff79 /tools
parenteb2769421dc7fce6de81c6bf79946b2f050c215b (diff)
delly: missing file
Diffstat (limited to 'tools')
-rw-r--r--tools/delly-call.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/delly-call.nix b/tools/delly-call.nix
new file mode 100644
index 0000000..5378810
--- /dev/null
+++ b/tools/delly-call.nix
@@ -0,0 +1,46 @@
+{ bionix, flags ? "", faidxAttrs ? {}, indexAttrs ? {}}:
+
+inputs:
+
+with bionix;
+with lib;
+with types;
+
+let
+ getref = matchFiletype "delly-call" { bam = x: x.ref; };
+ refs = map getref inputs;
+ 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 = "delly-call";
+ buildInputs = with pkgs; [ delly bcftools ];
+ buildCommand = ''
+ export OMP_NUM_THREADS=$NIX_BUILD_CORES
+ ln -s ${ref} ref.fa
+ ln -s ${samtools.faidx faidxAttrs ref} ref.fa.fai
+ delly call \
+ -o delly.bcf \
+ -g ref.fa \
+ ${concatMapStringsSep " " (i: "${renameAndIndex i}/sample.bam") inputs} \
+ ${flags}
+ bcftools view delly.bcf > $out
+ '';
+ passthru = {
+ multicore = true;
+ filetype = filetype.vcf { ref = ref; };
+ };
+}