Skip to content

Commit

Permalink
Fix kBET test for 1.1.6 (#420)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mumichae authored Dec 5, 2024
1 parent acfde78 commit 0cf0ba1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.11'
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.9', '3.11']
python: ['3.10', '3.11']
os: [ubuntu-latest]

steps:
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: '3.8'
python: '3.11'
apt_packages:
- r-base

Expand Down
24 changes: 12 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ author = Malte D. Luecken, Maren Buettner, Daniel C. Strobl, Michaela F. Mueller
author_email = [email protected], [email protected]
license = MIT
url = https://github.com/theislab/scib
project_urls =
project_urls =
Pipeline = https://github.com/theislab/scib-pipeline
Reproducibility = https://theislab.github.io/scib-reproducibility
Bug Tracker = https://github.com/theislab/scib/issues
keywords =
keywords =
benchmarking
single cell
data integration
classifiers =
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
Intended Audience :: Science/Research
Topic :: Software Development :: Build Tools
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11

[bdist_wheel]
build_number = 1

[options]
packages =
packages =
scib
scib.metrics
python_requires = >=3.8
install_requires =
python_requires = >=3.9
install_requires =
numpy
pandas>=2
seaborn
Expand All @@ -65,7 +65,7 @@ install_requires =
zip_safe = False

[options.package_data]
scib =
scib =
resources/*.txt
knn_graph/*

Expand Down Expand Up @@ -93,9 +93,9 @@ skip_glob = docs/*

[tool.black]
line-length = 120
target-version = py38
target-version = py311
include = \.pyi?$
exclude =
exclude =
.eggs
.git
.venv
Expand All @@ -104,7 +104,7 @@ exclude =

[flake8]
max-line-length = 88
ignore =
ignore =
W503
W504
E501
Expand All @@ -126,7 +126,7 @@ ignore =
RST304
C408
exclude = .git,__pycache__,build,docs/_build,dist
per-file-ignores =
per-file-ignores =
scib/*: D
tests/*: D
*/__init__.py: F401
23 changes: 22 additions & 1 deletion tests/metrics/rpy2/test_kbet.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import numpy as np
import scanpy as sc
from tqdm import tqdm

import scib
from tests.common import LOGGER, assert_near_exact

Expand All @@ -7,4 +11,21 @@ def test_kbet(adata_pca):
adata_pca, batch_key="batch", label_key="celltype", embed="X_pca", type_="full"
)
LOGGER.info(f"score: {score}")
assert_near_exact(score, 0.556108994805538, diff=1e-02)
assert_near_exact(score, 0.55, diff=1e-01)


def test_kbet_random(adata_pca):
scores = []
for _ in tqdm(range(5)):
adata_pca.obs["batch"] = adata_pca.obs["batch"].sample(frac=1).values
sc.pp.pca(adata_pca, n_comps=20, use_highly_variable=True)
score = scib.me.kBET(
adata_pca,
batch_key="batch",
label_key="celltype",
embed="X_pca",
type_="full",
)
LOGGER.info(f"score: {score}")
scores.append(score)
assert_near_exact(np.mean(scores), 0.8, diff=1e-01)

0 comments on commit 0cf0ba1

Please sign in to comment.