Skip to content

Commit 7c02c31

Browse files
committed
adjust acc to scanpy version
1 parent 70bf35c commit 7c02c31

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.7.1 (24.01.2026)
4+
5+
- Fixed issue with Metalinks download due to User-Agent restrictions.
6+
- Added scanpy version compatibility using getattr to handle both _set_default_colors_for_categorical_obs (old) and set_default_colors_for_categorical_obs (new).
7+
8+
39
## 1.7.0 (07.01.2026)
410

511
- Inflow implementation and tutorial #221 by @AtheerAS

src/liana/plotting/_circle_plot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ def _set_adata_color(adata, label, color_dict=None, hex=True):
5454
]
5555
else:
5656
if f"{label}_colors" not in adata.uns:
57-
sc.pl._utils._set_default_colors_for_categorical_obs(adata, label)
57+
# Handle both old (_set_default...) and new (set_default...) scanpy API
58+
_set_colors = getattr(
59+
sc.pl._utils,
60+
'_set_default_colors_for_categorical_obs',
61+
getattr(sc.pl._utils, 'set_default_colors_for_categorical_obs', None)
62+
)
63+
_set_colors(adata, label)
5864

5965
return adata
6066

tests/test_converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def zi_minmax_cutoff(x):
2727
adata = mdata_to_anndata(mdata, x_mod='adata_x', y_mod='adata_y',
2828
x_transform=zi_minmax_cutoff, y_transform=zi_minmax_cutoff,
2929
verbose=False)
30-
assert_almost_equal(adata.X.sum(), 2120.704, decimal=4)
30+
assert_almost_equal(adata.X.sum(), 2120.704, decimal=3)
3131

3232
# test non-negative
3333
from scanpy.pp import scale

tests/test_spatial_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
def test_get_spatial_connectivities():
1212
spatial_neighbors(adata=adata, bandwidth=200, set_diag=True, cutoff=0.2)
1313
np.testing.assert_equal(adata.obsp['spatial_connectivities'].shape, (adata.shape[0], adata.shape[0]))
14-
np.testing.assert_equal(adata.obsp['spatial_connectivities'].sum(), 4550.654013895928)
14+
np.testing.assert_almost_equal(adata.obsp['spatial_connectivities'].sum(), 4550.654013895928, decimal=5)
1515

1616
spatial_neighbors(adata=adata, bandwidth=100, set_diag=True, cutoff=0.1)
17-
np.testing.assert_equal(adata.obsp['spatial_connectivities'].sum(), 1802.332962418902)
17+
np.testing.assert_almost_equal(adata.obsp['spatial_connectivities'].sum(), 1802.332962418902, decimal=5)
1818

1919
conns = spatial_neighbors(adata=adata, bandwidth=100,
2020
kernel='linear', cutoff=0.1,

0 commit comments

Comments
 (0)