diff options
author | Justin Bedo <cu@cua0.org> | 2019-08-16 09:34:30 +1000 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2019-09-06 10:15:13 +1000 |
commit | 6d22c07e9b0e8254da360b73bfab58b110118c58 (patch) | |
tree | cd97ba4d48ca53210dd057d8e0a637fbaa19e7e3 /tools | |
parent | f361afeab23a4e7b74e0f58bb64b142f6bc3652b (diff) |
xenomapper: init
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xenomapper-allocate.nix | 35 | ||||
-rw-r--r-- | tools/xenomapper.nix | 7 |
2 files changed, 42 insertions, 0 deletions
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 |