2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
bzip2,
|
|
|
|
bcftools,
|
|
|
|
curl,
|
|
|
|
cython,
|
|
|
|
htslib,
|
|
|
|
libdeflate,
|
|
|
|
xz,
|
|
|
|
pytestCheckHook,
|
|
|
|
setuptools,
|
|
|
|
samtools,
|
|
|
|
zlib,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-06-05 15:53:02 +00:00
|
|
|
pname = "pysam";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.22.1";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Fetching from GitHub instead of PyPi cause the 0.13 src release on PyPi is
|
|
|
|
# missing some files which cause test failures.
|
|
|
|
# Tracked at: https://github.com/pysam-developers/pysam/issues/616
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pysam-developers";
|
|
|
|
repo = "pysam";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-1sivEf8xN4SJPtJiAcBZG1bbgy66yWXzQis1mPeU+sA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
2024-01-13 08:15:51 +00:00
|
|
|
samtools
|
|
|
|
setuptools
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2020-10-20 17:27:49 +00:00
|
|
|
buildInputs = [
|
|
|
|
bzip2
|
|
|
|
curl
|
|
|
|
libdeflate
|
2021-04-05 15:23:46 +00:00
|
|
|
xz
|
2020-10-20 17:27:49 +00:00
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
# Use nixpkgs' htslib instead of the bundled one
|
|
|
|
# See https://pysam.readthedocs.io/en/latest/installation.html#external
|
|
|
|
# NOTE that htslib should be version compatible with pysam
|
|
|
|
preBuild = ''
|
|
|
|
export HTSLIB_MODE=shared
|
|
|
|
export HTSLIB_LIBRARY_DIR=${htslib}/lib
|
|
|
|
export HTSLIB_INCLUDE_DIR=${htslib}/include
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
pytestCheckHook
|
2020-10-20 17:27:49 +00:00
|
|
|
bcftools
|
|
|
|
htslib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
2020-04-24 23:36:52 +00:00
|
|
|
make -C tests/pysam_data
|
|
|
|
make -C tests/cbcf_data
|
2023-05-24 13:37:59 +00:00
|
|
|
make -C tests/tabix_data
|
2020-10-20 17:27:49 +00:00
|
|
|
rm -rf pysam
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pysam"
|
|
|
|
"pysam.bcftools"
|
2020-10-20 17:27:49 +00:00
|
|
|
"pysam.libchtslib"
|
2020-04-24 23:36:52 +00:00
|
|
|
"pysam.libcutils"
|
|
|
|
"pysam.libcvcf"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Python module for reading, manipulating and writing genome data sets";
|
2024-01-13 08:15:51 +00:00
|
|
|
downloadPage = "https://github.com/pysam-developers/pysam";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://pysam.readthedocs.io/";
|
|
|
|
maintainers = with maintainers; [ unode ];
|
|
|
|
license = licenses.mit;
|
2022-09-30 11:47:45 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|