aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/cnvkit/default.nix
blob: 92af67fa183ad0cd93e80c8fcd9a68eaab3010dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ lib
, fetchFromGitHub
, fetchpatch
, rPackages
, rWrapper
, buildPythonPackage
, biopython
, numpy
, scipy
, scikitlearn
, pandas
, matplotlib
, reportlab
, pysam
, future
, pillow
, pomegranate
, pyfaidx
, python
, R
}:

buildPythonPackage rec {
  pname = "CNVkit";
  version = "0.9.7";

  src = fetchFromGitHub {
    owner = "etal";
    repo = "cnvkit";
    rev = "v${version}";
    sha256 = "022zplgqil5l76vri647cyjx427vnbg5r2gw6lw712d2janvdjm7";
  };

  patches = [
    # Fix: AttributeError: module 'pandas.io.common' has no attribute 'EmptyDataError'
    (fetchpatch {
      url = "https://github.com/etal/cnvkit/commit/392adfffedfa0415e635b72c5027835b0a8d7ab5.patch";
      sha256 = "0s0gwyy0hybmhc3jij2v9l44b6lkcmclii8bkwsazzj2kc24m2rh";
    })
  ];

  propagatedBuildInputs = [
    biopython
    numpy
    scipy
    scikitlearn
    pandas
    matplotlib
    reportlab
    pyfaidx
    pysam
    future
    pillow
    pomegranate
    rPackages.DNAcopy
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace "pandas >= 0.20.1, < 0.25.0" "pandas"
  '';

  checkInputs = [ R ];

  checkPhase = ''
    pushd test/
    ${python.interpreter} test_io.py
    ${python.interpreter} test_genome.py
    ${python.interpreter} test_cnvlib.py
    ${python.interpreter} test_commands.py
    ${python.interpreter} test_r.py
  '';

  meta = with lib; {
    homepage = "https://cnvkit.readthedocs.io";
    description = "A Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data";
    license = licenses.asl20;
    maintainers = [ maintainers.jbedo ];
  };
}