aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix37
-rw-r--r--tools/infercnv-app.nix93
-rw-r--r--tools/infercnv-infer.nix24
-rw-r--r--tools/infercnv-ngchmr.patch13
-rw-r--r--tools/infercnv.nix9
5 files changed, 158 insertions, 18 deletions
diff --git a/default.nix b/default.nix
index 7002a57..2ce7b1d 100644
--- a/default.nix
+++ b/default.nix
@@ -4,27 +4,28 @@ let
bionix = nixpkgs.lib.makeExtensible (self:
let callBionix = file: attrs: import file ({ bionix = self; nixpkgs = nixpkgs; } // attrs);
in with self; {
- callBionix = callBionix;
- id = x: x;
+ callBionix = callBionix;
+ id = x: x;
- types = callBionix ./lib/types.nix {};
+ types = callBionix ./lib/types.nix {};
- bwa = callBionix ./tools/bwa.nix {};
- compression = callBionix ./tools/compression.nix {};
- crumble = callBionix ./tools/crumble.nix {};
- fastqc = callBionix ./tools/fastqc.nix {};
- gridss = callBionix ./tools/gridss.nix {};
- mosdepth = callBionix ./tools/mosdepth.nix {};
- platypus = callBionix ./tools/platypus.nix {};
- samtools = callBionix ./tools/samtools.nix {};
- strelka = callBionix ./tools/strelka.nix {};
+ bwa = callBionix ./tools/bwa.nix {};
+ compression = callBionix ./tools/compression.nix {};
+ crumble = callBionix ./tools/crumble.nix {};
+ fastqc = callBionix ./tools/fastqc.nix {};
+ gridss = callBionix ./tools/gridss.nix {};
+ infercnv = callBionix ./tools/infercnv.nix {};
+ mosdepth = callBionix ./tools/mosdepth.nix {};
+ platypus = callBionix ./tools/platypus.nix {};
+ samtools = callBionix ./tools/samtools.nix {};
+ strelka = callBionix ./tools/strelka.nix {};
- qsub = nixpkgs.callPackage ./lib/qsub.nix {};
- qsubAttr = qsubAttrs: f: attrs: i: qsub qsubAttrs (f attrs i);
- qsubAttrs = attrs: nixpkgs.lib.mapAttrs (_: x: qsubAttr attrs x);
- ref = callBionix ./lib/references.nix {};
- def = f: defs: attrs: f (defs // attrs);
- defQsub = qsubAttrs: f: defs: qsubAttr qsubAttrs (def f defs);
+ qsub = nixpkgs.callPackage ./lib/qsub.nix {};
+ qsubAttr = qsubAttrs: f: attrs: i: qsub qsubAttrs (f attrs i);
+ qsubAttrs = attrs: nixpkgs.lib.mapAttrs (_: x: qsubAttr attrs x);
+ ref = callBionix ./lib/references.nix {};
+ def = f: defs: attrs: f (defs // attrs);
+ defQsub = qsubAttrs: f: defs: qsubAttr qsubAttrs (def f defs);
});
in bionix
diff --git a/tools/infercnv-app.nix b/tools/infercnv-app.nix
new file mode 100644
index 0000000..ad6a16f
--- /dev/null
+++ b/tools/infercnv-app.nix
@@ -0,0 +1,93 @@
+{stdenv
+ ,fetchurl
+ ,fetchFromGitHub
+ ,callPackage
+ ,nettools
+ ,rPackages
+ ,rWrapper
+ ,R
+ ,jre
+ ,python
+ ,pythonPackages
+ ,darwin
+ ,gettext
+ ,gfortran
+,makeWrapper}:
+
+let
+ buildRPackage = callPackage "${<nixpkgs>}/pkgs/development/r-modules/generic-builder.nix" {
+ inherit R gettext gfortran;
+ inherit (darwin.apple_sdk.frameworks) Cocoa Foundation;
+ };
+
+ GMD = buildRPackage rec {
+ name = "GMD-${version}";
+ version = "0.3.3";
+ src = fetchurl {
+ url = "https://cran.r-project.org/src/contrib/Archive/GMD/GMD_0.3.3.tar.gz";
+ sha256 = "0jshdcmqcr7lz4p5xb76qbaqavm2609r01lhi9hd0aqnnry18kmg";
+ };
+ buildInputs = with rPackages; [ R gplots ];
+ };
+
+ NGCHMR = buildRPackage rec {
+ name = "NGCHMR-${version}";
+ version = "git";
+ src = fetchFromGitHub {
+ owner = "bmbroom";
+ repo = "NGCHMR";
+ rev = "9f5f1fbf39339d21295b5056e469edcdcbaae142";
+ sha256 = "0paw3fz22kbk4ps4mfxzfchqvipspl7a60jsz46fsg10v6d3z7yv";
+ };
+ propagatedBuildInputs = with rPackages; [ R tsvio digest httr jsonlite nettools ];
+ patches = [ ./infercnv-ngchmr.patch ];
+ };
+
+ tsvio = buildRPackage rec {
+ name = "tsvio-${version}";
+ version = "git";
+ src = fetchFromGitHub {
+ owner = "bmbroom";
+ repo = "tsvio";
+ rev = "067b01ffc1491d50fc1e104b1fe36208a3997980";
+ sha256 = "05byfn2bim51wswffs9lm23p4i0bghyn63rny480dvagydn1a85c";
+ };
+ };
+
+ inferCNV = buildRPackage rec {
+ name = "inferCNV-${version}";
+ version = "git";
+ requireX = false;
+ src = fetchFromGitHub {
+ owner = "broadinstitute";
+ repo = "inferCNV";
+ rev = "cf442af0db6191fa8ba57c4921ac2d1f98c2c39d";
+ sha256 = "0cv8qiaqpd6b4152dplnzvgv77cmk961rmvzr27qgmlaazc5hblh";
+ };
+ propagatedBuildInputs = with rPackages; [ R GMD NGCHMR RColorBrewer gplots optparse logging ];
+ };
+
+ r = rWrapper.override {
+ packages = with rPackages; [ inferCNV ape ];
+ };
+
+ py = python.withPackages (pkgs: with pkgs; [ statistics ]);
+
+ shaidymapgen = fetchurl {
+ url = "http://tcga.ngchm.net/NGCHM/ShaidyMapGen.jar";
+ sha256 = "1pz710ig8nnydz329ry8fydccbrp3arp614dgba3bcyy9flm3gnw";
+ };
+
+in stdenv.mkDerivation rec {
+ name = inferCNV.name;
+ src = inferCNV.src;
+ buildInputs = [ r makeWrapper py ];
+ propagatedBuildInputs = [ jre ];
+ installPhase = ''
+ mkdir -p $out/bin
+ cp scripts/* $out/bin
+ '';
+ postFixup = ''
+ wrapProgram $out/bin/inferCNV.R --set SHAIDYMAPGEN=${shaidymapgen}
+ '';
+}
diff --git a/tools/infercnv-infer.nix b/tools/infercnv-infer.nix
new file mode 100644
index 0000000..95ebbe3
--- /dev/null
+++ b/tools/infercnv-infer.nix
@@ -0,0 +1,24 @@
+{bionix
+,nixpkgs
+,flags ? null}:
+
+with nixpkgs;
+with lib;
+
+{ref
+,expr
+,pos}:
+
+stdenv.mkDerivation {
+ name = "inferCNV";
+ buildInputs = [ bionix.infercnv.app ];
+ buildCommand = ''
+ inferCNV.R --output_dir $TMPDIR \
+ ${optionalString (flags != null) flags} \
+ --ref ${ref} \
+ ${expr} \
+ ${pos}
+ mkdir $out
+ cp -r $TMPDIR/* $out
+ '';
+}
diff --git a/tools/infercnv-ngchmr.patch b/tools/infercnv-ngchmr.patch
new file mode 100644
index 0000000..454cf5d
--- /dev/null
+++ b/tools/infercnv-ngchmr.patch
@@ -0,0 +1,13 @@
+diff --git a/inst/base.config/conf.d/01-server-protocol-scl.R b/inst/base.config/conf.d/01-server-protocol-scl.R
+index 1ae302a..6156fa3 100644
+--- a/inst/base.config/conf.d/01-server-protocol-scl.R
++++ b/inst/base.config/conf.d/01-server-protocol-scl.R
+@@ -3,7 +3,7 @@
+ (function() {
+
+ if (Sys.info()[['sysname']] != "Windows") {
+- thisHost <- c("localhost", system("/bin/hostname -f", intern=TRUE));
++ thisHost <- c("localhost", system("hostname -f", intern=TRUE));
+ } else {
+ thisHost <- c("localhost", paste(Sys.getenv('COMPUTERNAME'),Sys.getenv('USERDNSDOMAIN'),sep='.'));
+ }
diff --git a/tools/infercnv.nix b/tools/infercnv.nix
new file mode 100644
index 0000000..518ca76
--- /dev/null
+++ b/tools/infercnv.nix
@@ -0,0 +1,9 @@
+{nixpkgs, bionix}:
+
+with nixpkgs;
+with bionix;
+
+{
+ app = callPackage ./infercnv-app.nix {};
+ infercnv = callBionix ./infercnv-infer.nix {};
+}