aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2022-10-24 13:36:31 +1100
committerJustin Bedo <cu@cua0.org>2022-10-24 13:37:57 +1100
commit1a7ed52d1b3de6e1e7c8525cca3333c06930b90a (patch)
treec82b8ac5af2b841d2db302a7d67852e89260c898 /tools
parent36a0a03eda2ec8cf9b1f5fea8c437b68638d1de5 (diff)
octopus.call: fix naming error in throw
Diffstat (limited to 'tools')
-rw-r--r--tools/octopus-call.nix110
1 files changed, 52 insertions, 58 deletions
diff --git a/tools/octopus-call.nix b/tools/octopus-call.nix
index 8a78f01..6851971 100644
--- a/tools/octopus-call.nix
+++ b/tools/octopus-call.nix
@@ -1,73 +1,67 @@
-{ bionix
-, fast ? false
-, very-fast ? false
-, max-genotypes ? null
-, targets ? null
-, faidxAttrs ? { }
-, indexAttrs ? { }
-, flags ? ""
+{
+ bionix,
+ fast ? false,
+ very-fast ? false,
+ max-genotypes ? null,
+ targets ? null,
+ faidxAttrs ? {},
+ indexAttrs ? {},
+ flags ? "",
}:
-
assert !fast || !very-fast;
assert max-genotypes == null || max-genotypes > 0;
-
with bionix;
with lib;
with types;
+ inputs: let
+ getref = matchFiletype "octopus-call" {
+ bam = {ref, ...}: ref;
+ cram = {ref, ...}: ref;
+ };
+ refs = map getref inputs;
+ ref = head refs;
-inputs:
-
-let
- getref = matchFiletype "octopus-call" { bam = { ref, ... }: ref; cram = { ref, ... }: ref; };
- refs = map getref inputs;
- ref = head refs;
-
-
- handleTarget = x:
- let
+ handleTarget = x: let
type = builtins.typeOf x;
- handler = handlers."${type}" or (builtins.throw "octopus-callSomatic:unhandled target type:${type}");
+ handler = handlers."${type}" or (builtins.throw "octopus-call:unhandled target type:${type}");
handlers = {
string = "-T '${x}'";
- list =
- let file = pkgs.writeText "regions.txt" (concatStringsSep "\n" x);
- in "-t ${file}";
+ list = let
+ file = pkgs.writeText "regions.txt" (concatStringsSep "\n" x);
+ in "-t ${file}";
path = "-t ${x}";
set = "-t ${x}";
};
in
- handler;
-
-
-in
-
-assert (length (unique refs) == 1);
-
-stage {
- name = "octopus-call";
- buildInputs = with pkgs; [ octopus-caller ];
- outputs = [ "out" "evidence" ];
- 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}
- ${optionalString (length inputs > 1) "mkdir $evidence"}
- octopus -R ref.fa -I *.bam -o $out \
- --bamout $evidence \
- --threads=$NIX_BUILD_CORES \
- ${optionalString fast "--fast"} \
- ${optionalString very-fast "--very-fast"} \
- ${optionalString (max-genotypes != null) "--max-genotypes ${toString max-genotypes}"} \
- ${optionalString (targets != null) (handleTarget targets)} \
- ${flags}
+ handler;
+ in
+ assert (length (unique refs) == 1);
+ stage {
+ name = "octopus-call";
+ buildInputs = with pkgs; [octopus-caller];
+ outputs = ["out" "evidence"];
+ 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}
+ ${optionalString (length inputs > 1) "mkdir $evidence"}
+ octopus -R ref.fa -I *.bam -o $out \
+ --bamout $evidence \
+ --threads=$NIX_BUILD_CORES \
+ ${optionalString fast "--fast"} \
+ ${optionalString very-fast "--very-fast"} \
+ ${optionalString (max-genotypes != null) "--max-genotypes ${toString max-genotypes}"} \
+ ${optionalString (targets != null) (handleTarget targets)} \
+ ${flags}
- # Strip out octopus ARGV
- sed -i '/^##octopus=/d' $out
- '';
- passthru.filetype = filetype.vcf { inherit ref; };
- passthru.multicore = true;
- stripStorePaths = false;
-}
+ # Strip out octopus ARGV
+ sed -i '/^##octopus=/d' $out
+ '';
+ passthru.filetype = filetype.vcf {inherit ref;};
+ passthru.multicore = true;
+ stripStorePaths = false;
+ }