aboutsummaryrefslogtreecommitdiff
path: root/tools/sambamba-sort.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sambamba-sort.nix')
-rw-r--r--tools/sambamba-sort.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/sambamba-sort.nix b/tools/sambamba-sort.nix
new file mode 100644
index 0000000..efdd261
--- /dev/null
+++ b/tools/sambamba-sort.nix
@@ -0,0 +1,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;
+}