about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/biology/trimmomatic/default.nix
blob: db19278eaa47976bd6a2f88a023ea91645402332 (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
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk
, jre
, makeWrapper
, stripJavaArchivesHook
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "trimmomatic";
  version = "0.39";

  src = fetchFromGitHub {
    owner = "usadellab";
    repo = "Trimmomatic";
    rev = "v${finalAttrs.version}";
    hash = "sha256-u+ubmacwPy/vsEi0YQCv0fTnVDesQvqeQDEwCbS8M6I=";
  };

  # Remove jdk version requirement
  postPatch = ''
    substituteInPlace ./build.xml \
      --replace 'source="1.5" target="1.5"' ""
  '';

  nativeBuildInputs = [
    ant
    jdk
    makeWrapper
    stripJavaArchivesHook
  ];

  buildPhase = ''
    runHook preBuild

    ant

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm644 dist/jar/trimmomatic-*.jar -t $out/share/trimmomatic
    cp -r adapters $out/share/trimmomatic

    makeWrapper ${jre}/bin/java $out/bin/trimmomatic \
        --add-flags "-jar $out/share/trimmomatic/trimmomatic-*.jar"

    runHook postInstall
  '';

  meta = {
    changelog = "https://github.com/usadellab/Trimmomatic/blob/main/versionHistory.txt";
    description = "A flexible read trimming tool for Illumina NGS data";
    longDescription = ''
      Trimmomatic performs a variety of useful trimming tasks for illumina
      paired-end and single ended data: adapter trimming, quality trimming,
      cropping to a specified length, length filtering, quality score
      conversion.
    '';
    homepage = "http://www.usadellab.org/cms/?page=trimmomatic";
    downloadPage = "https://github.com/usadellab/Trimmomatic/releases";
    license = lib.licenses.gpl3Only;
    sourceProvenance = [
      lib.sourceTypes.fromSource
      lib.sourceTypes.binaryBytecode # source bundles dependencies as jars
    ];
    mainProgram = "trimmomatic";
    maintainers = [ lib.maintainers.kupac ];
  };
})