diff options
Diffstat (limited to 'tools/samtools-merge.nix')
-rw-r--r-- | tools/samtools-merge.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/samtools-merge.nix b/tools/samtools-merge.nix new file mode 100644 index 0000000..6d072b0 --- /dev/null +++ b/tools/samtools-merge.nix @@ -0,0 +1,28 @@ +{ bionix +, nixpkgs +, flags ? null +, outfmt ? null +}: + +inputs: + +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; +in + +assert (all inputIsSorted inputs); + +stdenv.mkDerivation { + name = "samtools-merge"; + buildInputs = [ samtools ]; + buildCommand = '' + samtools merge ${optionalString (flags != null) flags} $out ${concatStringsSep " " inputs} + ''; + passthru.filetype = (builtins.elemAt inputs 0).filetype; +} |