aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2018-10-25 08:02:20 +1100
committerJustin Bedo <cu@cua0.org>2018-10-25 08:02:20 +1100
commit99ee99c490cc109b78986181ee1be4ce1cd0c0ed (patch)
treec909b5e3d151b6542b243c261593ad4a223132f2 /tools
parent92b4ea2ddac572f8bd830858132956829d92a734 (diff)
Improve type safety of samtools-merge
Diffstat (limited to 'tools')
-rw-r--r--tools/samtools-index.nix2
-rw-r--r--tools/samtools-merge.nix8
2 files changed, 4 insertions, 6 deletions
diff --git a/tools/samtools-index.nix b/tools/samtools-index.nix
index aad46a7..6919f97 100644
--- a/tools/samtools-index.nix
+++ b/tools/samtools-index.nix
@@ -10,7 +10,7 @@ with lib;
with bionix.types;
assert (matchFiletype "samtools-index" { bam = _: true; } input);
-assert (matchSorting "samtools-index" { coord = _: true; } input);
+assert (matchFileSorting "samtools-index" { coord = _: true; } input);
stdenv.mkDerivation {
name = "samtools-index";
diff --git a/tools/samtools-merge.nix b/tools/samtools-merge.nix
index 6d072b0..eacf520 100644
--- a/tools/samtools-merge.nix
+++ b/tools/samtools-merge.nix
@@ -10,13 +10,11 @@ with nixpkgs;
with lib;
let
- inherit (bionix.types) matchFiletype option-sort;
- inputIsSorted = input: matchFiletype "samtools-merge" {
- bam = _: true; #{sorting, ...}: sorting == option-sort.some (bionix.types.sorting.coord {});
- } input;
+ inherit (bionix.types) matchFiletype matchSorting;
+ inputIsHomogenous = length (unique (map (matchFiletype "samtools-merge" {bam = x: x // {sorting = matchSorting "samtools-merge" {coord = _: "coord";} x;};}) inputs)) == 1;
in
-assert (all inputIsSorted inputs);
+assert inputIsHomogenous;
stdenv.mkDerivation {
name = "samtools-merge";