From 59edb7d9c37a688c8c408508c1a9ae5d37df348f Mon Sep 17 00:00:00 2001 From: lezhou8 Date: Fri, 24 Mar 2023 11:15:50 +1100 Subject: samtools.queryRegion: queries regions from a fasta file Only the indexing functionality of samtools faidx is used, rather than also the region querying functionality. --- tools/samtools-queryRegion.nix | 22 ++++++++++++++++++++++ tools/samtools.nix | 1 + 2 files changed, 23 insertions(+) create mode 100644 tools/samtools-queryRegion.nix (limited to 'tools') diff --git a/tools/samtools-queryRegion.nix b/tools/samtools-queryRegion.nix new file mode 100644 index 0000000..650e4f4 --- /dev/null +++ b/tools/samtools-queryRegion.nix @@ -0,0 +1,22 @@ +{ bionix +, flags ? null +, regions ? [] +}: + +input: + +with bionix; +with lib; +with types; + +assert (matchFiletype "samtools-queryRegion" { fa = _: true; } input); + +stage { + + name = "samtools-faidx"; + buildInputs = with pkgs; [ samtools ]; + buildCommand = '' + ln -s ${input} input.fasta + samtools faidx ${optionalString (flags != null) flags} input.fasta ${concatStringsSep " " regions} > $out + ''; +} diff --git a/tools/samtools.nix b/tools/samtools.nix index e0c45dd..32a563c 100644 --- a/tools/samtools.nix +++ b/tools/samtools.nix @@ -13,4 +13,5 @@ with bionix; markdup = callBionixE ./samtools-markdup.nix; fixmate = callBionixE ./samtools-fixmate.nix; tabix = callBionixE ./samtools-tabix.nix; + queryRegion = callBionixE ./samtools-queryRegion.nix; } -- cgit v1.2.3