aboutsummaryrefslogtreecommitdiff
path: root/tools/octopus-call.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/octopus-call.nix')
-rw-r--r--tools/octopus-call.nix29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/octopus-call.nix b/tools/octopus-call.nix
index f33d87c..80092e0 100644
--- a/tools/octopus-call.nix
+++ b/tools/octopus-call.nix
@@ -3,9 +3,10 @@
, very-fast ? false
, max-genotypes ? null
, targets ? null
-, faidxAttrs ? {}
-, indexAttrs ? {}
-, flags ? ""}:
+, faidxAttrs ? { }
+, indexAttrs ? { }
+, flags ? ""
+}:
assert !fast || !very-fast;
assert max-genotypes == null || max-genotypes > 0;
@@ -17,10 +18,26 @@ with types;
inputs:
let
- getref = f: matchFiletype "octopus-call" { bam = {ref, ...}: ref; cram = {ref, ...}: ref;} f;
+ getref = f: matchFiletype "octopus-call" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; } f;
refs = map getref inputs;
ref = head refs;
+
+ handleTarget = x:
+ let
+ type = builtins.typeOf x;
+ handler = handlers."${type}" or (builtins.throw "octopus-callSomatic:unhandled target type:${type}");
+ handlers = {
+ string = "-T '${x}'";
+ list =
+ let file = pkgs.writeText "regions.txt" (concatStringsSep "\n" x);
+ in "-t ${file}";
+ path = "-t ${x}";
+ };
+ in
+ handler;
+
+
in
assert (length (unique refs) == 1);
@@ -43,9 +60,9 @@ stage {
${optionalString fast "--fast"} \
${optionalString very-fast "--very-fast"} \
${optionalString (max-genotypes != null) "--max-genotypes ${toString max-genotypes}"} \
- ${optionalString (targets != null) (if builtins.typeOf targets == "list" then "-T ${concatStringsSep "," targets}" else "-t ${targets}")} \
+ ${optionalString (targets != null) (handleTarget targets)} \
${flags}
'';
- passthru.filetype = filetype.vcf {ref = ref;};
+ passthru.filetype = filetype.vcf { ref = ref; };
passthru.multicore = true;
}