From c48e7b40c82326006136463282b803eebc648df0 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 16 Dec 2019 20:43:04 +1100 Subject: manta: init --- tools/manta-call.nix | 40 ++++++++++++++++++++++++++++++++++++++++ tools/manta.nix | 7 +++++++ 2 files changed, 47 insertions(+) create mode 100644 tools/manta-call.nix create mode 100644 tools/manta.nix (limited to 'tools') diff --git a/tools/manta-call.nix b/tools/manta-call.nix new file mode 100644 index 0000000..e230a40 --- /dev/null +++ b/tools/manta-call.nix @@ -0,0 +1,40 @@ +{ bionix, indexAttrs ? {}, faidxAttrs ? {}, flags ? "" }: + +{ normals ? [], tumour ? null }: + +with bionix; +with lib; +with types; + +let + getref = matchFiletype "manta-call" { bam = x: x.ref; }; + refs = map getref normals ++ optionals (tumour != null) [(getref tumour)]; + ref = head refs; + + renameAndIndex = f: stage { + name = "rename"; + buildCommand = '' + mkdir $out + ln -s ${f} $out/sample.bam + ln -s ${samtools.index indexAttrs f} $out/sample.bam.bai + ''; + }; +in + +assert (length (unique refs) == 1); + +stage { + name = "manta-call"; + buildInputs = with pkgs; [ manta strace ]; + buildCommand = '' + ln -s ${ref} ref.fa + ln -s ${bionix.samtools.faidx faidxAttrs ref} ref.fa.fai + configManta.py ${optionalString (normals != null) (concatMapStringsSep " " (n: "--bam=${renameAndIndex n}/sample.bam") normals)} \ + ${optionalString (tumour != null) "--tumourBam=${renameAndIndex tumour}/sample.bam"} \ + --runDir=$TMPDIR \ + --referenceFasta=ref.fa \ + ${flags} + ./runWorkflow.py + cp -r results $out + ''; +} diff --git a/tools/manta.nix b/tools/manta.nix new file mode 100644 index 0000000..aa8b762 --- /dev/null +++ b/tools/manta.nix @@ -0,0 +1,7 @@ +{ bionix }: + +with bionix; + +{ + call = callBionix ./manta-call.nix; +} -- cgit v1.2.3