From c48e7b40c82326006136463282b803eebc648df0 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 16 Dec 2019 20:43:04 +1100 Subject: manta: init --- default.nix | 1 + test-tnpair.nix | 3 +++ tools/manta-call.nix | 40 ++++++++++++++++++++++++++++++++++++++++ tools/manta.nix | 7 +++++++ 4 files changed, 51 insertions(+) create mode 100644 tools/manta-call.nix create mode 100644 tools/manta.nix diff --git a/default.nix b/default.nix index 49de832..7ad804f 100644 --- a/default.nix +++ b/default.nix @@ -40,6 +40,7 @@ let snver = callBionix ./tools/snver.nix {}; hisat2 = callBionix ./tools/hisat2.nix {}; xenomapper = callBionix ./tools/xenomapper.nix {}; + manta = callBionix ./tools/manta.nix {}; slurm = attrs: bionix.extend (self: super: with self; rec { slurmDefs = { ppn = 1; mem = 1; walltime = "24:00:00"; partition = null; slurmFlags = null; salloc = "/usr/bin/salloc"; srun = "/usr/bin/srun"; } // attrs; diff --git a/test-tnpair.nix b/test-tnpair.nix index f320f58..49c9bb9 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -74,6 +74,9 @@ let strelka-indels = tnpairResult.variants.indels; "strelka.snvs.vcf" = tnpairResult.variants.snvs; "strelka.gl.vcf" = tnpairResult.glvariants; + manta = manta.call {} (with tnpairResult.alignments; {normals = [normal tumour]; }); + mantaTN = manta.call {} (with tnpairResult.alignments; {normals = [normal]; tumour = tumour;}); + mantaT = manta.call {} (with tnpairResult.alignments; {tumour = tumour;}); gridss = gridss.callVariants {} (with tnpairResult.alignments; [normal tumour]); gridss2 = gridss.call (with tnpairResult.alignments; [normal tumour]); gridss3 = gridss.callAndAssemble (with tnpairResult.alignments; [normal tumour]); 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