python312Packages.pomegranate: 0.14.8 -> 1.1.0 (#381588)

This commit is contained in:
Nick Cao
2025-02-13 18:24:44 -05:00
committed by GitHub
2 changed files with 96 additions and 69 deletions

View File

@@ -1,31 +1,31 @@
{
lib,
fetchFromGitHub,
rPackages,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# dependencies
R,
biopython,
numpy,
scipy,
scikit-learn,
pandas,
matplotlib,
reportlab,
pysam,
future,
pillow,
numpy,
pandas,
pomegranate,
pyfaidx,
python,
pythonOlder,
R,
pysam,
rPackages,
reportlab,
scikit-learn,
scipy,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "cnvkit";
version = "0.9.12";
format = "setuptools";
disabled = pythonOlder "3.7";
pyproject = true;
src = fetchFromGitHub {
owner = "etal";
@@ -34,50 +34,58 @@ buildPythonPackage rec {
hash = "sha256-ZdE3EUNZpEXRHTRKwVhuj3BWQWczpdFbg4pVr0+AHiQ=";
};
postPatch = ''
# see https://github.com/etal/cnvkit/issues/589
substituteInPlace setup.py \
--replace 'joblib < 1.0' 'joblib'
# see https://github.com/etal/cnvkit/issues/680
substituteInPlace test/test_io.py \
--replace 'test_read_vcf' 'dont_test_read_vcf'
'';
propagatedBuildInputs = [
biopython
numpy
scipy
scikit-learn
pandas
matplotlib
reportlab
pyfaidx
pysam
future
pillow
pomegranate
rPackages.DNAcopy
patches = [
(fetchpatch {
name = "fix-numpy2-compat";
url = "https://github.com/etal/cnvkit/commit/5cb6aeaf40ea5572063cf9914c456c307b7ddf7a.patch";
hash = "sha256-VwGAMGKuX2Kx9xL9GX/PB94/7LkT0dSLbWIfVO8F9NI=";
})
];
nativeCheckInputs = [ R ];
pythonRelaxDeps = [
# https://github.com/etal/cnvkit/issues/815
"pomegranate"
];
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
popd # test/
# Numpy 2 compatibility
postPatch = ''
substituteInPlace skgenome/intersect.py \
--replace-fail "np.string_" "np.bytes_"
'';
dependencies = [
biopython
matplotlib
numpy
pandas
pomegranate
pyfaidx
pysam
rPackages.DNAcopy
reportlab
scikit-learn
scipy
];
pythonImportsCheck = [ "cnvlib" ];
meta = with lib; {
nativeCheckInputs = [
pytestCheckHook
R
];
disabledTests = [
# AttributeError: module 'pomegranate' has no attribute 'NormalDistribution'
# https://github.com/etal/cnvkit/issues/815
"test_batch"
"test_segment_hmm"
];
meta = {
homepage = "https://cnvkit.readthedocs.io";
description = "Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data";
changelog = "https://github.com/etal/cnvkit/releases/tag/v${version}";
license = licenses.asl20;
maintainers = [ maintainers.jbedo ];
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.jbedo ];
};
}

View File

@@ -1,5 +1,6 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
@@ -7,45 +8,63 @@
setuptools,
# dependencies
numpy,
joblib,
apricot-select,
networkx,
numpy,
scikit-learn,
scipy,
pyyaml,
cython,
torch,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "pomegranate";
version = "0.14.8";
version = "1.1.0";
pyproject = true;
src = fetchFromGitHub {
repo = pname;
owner = "jmschrei";
# no tags for recent versions: https://github.com/jmschrei/pomegranate/issues/974
tag = "v${version}";
hash = "sha256-PoDAtNm/snq4isotkoCTVYUuwr9AKKwiXIojUFMH/YE=";
hash = "sha256-p2Gn0FXnsAHvRUeAqx4M1KH0+XvDl3fmUZZ7MiMvPSs=";
};
nativeBuildInputs = [ setuptools ];
build-system = [ setuptools ];
propagatedBuildInputs = [
numpy
joblib
dependencies = [
apricot-select
networkx
numpy
scikit-learn
scipy
pyyaml
cython
torch
];
# https://github.com/etal/cnvkit/issues/815
passthru.skipBulkUpdate = true;
pythonImportsCheck = [ "pomegranate" ];
meta = with lib; {
nativeCheckInputs = [
pytestCheckHook
];
pytestFlagsArray = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
# AssertionError: Arrays are not almost equal to 6 decimals
"--deselect=tests/distributions/test_normal_full.py::test_fit"
"--deselect=tests/distributions/test_normal_full.py::test_from_summaries"
"--deselect=tests/distributions/test_normal_full.py::test_serialization"
];
disabledTests = [
# AssertionError: Arrays are not almost equal to 6 decimals
"test_sample"
];
meta = {
description = "Probabilistic and graphical models for Python, implemented in cython for speed";
homepage = "https://github.com/jmschrei/pomegranate";
license = licenses.mit;
maintainers = with maintainers; [ rybern ];
changelog = "https://github.com/jmschrei/pomegranate/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ rybern ];
};
}