1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 # dependencies
8 R,
9 biopython,
10 matplotlib,
11 numpy,
12 pandas,
13 pomegranate,
14 pyfaidx,
15 pysam,
16 rPackages,
17 reportlab,
18 scikit-learn,
19 scipy,
20
21 # tests
22 pytestCheckHook,
23}:
24
25buildPythonPackage rec {
26 pname = "cnvkit";
27 version = "0.9.12";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "etal";
32 repo = "cnvkit";
33 tag = "v${version}";
34 hash = "sha256-ZdE3EUNZpEXRHTRKwVhuj3BWQWczpdFbg4pVr0+AHiQ=";
35 };
36
37 patches = [
38 (fetchpatch {
39 name = "fix-numpy2-compat";
40 url = "https://github.com/etal/cnvkit/commit/5cb6aeaf40ea5572063cf9914c456c307b7ddf7a.patch";
41 hash = "sha256-VwGAMGKuX2Kx9xL9GX/PB94/7LkT0dSLbWIfVO8F9NI=";
42 })
43 ];
44
45 pythonRelaxDeps = [
46 # https://github.com/etal/cnvkit/issues/815
47 "pomegranate"
48 ];
49
50 # Numpy 2 compatibility
51 postPatch = ''
52 substituteInPlace skgenome/intersect.py \
53 --replace-fail "np.string_" "np.bytes_"
54 '';
55
56 dependencies = [
57 biopython
58 matplotlib
59 numpy
60 pandas
61 pomegranate
62 pyfaidx
63 pysam
64 rPackages.DNAcopy
65 reportlab
66 scikit-learn
67 scipy
68 ];
69
70 pythonImportsCheck = [ "cnvlib" ];
71
72 nativeCheckInputs = [
73 pytestCheckHook
74 R
75 ];
76
77 disabledTests = [
78 # AttributeError: module 'pomegranate' has no attribute 'NormalDistribution'
79 # https://github.com/etal/cnvkit/issues/815
80 "test_batch"
81 "test_segment_hmm"
82 ];
83
84 meta = {
85 homepage = "https://cnvkit.readthedocs.io";
86 description = "Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data";
87 changelog = "https://github.com/etal/cnvkit/releases/tag/v${version}";
88 license = lib.licenses.asl20;
89 maintainers = [ lib.maintainers.jbedo ];
90 };
91}