aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2021-02-19 11:18:10 +1100
committerJustin Bedo <cu@cua0.org>2021-02-19 11:18:10 +1100
commit64f8b0cb124445620b30e10e268fd7670ccb3189 (patch)
tree8aba918a125ad0c780bf8ccb4c0e41b2ab91a7f9 /tools
parent834d736a00f5bd7155cb137d5a3e94e1413e8ada (diff)
samtools-index: support cram indexing
Diffstat (limited to 'tools')
-rw-r--r--tools/samtools-index.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/samtools-index.nix b/tools/samtools-index.nix
index d0f8d7a..62ee4c9 100644
--- a/tools/samtools-index.nix
+++ b/tools/samtools-index.nix
@@ -8,16 +8,19 @@ with bionix;
with lib;
with types;
-assert (matchFiletype "samtools-index" { bam = _: true; } input);
+assert (matchFiletype "samtools-index" { bam = _: true; cram = _: true; } input);
assert (matchFileSorting "samtools-index" { coord = _: true; } input);
+let
+ ext = matchFiletype "samtools-index-ext" { bam = _: "bam"; cram = _: "cram"; };
+in
+
stage {
name = "samtools-index";
buildInputs = with pkgs; [ samtools ];
buildCommand = ''
- ln -s ${input} input.bam
- samtools index -@ $NIX_BUILD_CORES ${optionalString (flags != null) flags} input.bam
- cp input.bam.bai $out
+ ln -s ${input} input.${ext input}
+ samtools index -@ $NIX_BUILD_CORES ${optionalString (flags != null) flags} input.${ext input} $out
'';
passthru.multicore = true;
}