about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/biology/astral/default.nix
blob: 34077949b97d157f0871aad7d1ba34ebb3ffe638 (plain) (blame)
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
{ lib
, stdenvNoCC
, fetchFromGitHub
, jdk8
, jre8
, strip-nondeterminism
, makeWrapper
, zip
}:

let
  jdk = jdk8;
  jre = jre8;
in
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "astral";
  version = "5.7.1";

  src = fetchFromGitHub {
    owner = "smirarab";
    repo = "ASTRAL";
    rev = "v${finalAttrs.version}";
    hash = "sha256-VhcsX9BxiZ0nISN6Xe4N+kq0iBMCtNhyxDrm9cwXfBA=";
  };

  patches = [
    # we can't use stripJavaArchivesHook here, because the build process puts a .jar file into a zip file
    # this patch calls strip-nondeterminism manually
    ./make-deterministic.patch
  ];

  nativeBuildInputs = [
    jdk
    zip
    strip-nondeterminism
    makeWrapper
  ];

  buildPhase = ''
    runHook preBuild
    patchShebangs ./make.sh
    ./make.sh
    runHook postBuild
  '';

  doCheck = true;

  checkPhase = ''
    runHook preCheck
    java -jar astral.${finalAttrs.version}.jar -i main/test_data/song_primates.424.gene.tre
    runHook postCheck
  '';

  installPhase = ''
    runHook preInstall

    install -Dm644 astral.${finalAttrs.version}.jar -t $out/share
    install -Dm644 lib/*.jar -t $out/share/lib
    install -Dm644 Astral.${finalAttrs.version}.zip -t $out/share
    cp -a main/test_data $out/share

    makeWrapper ${jre}/bin/java $out/bin/astral \
        --add-flags "-jar $out/share/astral.${finalAttrs.version}.jar"

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/smirarab/ASTRAL";
    description = "Tool for estimating an unrooted species tree given a set of unrooted gene trees";
    mainProgram = "astral";
    sourceProvenance = with sourceTypes; [
      fromSource
      binaryBytecode # source bundles dependencies as jars
    ];
    license = licenses.asl20;
    maintainers = with maintainers; [ bzizou tomasajt ];
  };
})