aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/compression-bunzip2.nix12
-rw-r--r--tools/compression-bzip2.nix12
-rw-r--r--tools/compression-gunzip.nix12
-rw-r--r--tools/compression-gzip.nix12
-rw-r--r--tools/compression.nix40
5 files changed, 63 insertions, 25 deletions
diff --git a/tools/compression-bunzip2.nix b/tools/compression-bunzip2.nix
new file mode 100644
index 0000000..06fe682
--- /dev/null
+++ b/tools/compression-bunzip2.nix
@@ -0,0 +1,12 @@
+{bionix}:
+
+with bionix;
+
+input:
+
+stage {
+ name = "bunzip2";
+ buildInputs = with pkgs; [ bzip2 ];
+ buildCommand = "bunzip2 < ${input} > $out";
+ passthru.filetype = types.bunzip2 input;
+}
diff --git a/tools/compression-bzip2.nix b/tools/compression-bzip2.nix
new file mode 100644
index 0000000..6dfb749
--- /dev/null
+++ b/tools/compression-bzip2.nix
@@ -0,0 +1,12 @@
+{bionix}:
+
+with bionix;
+
+input:
+
+stage {
+ name = "bzip2";
+ buildInputs = with pkgs; [ bzip2 ];
+ buildCommand = "bzip2 < ${input} > $out";
+ passthru.filetype = filetype.bz2 input.filetype;
+}
diff --git a/tools/compression-gunzip.nix b/tools/compression-gunzip.nix
new file mode 100644
index 0000000..6c98f91
--- /dev/null
+++ b/tools/compression-gunzip.nix
@@ -0,0 +1,12 @@
+{bionix}:
+
+with bionix;
+
+input:
+
+stage {
+ name = "gunzip";
+ buildInputs = with pkgs; [ gzip ];
+ buildCommand = "gunzip < ${input} > $out";
+ passthru.filetype = types.gunzip input;
+}
diff --git a/tools/compression-gzip.nix b/tools/compression-gzip.nix
new file mode 100644
index 0000000..50fca9e
--- /dev/null
+++ b/tools/compression-gzip.nix
@@ -0,0 +1,12 @@
+{bionix}:
+
+with bionix;
+
+input:
+
+stage {
+ name = "gzip";
+ buildInputs = with pkgs; [ gzip ];
+ buildCommand = "gzip < ${input} > $out";
+ passthru.filetype = filetype.gzip input.filetype;
+}
diff --git a/tools/compression.nix b/tools/compression.nix
index 6e69d7e..bfcc292 100644
--- a/tools/compression.nix
+++ b/tools/compression.nix
@@ -1,9 +1,15 @@
{bionix}:
with bionix;
+with types;
-{
- uncompress = f: types.matchFiletype "uncompress" {
+let
+ gzip = callBionixE ./compression-gzip.nix;
+ gunzip = callBionixE ./compression-gunzip.nix;
+ bunzip2 = callBionixE ./compression-bunzip2.nix;
+
+in {
+ uncompress = attrs: f: matchFiletype "uncompress" {
fa = _: f;
fq = _: f;
bam = _: f;
@@ -11,23 +17,12 @@ with bionix;
cram = _: f;
vcf = _: f;
bed = _: f;
- gz = _: types.tagFiletype (types.gunzip f.filetype) (stage {
- name = "gunzip";
- buildCommand = "gunzip < ${f} > $out";
- });
- bz2 = _: types.tagFiletype (types.bunzip2 f.filetype) (stage {
- name = "bunzip2";
- buildCommand = "bunzip2 < ${f} > $out";
- });
- } f.filetype;
+ gz = _: gunzip attrs f;
+ bz2 = _: bunzip2 attrs f;
+ } f;
- gzip = f:
- let
- gz = (stage {
- name = "gzip";
- buildCommand = "gzip < ${f} > $out";
- passthru = { filetype = types.filetype.gz f.filetype; };
- });
+ gzip = attrs: f:
+ let gz = gzip attrs f;
in types.matchFiletype "compressed" {
fa = _: gz;
fq = _: gz;
@@ -39,13 +34,8 @@ with bionix;
gz = x: x;
} f;
- bzip2 = f:
- let
- bz2 = (stage {
- name = "bzip2";
- buildCommand = "bzip2 < ${f} > $out";
- passthru = { filetype = types.filetype.bz2 f.filetype; };
- });
+ bzip2 = attrs: f:
+ let bz2 = bzip2 attrs f;
in types.matchFiletype "compressed" {
fa = _: gz;
fq = _: gz;