From 173e7a758569796a91120379853b94f35dcc4a81 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Tue, 25 Jan 2022 12:03:45 +1100 Subject: add bgz support and fix nested compression support --- tools/compression.nix | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'tools/compression.nix') diff --git a/tools/compression.nix b/tools/compression.nix index c9c8777..b32d057 100644 --- a/tools/compression.nix +++ b/tools/compression.nix @@ -20,6 +20,7 @@ in vcf = _: f; bed = _: f; gz = _: gunzip attrs f; + bgz = _: gunzip attrs f; bz2 = _: bunzip2 attrs f; } f; @@ -36,10 +37,31 @@ in cram = _: gz; vcf = _: gz; bed = _: gz; - gz = x: x; + gz = _: f; + bgz = _: f; + bz2 = _: with compression; gzip { } (uncompress { } f); } f; + bgzip = attrs: f: + let gz = gzip (attrs // { block = true; }) f; + in + types.matchFiletype "compressed" + { + fa = _: gz; + fq = _: gz; + bam = _: gz; + sam = _: gz; + cram = _: gz; + vcf = _: gz; + bed = _: gz; + bgz = _: f; + gz = _: with compression; bgzip { } (uncompress { } f); + bz2 = _: with compression; bgzip { } (uncompress { } f); + } + f; + + bzip2 = attrs: f: let bz2 = bzip2 attrs f; in @@ -52,7 +74,9 @@ in cram = _: gz; vcf = _: gz; bed = _: gz; - bz2 = x: x; + bz2 = _: f; + bgz = _: with compression; bzip2 { } (uncompress { } f); + gz = _: with compression; bzip2 { } (uncompress { } f); } f; } -- cgit v1.2.3