aboutsummaryrefslogtreecommitdiff
path: root/tools/bwa-index2.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2019-06-21 10:07:29 +1000
committerJustin Bedo <cu@cua0.org>2019-06-21 10:42:30 +1000
commit2ad72c4c3d33f685297ecdeb799a91afae2dccb5 (patch)
treeaa6ab7bb45a73b4cf76709eb277dccca2e4b69f1 /tools/bwa-index2.nix
parent7231886ee52379de001ae830ed76a09be556ac57 (diff)
bwa-mem2: init
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
+ '';
+}