Skip to content

Commit 0cf0ba1

Browse files
authored
Fix kBET test for 1.1.6 (#420)
* adjust margin and add random batch kbet score test * update python versions * update to 3.12 for metrics * set 3.11 as max python version (due to incompatibility with louvain) * update python version for readthedocs build * reduce number of kbet tests
1 parent acfde78 commit 0cf0ba1

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

.github/workflows/deployment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
with:
1616
fetch-depth: 0
1717

18-
- name: Set up Python 3.10
18+
- name: Set up Python 3.11
1919
uses: actions/setup-python@v2
2020
with:
21-
python-version: '3.10'
21+
python-version: '3.11'
2222
- name: Install pip dependencies
2323
run: |
2424
python -m pip install --upgrade pip

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
runs-on: ${{ matrix.os }}
113113
strategy:
114114
matrix:
115-
python: ['3.9', '3.11']
115+
python: ['3.10', '3.11']
116116
os: [ubuntu-latest]
117117

118118
steps:

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ version: 2
77

88
# Set the version of Python and other tools you might need
99
build:
10-
os: ubuntu-20.04
10+
os: ubuntu-24.04
1111
tools:
12-
python: '3.8'
12+
python: '3.11'
1313
apt_packages:
1414
- r-base
1515

setup.cfg

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,34 @@ author = Malte D. Luecken, Maren Buettner, Daniel C. Strobl, Michaela F. Mueller
1717
1818
license = MIT
1919
url = https://github.com/theislab/scib
20-
project_urls =
20+
project_urls =
2121
Pipeline = https://github.com/theislab/scib-pipeline
2222
Reproducibility = https://theislab.github.io/scib-reproducibility
2323
Bug Tracker = https://github.com/theislab/scib/issues
24-
keywords =
24+
keywords =
2525
benchmarking
2626
single cell
2727
data integration
28-
classifiers =
28+
classifiers =
2929
Development Status :: 3 - Alpha
3030
Intended Audience :: Developers
3131
Intended Audience :: Science/Research
3232
Topic :: Software Development :: Build Tools
3333
License :: OSI Approved :: MIT License
3434
Programming Language :: Python :: 3
35-
Programming Language :: Python :: 3.8
3635
Programming Language :: Python :: 3.9
3736
Programming Language :: Python :: 3.10
37+
Programming Language :: Python :: 3.11
3838

3939
[bdist_wheel]
4040
build_number = 1
4141

4242
[options]
43-
packages =
43+
packages =
4444
scib
4545
scib.metrics
46-
python_requires = >=3.8
47-
install_requires =
46+
python_requires = >=3.9
47+
install_requires =
4848
numpy
4949
pandas>=2
5050
seaborn
@@ -65,7 +65,7 @@ install_requires =
6565
zip_safe = False
6666

6767
[options.package_data]
68-
scib =
68+
scib =
6969
resources/*.txt
7070
knn_graph/*
7171

@@ -93,9 +93,9 @@ skip_glob = docs/*
9393

9494
[tool.black]
9595
line-length = 120
96-
target-version = py38
96+
target-version = py311
9797
include = \.pyi?$
98-
exclude =
98+
exclude =
9999
.eggs
100100
.git
101101
.venv
@@ -104,7 +104,7 @@ exclude =
104104

105105
[flake8]
106106
max-line-length = 88
107-
ignore =
107+
ignore =
108108
W503
109109
W504
110110
E501
@@ -126,7 +126,7 @@ ignore =
126126
RST304
127127
C408
128128
exclude = .git,__pycache__,build,docs/_build,dist
129-
per-file-ignores =
129+
per-file-ignores =
130130
scib/*: D
131131
tests/*: D
132132
*/__init__.py: F401

tests/metrics/rpy2/test_kbet.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import numpy as np
2+
import scanpy as sc
3+
from tqdm import tqdm
4+
15
import scib
26
from tests.common import LOGGER, assert_near_exact
37

@@ -7,4 +11,21 @@ def test_kbet(adata_pca):
711
adata_pca, batch_key="batch", label_key="celltype", embed="X_pca", type_="full"
812
)
913
LOGGER.info(f"score: {score}")
10-
assert_near_exact(score, 0.556108994805538, diff=1e-02)
14+
assert_near_exact(score, 0.55, diff=1e-01)
15+
16+
17+
def test_kbet_random(adata_pca):
18+
scores = []
19+
for _ in tqdm(range(5)):
20+
adata_pca.obs["batch"] = adata_pca.obs["batch"].sample(frac=1).values
21+
sc.pp.pca(adata_pca, n_comps=20, use_highly_variable=True)
22+
score = scib.me.kBET(
23+
adata_pca,
24+
batch_key="batch",
25+
label_key="celltype",
26+
embed="X_pca",
27+
type_="full",
28+
)
29+
LOGGER.info(f"score: {score}")
30+
scores.append(score)
31+
assert_near_exact(np.mean(scores), 0.8, diff=1e-01)

0 commit comments

Comments
 (0)