1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, bzip2
5, bcftools
6, curl
7, cython
8, htslib
9, lzma
10, pytest
11, samtools
12, zlib
13}:
14
15buildPythonPackage rec {
16 pname = "pysam";
17 version = "0.15.4";
18
19 # Fetching from GitHub instead of PyPi cause the 0.13 src release on PyPi is
20 # missing some files which cause test failures.
21 # Tracked at: https://github.com/pysam-developers/pysam/issues/616
22 src = fetchFromGitHub {
23 owner = "pysam-developers";
24 repo = "pysam";
25 rev = "v${version}";
26 sha256 = "04w6h6mv6lsr74hj9gy4r2laifcbhgl2bjcr4r1l9r73xdd45mdy";
27 };
28
29 nativeBuildInputs = [ samtools ];
30 buildInputs = [ bzip2 curl cython lzma zlib ];
31
32 checkInputs = [ pytest bcftools htslib ];
33 checkPhase = "py.test";
34
35 # tests require samtools<=1.9
36 doCheck = false;
37 preCheck = ''
38 export HOME=$(mktemp -d)
39 make -C tests/pysam_data
40 make -C tests/cbcf_data
41 '';
42
43 pythonImportsCheck = [
44 "pysam"
45 "pysam.bcftools"
46 "pysam.libcutils"
47 "pysam.libcvcf"
48 ];
49
50 meta = with lib; {
51 description = "A python module for reading, manipulating and writing genome data sets";
52 homepage = "https://pysam.readthedocs.io/";
53 maintainers = with maintainers; [ unode ];
54 license = licenses.mit;
55 platforms = [ "i686-linux" "x86_64-linux" ];
56 };
57}