aboutsummaryrefslogtreecommitdiff
path: root/tools/sambamba-sort.nix
blob: efdd2612fd7fd310bfd1700581b37e218a1fbcf6 (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
29
{ bionix
, nameSort ? false
, flags ? null
}:

input:

with bionix;
with lib;

let
  inherit (bionix.types) matchFiletype coordSort matchFileSorting;
in

assert (matchFiletype "sambamba-sort" { bam = _: true; } input);

stage {
  name = "sambamba-sort";
  buildInputs = [ pkgs.sambamba ];
  buildCommand = ''
    sambamba sort -t $NIX_BUILD_CORES \
      ${optionalString nameSort "-n"} \
      ${optionalString (flags != null) flags} \
      -o $out \
      ${input}
  '';
  passthru.filetype = if nameSort then bionix.types.nameSort input.filetype else coordSort input.filetype;
  passthru.multicore = true;
}