From 3ad53248deca12bda8351f187f322fd9bf6351a1 Mon Sep 17 00:00:00 2001
From: Justin Bedo <cu@cua0.org>
Date: Mon, 29 Oct 2018 15:32:26 +1100
Subject: init: samtools-fixmate

---
 tools/samtools-fixmate.nix | 25 +++++++++++++++++++++++++
 tools/samtools.nix         |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 tools/samtools-fixmate.nix

(limited to 'tools')

diff --git a/tools/samtools-fixmate.nix b/tools/samtools-fixmate.nix
new file mode 100644
index 0000000..6cb31bb
--- /dev/null
+++ b/tools/samtools-fixmate.nix
@@ -0,0 +1,25 @@
+{ bionix
+, nixpkgs
+, mateScore ? false
+, flags ? null
+}:
+
+input:
+
+with nixpkgs;
+with lib;
+with bionix.types;
+
+assert (matchFiletype "samtools-fixmate" { bam = _: true; } input);
+assert (matchFileSorting "samtools-fixmate" { name = _: true; } input);
+
+stdenv.mkDerivation {
+  name = "samtools-fixmate";
+  buildInputs = [ samtools ];
+  buildCommand = ''
+    samtools fixmate \
+      ${optionalString mateScore "-m"} \
+      ${optionalString (flags != null) flags} -O bam ${input} $out
+  '';
+  passthru.filetype = input.filetype;
+}
diff --git a/tools/samtools.nix b/tools/samtools.nix
index ea773eb..e26d996 100644
--- a/tools/samtools.nix
+++ b/tools/samtools.nix
@@ -10,4 +10,5 @@ with bionix;
   dict = callBionix ./samtools-dict.nix;
   sort = callBionix ./samtools-sort.nix;
   merge = callBionix ./samtools-merge.nix;
+  fixmate = callBionix ./samtools-fixmate.nix;
 }
-- 
cgit v1.2.3