aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix1
-rw-r--r--test-tnpair.nix1
-rw-r--r--tools/snver-app.nix24
-rw-r--r--tools/snver-call.nix40
-rw-r--r--tools/snver.nix10
5 files changed, 76 insertions, 0 deletions
diff --git a/default.nix b/default.nix
index 23e4f9b..5bc000a 100644
--- a/default.nix
+++ b/default.nix
@@ -37,6 +37,7 @@ let
ascat = callBionix ./tools/ascat.nix {};
fastp = callBionix ./tools/fastp.nix {};
octopus = callBionix ./tools/octopus.nix {};
+ snver = callBionix ./tools/snver.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 5d9fee2..eaabd9f 100644
--- a/test-tnpair.nix
+++ b/test-tnpair.nix
@@ -84,6 +84,7 @@ let
"${tnpair.tumour.name}.cram" = samtools.view { outfmt = types.toCram; } (tnpairResult.alignments.tumour);
"${tnpair.tumour.name}.fastqc.1" = check-fastqc tnpair.tumour.files.input1;
"${tnpair.tumour.name}.fastp" = check-fastp tnpair.tumour.files;
+ snver = snver.call { ploidy=1; } (with tnpairResult.alignments; [ normal tumour ]);
inherit alignments;
};
diff --git a/tools/snver-app.nix b/tools/snver-app.nix
new file mode 100644
index 0000000..3fd30f2
--- /dev/null
+++ b/tools/snver-app.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, jre, makeWrapper }:
+
+stdenv.mkDerivation rec {
+ pname = "SNVer";
+ version = "0.5.3";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/snver/SNVer-${version}.tar.gz";
+ sha256 = "1y3c3gm1zdh4iz6zh1lyaaq1ks205wjm3vwx6wdsnh896xrphf5c";
+ };
+
+ buildInputs = [ makeWrapper ];
+
+ unpackPhase = ''
+ mkdir -p $out/libexec/SNVer
+ tar -zxvf $src -C $out/libexec/SNVer
+ rm -rf $out/libexec/SNVer/test
+ '';
+
+ installPhase = ''
+ mkdir $out/bin
+ makeWrapper ${jre}/bin/java $out/bin/SNVerPool --add-flags "-jar $out/libexec/SNVer/SNVerPool.jar"
+ '';
+}
diff --git a/tools/snver-call.nix b/tools/snver-call.nix
new file mode 100644
index 0000000..645d151
--- /dev/null
+++ b/tools/snver-call.nix
@@ -0,0 +1,40 @@
+{ bionix
+, flags ? null
+, ploidy
+}:
+
+inputs:
+
+with bionix;
+with lib;
+with types;
+
+let
+ config = pkgs.writeText "pool.txt" (concatMapStringsSep "\n" (x: "${x}\t${toString ploidy}\t1") inputs);
+ getref = f: matchFiletype "SNVer-call" { bam = {ref, ...}: ref; } f;
+ refs = map getref inputs;
+ ref = head refs;
+in
+
+assert (length (unique refs) == 1);
+
+stage {
+ name = "SNVerPool";
+ buildInputs = [ snver.app ];
+ outputs = [ "out" "log" "raw" "filter" "indelfilter" "indelraw" ];
+ buildCommand = ''
+ SNVerPool -i / -c ${config} -r ${ref} -o snver
+
+ mkdir $out
+ cp snver.failed.log $log
+ ln -s $log $out/snver.failed.log
+ cp snver.filter.vcf $filter
+ ln -s $log $out/snver.filter.vcf
+ cp snver.indel.filter.vcf $indelfilter
+ ln -s $log $out/snver.indel.filter.vcf
+ cp snver.indel.raw.vcf $indelraw
+ ln -s $log $out/snver.indel.raw.vcf
+ cp snver.raw.vcf $raw
+ ln -s $log $out/snver.raw.vcf
+ '';
+}
diff --git a/tools/snver.nix b/tools/snver.nix
new file mode 100644
index 0000000..7c84777
--- /dev/null
+++ b/tools/snver.nix
@@ -0,0 +1,10 @@
+{ bionix }:
+
+with bionix;
+with pkgs;
+
+{
+ app = callPackage ./snver-app.nix {};
+
+ call = callBionix ./snver-call.nix;
+}