Skip to content

Commit ea90b75

Browse files
authored
1.6.1
- Comply with AnnData CSR matrix changes - Bump Python version to <=3.13
2 parents 6b9b561 + ee222d9 commit ea90b75

10 files changed

Lines changed: 27 additions & 21 deletions

File tree

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.6.0
2+
current_version = 1.6.1
33
commit = True
44
tag = True
55

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ data/
3232
docs/_build/*
3333
docs/jupyter_execute/*
3434
docs/generated/*
35+
*.h5ad
36+
*.gz
37+
*.db
38+
*.pkl
39+
*.png
3540

3641
# PyInstaller
3742
# Usually these files are written by a python script from a template

CHANGELOG.md

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

3+
## 1.6.1 (28.09.2025)
4+
5+
- Comply with AnnData CSR matrix changes
6+
- Bump Python version to <=3.13
7+
38
## 1.6.0 (09.07.2025)
49

510
- Adapted and bumped requirements to decopler-py \>=2.0.0 \| PR #178 by

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
44

55
[project]
66
name = "liana"
7-
version = "1.6.0"
7+
version = "1.6.1"
88
description = "LIANA+: a one-stop-shop framework for cell-cell communication"
99
readme = "README.md"
1010
license = { file = "LICENSE" }
@@ -24,7 +24,7 @@ authors = [
2424
{ name = "Julio Saez-Rodriguez"},
2525

2626
]
27-
requires-python = ">=3.10,<3.13"
27+
requires-python = ">=3.10,<3.14"
2828
classifiers = [
2929
"Programming Language :: Python :: 3 :: Only",
3030
"Programming Language :: Python :: 3.10",
@@ -52,17 +52,18 @@ optional-dependencies.dev = [
5252
]
5353

5454
optional-dependencies.extras = [
55-
"decoupler>=1.6.0",
55+
"decoupler>=1.6.1",
5656
"omnipath>=1.0.6",
5757
"pydeseq2>=0.3.5",
5858
"cell2cell",
59+
"gseapy>=1.1.0",
5960
"kneed>=0.7.0",
6061
"muon",
6162
"mofax",
6263
"mofapy2>=0.7.0",
6364
"requests>=2.25.1",
6465
"corneto==0.9.1-alpha.6",
65-
"cvxpy-base>=1.6.0",
66+
"cvxpy-base>=1.6.1",
6667
"PySCIPOpt>=5.2.1",
6768
]
6869

@@ -103,7 +104,7 @@ scripts.clean = "git clean -fdX -- {args:docs}"
103104

104105
[[tool.hatch.envs.hatch-test.matrix]]
105106
deps = [ "stable" ]
106-
python = [ "3.10", "3.12" ]
107+
python = [ "3.10", "3.13" ]
107108

108109
[tool.hatch.envs.hatch-test]
109110
features = [ "test", "extras" ]

src/liana/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '1.6.0'
1+
__version__ = '1.6.1'
22

33
from liana import method as mt, plotting as pl, resource as rs, multi as mu, utils as ut, testing
44

src/liana/method/sp/_utils.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
from anndata import AnnData
33
from pandas import Series
4-
from scipy.sparse import csr_matrix, hstack, isspmatrix_csr
4+
from scipy.sparse import csr_matrix, hstack
55

66

77
def _add_complexes_to_var(adata, entities, complex_sep='_'):
@@ -22,19 +22,16 @@ def _add_complexes_to_var(adata, entities, complex_sep='_'):
2222
X = new_array
2323
else:
2424
X = hstack((X, new_array))
25+
X = csr_matrix(X)
2526

26-
adata = AnnData(X=hstack((adata.X, X)),
27+
adata = AnnData(X=hstack((adata.X, X)).tocsr(),
2728
obs=adata.obs,
2829
var=adata.var,
2930
obsm=adata.obsm,
3031
varm = adata.varm,
3132
obsp=adata.obsp,
3233
uns = adata.uns,
3334
)
34-
35-
if not isspmatrix_csr(adata.X):
36-
adata.X = adata.X.tocsr()
37-
3835
return adata
3936

4037

src/liana/utils/interpolate_adata.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import numpy as np
21
from anndata import AnnData
32
from scipy.interpolate import griddata
4-
from scipy.sparse import csr_matrix, lil_matrix
3+
from scipy.sparse import csr_matrix
54

65
from liana._constants import DefaultValues as V
76
from liana._docs import d
@@ -44,9 +43,7 @@ def interpolate_adata(target: AnnData,
4443
target_coords = target.obsm[spatial_key]
4544
reference_coords = reference.obsm[spatial_key]
4645

47-
X = lil_matrix((reference.shape[0], target.shape[1]), dtype=np.float32)
48-
49-
ad = AnnData(X=X,
46+
ad = AnnData(X=None,
5047
uns=reference.uns,
5148
obs=reference.obs,
5249
obsm=reference.obsm,

tests/test_interpolate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pytest
33
from anndata import AnnData
4+
from scipy.sparse import csr_matrix
45

56
from liana.utils.interpolate_adata import interpolate_adata
67

@@ -9,7 +10,7 @@ def create_test_adata(n_cells, n_genes, spatial_key='spatial'):
910
"""
1011
Helper function to create a test AnnData object.
1112
"""
12-
X = np.random.rand(n_cells, n_genes)
13+
X = csr_matrix(np.random.rand(n_cells, n_genes))
1314
obsm = {spatial_key: np.random.rand(n_cells, 2)}
1415
adata = AnnData(X, obsm=obsm)
1516
adata.layers['some_layer'] = X

tests/test_multi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import cell2cell as c2c
21
import numpy as np
32
import pandas as pd
43

@@ -12,6 +11,7 @@
1211

1312
def test_to_tensor_c2c():
1413
"""Test to_tensor_c2c."""
14+
import cell2cell as c2c
1515
liana_res = sample_lrs(by_sample=True)
1616

1717
liana_dict = to_tensor_c2c(liana_res=liana_res,

tests/test_pre.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_prep_check_adata():
1010

1111
temp = prep_check_adata(adata=adata, groupby='bulk_labels', min_cells=0,
1212
use_raw=True, layer=None)
13-
np.testing.assert_almost_equal(np.sum(temp.X.data), 319044.22, decimal=2)
13+
np.testing.assert_almost_equal(np.sum(temp.X.data), 319044.22, decimal=1)
1414

1515
desired = np.array([2.177, 2.177, 2.544, 2.544, 1.591, 1.591, 1.591, 1.591, 1.591, 1.591])
1616
np.testing.assert_almost_equal(temp.X.data[0:10], desired, decimal=3)

0 commit comments

Comments
 (0)