at 24.05-pre 1.7 kB view raw
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, bzip2 5, bcftools 6, curl 7, cython 8, htslib 9, libdeflate 10, xz 11, pytestCheckHook 12, samtools 13, zlib 14}: 15 16buildPythonPackage rec { 17 pname = "pysam"; 18 version = "0.21.0"; 19 20 # Fetching from GitHub instead of PyPi cause the 0.13 src release on PyPi is 21 # missing some files which cause test failures. 22 # Tracked at: https://github.com/pysam-developers/pysam/issues/616 23 src = fetchFromGitHub { 24 owner = "pysam-developers"; 25 repo = "pysam"; 26 rev = "refs/tags/v${version}"; 27 hash = "sha256-C4/AJwcUyLoUEUEnsATLHJb5F8mltP8X2XfktYu0OTo="; 28 }; 29 30 nativeBuildInputs = [ samtools ]; 31 32 buildInputs = [ 33 bzip2 34 curl 35 libdeflate 36 xz 37 zlib 38 ]; 39 40 propagatedBuildInputs = [ cython ]; 41 42 # Use nixpkgs' htslib instead of the bundled one 43 # See https://pysam.readthedocs.io/en/latest/installation.html#external 44 # NOTE that htslib should be version compatible with pysam 45 preBuild = '' 46 export HTSLIB_MODE=shared 47 export HTSLIB_LIBRARY_DIR=${htslib}/lib 48 export HTSLIB_INCLUDE_DIR=${htslib}/include 49 ''; 50 51 nativeCheckInputs = [ 52 pytestCheckHook 53 bcftools 54 htslib 55 ]; 56 57 preCheck = '' 58 export HOME=$TMPDIR 59 make -C tests/pysam_data 60 make -C tests/cbcf_data 61 make -C tests/tabix_data 62 rm -rf pysam 63 ''; 64 65 pythonImportsCheck = [ 66 "pysam" 67 "pysam.bcftools" 68 "pysam.libchtslib" 69 "pysam.libcutils" 70 "pysam.libcvcf" 71 ]; 72 73 meta = with lib; { 74 description = "A python module for reading, manipulating and writing genome data sets"; 75 homepage = "https://pysam.readthedocs.io/"; 76 maintainers = with maintainers; [ unode ]; 77 license = licenses.mit; 78 platforms = platforms.unix; 79 }; 80}