From 6a4e278ef941a687d704261c903b95d4b63cf334 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Tue, 23 Feb 2021 08:21:32 +1100 Subject: samtools-view: support specifying outfmt via strings --- tools/samtools-view.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/samtools-view.nix b/tools/samtools-view.nix index e1ca0a8..35a3fcb 100644 --- a/tools/samtools-view.nix +++ b/tools/samtools-view.nix @@ -13,7 +13,7 @@ with types; assert (matchFiletype "samtools-view" { bam = _: true; sam = _: true; cram = _: true; } input); let - outfmtR = if outfmt != null then outfmt input else input.filetype; + outfmtR = if outfmt != null then (if builtins.typeOf outfmt == "string" then { "bam" = toBam; "cram" = toCram; "sam" = toSam; }."${outfmt}" else outfmt) input else input.filetype; fa = ref: matchFiletype "samtools-view-ref" { fa = _: ref; } ref; outfmtFlags = matchFiletype "samtools-view-outfmt" { bam = _: "-O BAM"; sam = _: "-O SAM"; cram = x: "-O CRAM -T ${fa x.ref}"; } {filetype = outfmtR;}; in stage { -- cgit v1.2.3