blob: 6d072b0621c75bfa1a5af21f3e3967c21df86eed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}
|