16 buildPythonPackage rec {
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";
27 sha256 = "168bwwm8c2k22m7paip8q0yajyl7xdxgnik0bgjl7rhqg0majz0f";
30 nativeBuildInputs = [ samtools ];
40 # Use nixpkgs' htslib instead of the bundled one
41 # See https://pysam.readthedocs.io/en/latest/installation.html#external
42 # NOTE that htslib should be version compatible with pysam
44 export HTSLIB_MODE=shared
45 export HTSLIB_LIBRARY_DIR=${htslib}/lib
46 export HTSLIB_INCLUDE_DIR=${htslib}/include
55 # See https://github.com/NixOS/nixpkgs/pull/100823 for why we aren't using
56 # disabledTests and pytestFlagsArray through pytestCheckHook
58 # Needed to avoid /homeless-shelter error
59 export HOME=$(mktemp -d)
61 # To avoid API incompatibilities, these should ideally show the same version
62 echo "> samtools --version"
64 echo "> htsfile --version"
66 echo "> bcftools --version"
69 # Create auxiliary test data
70 make -C tests/pysam_data
71 make -C tests/cbcf_data
73 # Delete pysam folder in current directory to avoid importing it during testing
76 # Deselect tests that are known to fail due to upstream issues
77 # See https://github.com/pysam-developers/pysam/issues/961
79 --deselect tests/AlignmentFileHeader_test.py::TestHeaderBAM::test_dictionary_access_works \
80 --deselect tests/AlignmentFileHeader_test.py::TestHeaderBAM::test_header_content_is_as_expected \
81 --deselect tests/AlignmentFileHeader_test.py::TestHeaderCRAM::test_dictionary_access_works \
82 --deselect tests/AlignmentFileHeader_test.py::TestHeaderCRAM::test_header_content_is_as_expected \
83 --deselect tests/AlignmentFile_test.py::TestDeNovoConstruction::testBAMWholeFile \
84 --deselect tests/AlignmentFile_test.py::TestEmptyHeader::testEmptyHeader \
85 --deselect tests/AlignmentFile_test.py::TestHeaderWithProgramOptions::testHeader \
86 --deselect tests/AlignmentFile_test.py::TestIO::testBAM2BAM \
87 --deselect tests/AlignmentFile_test.py::TestIO::testBAM2CRAM \
88 --deselect tests/AlignmentFile_test.py::TestIO::testBAM2SAM \
89 --deselect tests/AlignmentFile_test.py::TestIO::testFetchFromClosedFileObject \
90 --deselect tests/AlignmentFile_test.py::TestIO::testOpenFromFilename \
91 --deselect tests/AlignmentFile_test.py::TestIO::testSAM2BAM \
92 --deselect tests/AlignmentFile_test.py::TestIO::testWriteUncompressedBAMFile \
93 --deselect tests/AlignmentFile_test.py::TestIteratorRowAllBAM::testIterate \
94 --deselect tests/StreamFiledescriptors_test.py::StreamTest::test_text_processing \
95 --deselect tests/compile_test.py::BAMTest::testCount \
99 pythonImportsCheck = [
108 description = "A python module for reading, manipulating and writing genome data sets";
109 homepage = "https://pysam.readthedocs.io/";
110 maintainers = with maintainers; [ unode ];
111 license = licenses.mit;
112 platforms = [ "i686-linux" "x86_64-linux" ];