aboutsummaryrefslogtreecommitdiff
path: root/tools/infercnv-app.nix
blob: 5114e2f3b7432cf98bcebe9487ee5a7d712cdfef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{stdenv
  ,fetchurl
  ,fetchFromGitHub
  ,callPackage
  ,nettools
  ,rPackages
  ,rWrapper
  ,R
  ,jre
  ,python
  ,pythonPackages
  ,darwin
  ,gettext
  ,gfortran
,makeWrapper}:

let
  buildRPackage = rPackages.buildRPackage;

  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}
  '';
}