build-bazel-package: added rm of extra local folders for toolchain configuration...
[NixPkgs.git] / pkgs / by-name / ve / vep / package.nix
blob576b4c9b35fbf1ee5eed3f82f1f5570ec5f6d636
1 # Instructions:http://www.ensembl.org/info/docs/api/api_installation.html,
2 # Do not use https://github.com/Ensembl/ensembl-vep/archive/release/${version}.zip
3 # We cannot use INSTALL.pl but it’s not that bad:install the dependencies and copies the .pm files should be ok
5   lib,
6   htslib,
7   perlPackages,
8   stdenv,
9   fetchFromGitHub,
10   perl,
11   makeWrapper,
14 let
15   version = "110";
16   customInstallPhase = ''
17     mkdir -p $out/${perl.libPrefix}/${perl.version}/
18     tests=$(find modules/ -mindepth 1 -maxdepth 1 -type d | grep -v t)
19     cp -r $tests $out/${perl.libPrefix}/${perl.version}/
20   '';
22   ensemblGit =
23     name: sha256:
24     # Copy modules directly
25     stdenv.mkDerivation {
26       inherit name version;
27       src = fetchFromGitHub {
28         inherit sha256 version;
29         owner = "Ensembl";
30         repo = name;
31         rev = "release/${version}";
32       };
33       installPhase = ''
34         runHook preInstall
36         ${customInstallPhase}
38         runHook postInstall'';
39     };
41   vepPlugins = fetchFromGitHub {
42     owner = "Ensembl";
43     repo = "VEP_plugins";
44     rev = "8f271c4848338dc7d504881ff71fdf2892c3d096";
45     sha256 = "sha256-LbaXwLFDP3m1QhRHwO9uh36BEFHE2NzL4xdxTb7/S5Q=";
46   };
48   # Install ensembl-xs, faster run using re-implementation in C of some of the Perl subroutines
49   ensembl-xs = perlPackages.buildPerlPackage rec {
50     pname = "ensembl-xs";
51     version = "2.3.2";
52     src = fetchFromGitHub {
53       inherit version;
54       owner = "Ensembl";
55       repo = "ensembl-xs";
56       rev = version;
57       sha256 = "1qqnski532f4bz32wxbqd9w1sz40rjh81ipp9p02k3rlaf1gp1fa";
58     };
59     # PREFIX is important
60     configurePhase = ''
61       perl Makefile.PL PREFIX=$out INSTALLDIRS=site
62     '';
63     # Test do not work -- wrong include path
64     doCheck = false;
65   };
67   # it contains compiled versions of certain key subroutines used in VEP
68   ensembl = ensemblGit "ensembl" "sha256-ZhI4VNxIY+53RX2uYRNlFeo/ydAmlwGx00WDXaxv6h4=";
69   ensembl-io = ensemblGit "ensembl-io" "sha256-r3RvN5U2kcyghoKM0XuiBRe54t1U4FaZ0QEeYIFiG0w=";
70   ensembl-variation = ensemblGit "ensembl-variation" "sha256-UjrLHF9EqI+Mp+SZR4sLNZUCGiA/UYhoFWtpwiKF8tM=";
71   ensembl-funcgen = ensemblGit "ensembl-funcgen" "sha256-a9hxLBoXJsF5JWuRdpyOac1u033M8ivEjEQecuncghs=";
73 perlPackages.buildPerlModule rec {
74   inherit version;
75   pname = "vep";
76   buildInputs =
77     (with perlPackages; [
78       ArchiveZip
79       BioBigFile
80       BioDBHTS
81       BioExtAlign
82       BioPerl
83       DBI
84       DBDmysql
85       LWP
86       JSON
87     ])
88     ++ [
89       ensembl-xs
90       ensembl
91       ensembl-funcgen
92       ensembl-io
93       ensembl-variation
94     ];
95   propagatedBuildInputs = [ htslib ];
96   src = fetchFromGitHub {
97     owner = "Ensembl";
98     repo = "ensembl-${pname}";
99     rev = "release/${version}";
100     sha256 = "sha256-6lRdWV2ispl+mpBhkZez/d9PxOw1fkNUWeG8mUIqBJc=";
101   };
103   nativeBuildInputs = [ makeWrapper ];
104   dontBuild = true;
105   doCheck = false;
107   outputs = [ "out" ];
109   installPhase = ''
110     runHook preInstall
112     mkdir -p $out/bin
113     install -D -m755 filter_vep vep $out/bin/
115     wrapProgram $out/bin/vep \
116       --prefix PERL5LIB : $out/${perl.libPrefix}/${perl.version}/ \
117       --add-flags "--dir_plugins ${vepPlugins}"
119     wrapProgram $out/bin/filter_vep \
120       --prefix PERL5LIB : $out/${perl.libPrefix}/${perl.version}/
121     ${customInstallPhase}
123     runHook postInstall
124   '';
126   meta = {
127     homepage = "https://www.ensembl.org/info/docs/tools/vep/index.html";
128     description = "Annotate genetics variants based on genes, transcripts, and protein sequence, as well as regulatory regions";
129     license = lib.licenses.asl20;
130     mainProgram = "vep";
131     maintainers = with lib.maintainers; [ apraga ];
132     platforms = lib.platforms.unix;
133   };