aboutsummaryrefslogtreecommitdiff
path: root/tools/subread-align.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/subread-align.nix')
-rw-r--r--tools/subread-align.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/subread-align.nix b/tools/subread-align.nix
new file mode 100644
index 0000000..0b0f4c1
--- /dev/null
+++ b/tools/subread-align.nix
@@ -0,0 +1,38 @@
+{ bionix
+, ref
+, flags ? null
+, indexAttrs ? { }
+, RG ? { }
+, type ? 1
+}:
+
+{ input1
+, input2 ? null
+}:
+
+with bionix;
+with lib;
+with types;
+with compression;
+
+let
+ fa = f: matchFiletype "subread-ref" { fa = _: f; } f;
+ fq = f: matchFiletype "subread-input" { fq = _: f; gz = matchFiletype' "subread-input" { fq = _: f; }; } f;
+
+in
+stage {
+ name = "subread-align";
+ buildInputs = with pkgs; [ subread ];
+ buildCommand = ''
+ subread-align -i ${bionix.subread.index indexAttrs ref}/ref ${optionalString (flags != null) flags} -T $NIX_BUILD_CORES \
+ -t ${toString type} \
+ -r ${fq input1} \
+ ${optionalString (input2 != null) "-R ${fq input2}"} \
+ ${optionalString (RG ? ID) ''
+ --rg-id ${RG.ID} ${concatMapAttrsStringsSep " " (k: v: "--rg ${k}:${v}") (filterAttrs (k: _: k != "ID") RG)} \
+ ''} \
+ -o $out
+ '';
+ passthru.filetype = filetype.bam { inherit ref; sorting = sort.none { }; };
+ passthru.multicore = true;
+}