From 6d22c07e9b0e8254da360b73bfab58b110118c58 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 16 Aug 2019 09:34:30 +1000 Subject: xenomapper: init --- tools/xenomapper-allocate.nix | 35 +++++++++++++++++++++++++++++++++++ tools/xenomapper.nix | 7 +++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/xenomapper-allocate.nix create mode 100644 tools/xenomapper.nix (limited to 'tools') diff --git a/tools/xenomapper-allocate.nix b/tools/xenomapper-allocate.nix new file mode 100644 index 0000000..3c0fc08 --- /dev/null +++ b/tools/xenomapper-allocate.nix @@ -0,0 +1,35 @@ +{ bionix +, flags ? null +}: + +{primary, secondary}: + +with bionix; +with lib; +with types; + +let + + isSortedBam = matchFiletype "xenomapper-allocate" {bam = matchSorting "xenomapper-allocate" { coord = _: false; name = _: true; none = _: false; }; }; + outs = [ "primary_specific" "primary_multi" "secondary_specific" "secondary_multi" "unassigned" "unresolved"]; + +in + +assert isSortedBam primary; +assert isSortedBam secondary; + +stage { + name = "xenomapper-allocate"; + buildInputs = with pkgs; [ samtools python3Packages.xenomapper ]; + outputs = [ "out" ] ++ outs; + buildCommand = '' + xenomapper ${optionalString (flags != null) flags} \ + --primary_bam ${primary} --secondary_bam ${secondary} \ + ${concatMapStringsSep " " (out: "--${out} >(samtools view -bS - > ${"$" + out})") outs} + + mkdir -p $out + for x in ${concatStringsSep " " outs} ; do + ln -s ''${!x} $out/$x.bam + done + ''; +} diff --git a/tools/xenomapper.nix b/tools/xenomapper.nix new file mode 100644 index 0000000..8247e25 --- /dev/null +++ b/tools/xenomapper.nix @@ -0,0 +1,7 @@ +{bionix}: + +with bionix; + +{ + allocate = callBionixE ./xenomapper-allocate.nix; +} \ No newline at end of file -- cgit v1.2.3