diff options
author | Justin Bedo <cu@cua0.org> | 2018-10-23 13:59:45 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2018-10-23 13:59:45 +1100 |
commit | 8002173b2aa2b0a4e1c0300bb4e2aa0422849e65 (patch) | |
tree | 3fb96c8ded694dc54dcc37e27ddac14097e0137f /tools | |
parent | c768093d0e8990657a42b1668c5f86048cbc6675 (diff) |
Wrap inferCNV
Resolves #8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/infercnv-app.nix | 93 | ||||
-rw-r--r-- | tools/infercnv-infer.nix | 24 | ||||
-rw-r--r-- | tools/infercnv-ngchmr.patch | 13 | ||||
-rw-r--r-- | tools/infercnv.nix | 9 |
4 files changed, 139 insertions, 0 deletions
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 {}; +} |