aboutsummaryrefslogtreecommitdiff
path: root/tools/bwa-index2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bwa-index2.nix')
-rw-r--r--tools/bwa-index2.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/bwa-index2.nix b/tools/bwa-index2.nix
new file mode 100644
index 0000000..f5cc69b
--- /dev/null
+++ b/tools/bwa-index2.nix
@@ -0,0 +1,23 @@
+{ bionix
+, flags ? null
+}:
+
+ref:
+
+with bionix;
+with lib;
+with types;
+
+assert (matchFiletype "bwa-index" { fa = _: true; } ref);
+
+stage {
+ name = "bwa-index2";
+ buildInputs = with pkgs; [ bionix.bwa.app2 ];
+ buildCommand = ''
+ ln -s ${ref} ref.fa
+ bwa-mem2 index ${optionalString (flags != null) flags} ref.fa
+ mkdir $out
+ mv ref.fa.* $out
+ grep '^>[^ \t]*_alt$' ref.fa | tr -d '^>' > $out/idxbase.alt || true
+ '';
+}