lol
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 autoconf,
7 pkg-config,
8 libz,
9 bzip2,
10 xz,
11 libdeflate,
12 htslib,
13 fetchurl,
14}:
15
16let
17 # Grenedalf is binded to htslib 1.16 and does not link with libcurl
18 htslib_gr = htslib.overrideDerivation (oldAttrs: rec {
19 version = "1.16";
20 name = "${oldAttrs.pname}-nocurl-${version}";
21 src = fetchurl {
22 url = "https://github.com/samtools/htslib/releases/download/${version}/htslib-${version}.tar.bz2";
23 sha256 = "sha256-YGt8ev9zc0zwM+zRVvQFKfpXkvVFJJUqKJOMoIkNeSQ=";
24 };
25 configureFlags = [
26 "--disable-libcurl"
27 "--disable-plugins"
28 ];
29 });
30in
31stdenv.mkDerivation (finalAttrs: {
32 pname = "grenedalf";
33 version = "0.6.2";
34
35 src = fetchFromGitHub {
36 owner = "lczech";
37 repo = "grenedalf";
38 tag = "v${finalAttrs.version}";
39 hash = "sha256-DJ7nZjOvYFQlN/L+S2QcMVvH/M9Dhla4VXl2nxc22m4=";
40 fetchSubmodules = true;
41 };
42
43 nativeBuildInputs = [
44 cmake
45 pkg-config
46 autoconf
47 ];
48
49 buildInputs = [
50 libz
51 bzip2
52 xz
53 libdeflate
54 htslib_gr
55 ];
56
57 cmakeFlags = [
58 "-DHTSLIB_DIR=${htslib_gr}"
59 ];
60
61 installPhase = ''
62 runHook preInstall
63
64 mkdir -p $out/bin
65 cp ../bin/grenedalf $out/bin
66
67 runHook postInstall
68 '';
69
70 meta = with lib; {
71 homepage = "https://github.com/lczech/grenedalf";
72 description = "Collection of commands for working with population genetic data";
73 longDescription = ''
74 grenedalf is a collection of commands for working with population genetic
75 data, in particular from pool sequencing. Its main focus are statistical
76 analyses such as Tajima's D and Fst. The statistics follow the approaches
77 of PoPoolation and PoPoolation2, as well as poolfstat and npstat. However,
78 compared to those, grenedalf is significantly more scalable, more user
79 friendly, and offers more settings and input file formats.
80 '';
81 platforms = platforms.all;
82 license = licenses.gpl3Plus;
83 maintainers = with maintainers; [ bzizou ];
84 };
85})