1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 swig,
7 cython,
8 matplotlib,
9 numpy,
10 pandas,
11 pysam,
12 setuptools,
13 pytestCheckHook,
14 nix-update-script,
15}:
16buildPythonPackage rec {
17 pname = "htseq";
18 version = "2.0.4";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "htseq";
23 repo = "htseq";
24 rev = "release_${version}";
25 hash = "sha256-7ocrmuj9LOtPz9XbI5rKGcdE5JbFz/pZh00Nie65XxE=";
26 };
27
28 patches = [
29 # https://github.com/htseq/htseq/pull/84
30 (fetchpatch {
31 name = "replace-distutils-with-sysconfig.patch";
32 url = "https://github.com/htseq/htseq/commit/f0f1e464ee9aee56f0b44f905e7b3355b0bb8f29.patch";
33 hash = "sha256-yDYkXCPy+YFgnk1rnXwCB998aZwVd5nJeejZIgeEzAo=";
34 })
35 ];
36
37 nativeBuildInputs = [ swig ];
38
39 build-system = [
40 cython
41 numpy
42 pysam
43 setuptools
44 ];
45
46 dependencies = [
47 numpy
48 pysam
49 ];
50
51 optional-dependencies = {
52 htseq-qa = [ matplotlib ];
53 };
54
55 pythonImportsCheck = [ "HTSeq" ];
56
57 nativeCheckInputs = [
58 pandas
59 pytestCheckHook
60 ] ++ optional-dependencies.htseq-qa;
61
62 preCheck = ''
63 rm -r src HTSeq
64 export PATH=$out/bin:$PATH
65 '';
66
67 passthru.updateScript = nix-update-script {
68 extraArgs = [
69 "--version-regex"
70 "release_(.+)"
71 ];
72 };
73
74 meta = with lib; {
75 homepage = "https://htseq.readthedocs.io/";
76 description = "A framework to work with high-throughput sequencing data";
77 maintainers = with maintainers; [ unode ];
78 };
79}