From 8b97c7e8f685dd3c402e172ea15ef9716b529c8e Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Wed, 18 Dec 2019 09:54:54 +1100 Subject: lumpy: init --- default.nix | 1 + test-tnpair.nix | 1 + tools/lumpy-call.nix | 40 ++++++++++++++++++++++++++++++++++++++++ tools/lumpy.nix | 7 +++++++ 4 files changed, 49 insertions(+) create mode 100644 tools/lumpy-call.nix create mode 100644 tools/lumpy.nix diff --git a/default.nix b/default.nix index a7b9c52..acf08f9 100644 --- a/default.nix +++ b/default.nix @@ -42,6 +42,7 @@ let xenomapper = callBionix ./tools/xenomapper.nix {}; manta = callBionix ./tools/manta.nix {}; delly = callBionix ./tools/delly.nix {}; + lumpy = callBionix ./tools/lumpy.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 ae88549..38eb509 100644 --- a/test-tnpair.nix +++ b/test-tnpair.nix @@ -72,6 +72,7 @@ let "strelka.snvs.vcf" = tnpairResult.variants.snvs; "strelka.gl.vcf" = tnpairResult.glvariants; delly = delly.call {} (with tnpairResult.alignments; [normal tumour]); + lumpy = lumpy.call {} (with tnpairResult.alignments; [normal tumour]); 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;}); diff --git a/tools/lumpy-call.nix b/tools/lumpy-call.nix new file mode 100644 index 0000000..e5fb7d3 --- /dev/null +++ b/tools/lumpy-call.nix @@ -0,0 +1,40 @@ +{ bionix, flags ? "", faidxAttrs ? { }, indexAttrs ? { } }: + +inputs: + +with bionix; +with lib; +with types; + +let + getref = matchFiletype "manta-call" { bam = x: x.ref; }; + refs = map getref inputs; + 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 = "lumpy"; + buildInputs = with pkgs; [ lumpy ]; + buildCommand = '' + ln -s ${ref} ref.fa + ln -s ${samtools.faidx faidxAttrs ref} ref.fa.fai + lumpyexpress \ + ${ + concatMapStringsSep " " (i: "-B ${renameAndIndex i}/sample.bam") inputs + } \ + ${flags} \ + -o $out + ''; + passthru.filetype = filetype.vcf { ref = ref; }; +} diff --git a/tools/lumpy.nix b/tools/lumpy.nix new file mode 100644 index 0000000..0894054 --- /dev/null +++ b/tools/lumpy.nix @@ -0,0 +1,7 @@ +{ bionix }: + +with bionix; + +{ + call = callBionixE ./lumpy-call.nix; +} -- cgit v1.2.3