kdomainbench 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. kdomainbench-0.1.0/CHANGELOG.md +113 -0
  2. kdomainbench-0.1.0/LICENSE +674 -0
  3. kdomainbench-0.1.0/MANIFEST.in +2 -0
  4. kdomainbench-0.1.0/PKG-INFO +83 -0
  5. kdomainbench-0.1.0/README.md +57 -0
  6. kdomainbench-0.1.0/pyproject.toml +39 -0
  7. kdomainbench-0.1.0/setup.cfg +4 -0
  8. kdomainbench-0.1.0/src/kdomainbench/__init__.py +22 -0
  9. kdomainbench-0.1.0/src/kdomainbench/cli.py +330 -0
  10. kdomainbench-0.1.0/src/kdomainbench/config.py +133 -0
  11. kdomainbench-0.1.0/src/kdomainbench/envs/install_r_packages.R +83 -0
  12. kdomainbench-0.1.0/src/kdomainbench/envs/kdb_py.yml +253 -0
  13. kdomainbench-0.1.0/src/kdomainbench/envs/kdb_spatialde.yml +133 -0
  14. kdomainbench-0.1.0/src/kdomainbench/example.py +56 -0
  15. kdomainbench-0.1.0/src/kdomainbench/methods/bayesspace.R +90 -0
  16. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace.R +40 -0
  17. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace_R/LICENSE +21 -0
  18. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace_R/fix_clusters_model.cpp +305 -0
  19. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace_R/main.R +184 -0
  20. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace_R/model.cpp +452 -0
  21. kdomainbench-0.1.0/src/kdomainbench/methods/bnpspace_R/utils.R +227 -0
  22. kdomainbench-0.1.0/src/kdomainbench/methods/drsc.R +34 -0
  23. kdomainbench-0.1.0/src/kdomainbench/methods/iscmeb.R +60 -0
  24. kdomainbench-0.1.0/src/kdomainbench/methods/precast.R +78 -0
  25. kdomainbench-0.1.0/src/kdomainbench/methods/run_cellcharter.py +87 -0
  26. kdomainbench-0.1.0/src/kdomainbench/methods/run_deepst.py +90 -0
  27. kdomainbench-0.1.0/src/kdomainbench/methods/run_spagcn.py +85 -0
  28. kdomainbench-0.1.0/src/kdomainbench/methods/run_spatialde.py +56 -0
  29. kdomainbench-0.1.0/src/kdomainbench/methods/scmeb.R +62 -0
  30. kdomainbench-0.1.0/src/kdomainbench/metric_scripts/metrics.R +141 -0
  31. kdomainbench-0.1.0/src/kdomainbench/metric_scripts/scs.py +120 -0
  32. kdomainbench-0.1.0/src/kdomainbench/paper_metrics.py +120 -0
  33. kdomainbench-0.1.0/src/kdomainbench/plotting.py +469 -0
  34. kdomainbench-0.1.0/src/kdomainbench/registry.py +145 -0
  35. kdomainbench-0.1.0/src/kdomainbench/results.py +416 -0
  36. kdomainbench-0.1.0/src/kdomainbench/runner.py +340 -0
  37. kdomainbench-0.1.0/src/kdomainbench.egg-info/PKG-INFO +83 -0
  38. kdomainbench-0.1.0/src/kdomainbench.egg-info/SOURCES.txt +40 -0
  39. kdomainbench-0.1.0/src/kdomainbench.egg-info/dependency_links.txt +1 -0
  40. kdomainbench-0.1.0/src/kdomainbench.egg-info/entry_points.txt +2 -0
  41. kdomainbench-0.1.0/src/kdomainbench.egg-info/requires.txt +5 -0
  42. kdomainbench-0.1.0/src/kdomainbench.egg-info/top_level.txt +1 -0
@@ -0,0 +1,113 @@
1
+ # Changelog
2
+
3
+ Changes that users of kdomainbench notice, newest first. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## 0.1.0 (2026-11-29)
7
+
8
+ First release on PyPI: ten methods behind `kdb.run`, `kdb.run_all` and `kdomainbench run`, scoring
9
+ with `kdb.evaluate`, `kdb.load_results` and `kdb.k_accuracy`, the twelve metrics of the paper in
10
+ `kdb.metrics`, and the plots in `kdb.pl`.
11
+
12
+ The entries below are the changes since the GitHub version of 2 November 2026.
13
+
14
+ ### Added
15
+
16
+ - `kdb.metrics` and `kdomainbench metrics`: the twelve metrics of the paper, computed by the
17
+ paper's own `metrics.R` and `scs.py`. `kdomainbench check --metrics` tests them, and
18
+ `kdomainbench install metrics` installs their R packages.
19
+ - A run folder records the package version and the settings that change a method
20
+ (`run_info.json` fields `kdomainbench` and `env`), and the packages of the method's
21
+ environment (`packages.txt`).
22
+ - `kdb.run_all` ends with one warning that names every method that did not finish.
23
+ - `load_results(h5ad=)` and `kdomainbench summarize --h5ad` score runs made on another machine.
24
+ On the command line each file scores the runs of the dataset of its name, and `--h5ad` can
25
+ be repeated. `summarize --reference-key` scores against another `obs` column.
26
+ - `kdb.pl.plot_metrics`: the metrics of every run as a matrix of bars, laid out as Fig. 2f of
27
+ the paper.
28
+ - `kdomainbench install`: creates the conda environments and installs the R packages from files
29
+ that now come with the package (`src/kdomainbench/envs/`). `KDB_ENVS_DIR` and `KDB_R_LIB` say
30
+ where. `kdb.example_data()` downloads the example file.
31
+ - `kdomainbench --version`.
32
+ - `run_info.json` records `OMP_NUM_THREADS`, and Run on a cluster says how to keep CellCharter,
33
+ DeepST and SpaGCN to the cores of a job.
34
+ - `kdb.evaluate`, `kdb.reference_annotation` and the plots accept an AnnData object for the
35
+ input file and a run folder for the labels. `kdb.evaluate` also compares two runs.
36
+ - `kdomainbench check` looks for every R package the method scripts load and reads an `.h5ad`
37
+ file from R. `check --gpu` fails when no GPU is visible.
38
+ - Pages: the how-to guides Your own data, Run on a cluster and Troubleshooting, the Command
39
+ line reference, FAQ, Citation, Contributing and Changelog.
40
+ - `CONTRIBUTING.md`, and a GitHub Actions workflow that runs the tests and builds the site.
41
+ - `kdb.evaluate` and `kdb.load_results` warn when labels of a run belong to no spot of the input
42
+ file, and `kdb.load_results` warns when successful runs could not be scored. A file without
43
+ an annotation gives no warning.
44
+ - A run's `cluster_results.csv` read with `pd.read_csv` is accepted as the labels of a run.
45
+ Barcodes that look like numbers need `dtype=str` there.
46
+ - A run folder made by hand needs only `method`, `dataset`, `h5ad` and `"success": true` in its
47
+ `run_info.json` to be listed and scored.
48
+ - `kdb.evaluate(clusters, h5ad, reference_key=...)` scores against another `obs` column.
49
+ - The messages about a missing environment give the address of the installation page.
50
+
51
+ ### Changed
52
+
53
+ - Breaking: `kdb.run` takes `out_root` instead of `out_dir`, with the folder layout of
54
+ `kdb.run_all` and `kdomainbench run -o`: `<out_root>/<method>/<dataset>_<device>`.
55
+ - Breaking, to the terms of the paper: `ground_truth` is now `reference_annotation` (its `key`
56
+ is `reference_key`), `k_true` is `k_reference`, `truth_key` is `reference_key`,
57
+ `evaluate(truth=)` is `evaluate(reference=)`, and the `n_spots` of `evaluate` is
58
+ `n_spots_scored`. `plot_k_estimates(k_true=)` is
59
+ `plot_k_estimates(k_reference=)`.
60
+ - `kdb.pl.plot_k_estimates` has one row per method and colors each dot by its distance from
61
+ the reference k, as Fig. 2b of the paper. Runs of several datasets are drawn as k errors.
62
+ Breaking: `k_reference` takes one number, not a list.
63
+ - `gpu_id` defaults to the GPUs a scheduler names in `CUDA_VISIBLE_DEVICES`, else GPU 0.
64
+ - `kmax` is checked before any method starts: at least 2 for every method, also for DeepST and
65
+ SpaGCN, which do not use it, and at most 30 for BNPSpace.
66
+ - A run that is stopped or fails stays on record with `"success": false`, and labels or
67
+ metrics of an earlier run in the same folder are deleted first.
68
+ - `load_results` raises `FileNotFoundError` for a folder that does not exist and always returns
69
+ the score columns. It raises `ValueError` when one `h5ad` file is given for runs of several
70
+ datasets.
71
+ - `kdb.run` and `kdb.run_all` stop before any method starts when the input is a folder or not
72
+ an `.h5ad` file.
73
+ - `kdomainbench summarize` prints the main columns, and each reason a run was not scored once.
74
+ `--csv` keeps every column. Warnings print without Python's source line.
75
+ - `kdomainbench run`, `metrics` and `summarize` exit with an error code when a method did not
76
+ finish, a metric could not be computed or no run succeeded.
77
+ - A fatal error of `kdomainbench` is one line that starts with `kdomainbench: error:`, and a
78
+ method named twice runs once.
79
+ - `kdb.read_clusters`, `kdb.load_results(h5ad=)`, `kdb.k_accuracy` and the plots say what is
80
+ wrong with their input: a run that did not finish, an input file that does not exist, a
81
+ table without the columns of `load_results`.
82
+ - `kdb.pl.plot_spatial_grid` titles each map `<method> (k = n)`.
83
+ - `drsc.R` no longer reads `obs["clusters"]`, so it runs on files without an annotation.
84
+ - Breaking: `envs/install_r_packages.R`, `envs/kdb_py.yml` and `envs/kdb_spatialde.yml` moved to
85
+ `src/kdomainbench/envs/`. Use `kdomainbench install r` in place of
86
+ `Rscript envs/install_r_packages.R`.
87
+ - `KDB_ENVS_DIR` is also read when a method starts: the environments are looked for in that
88
+ folder first.
89
+ - An interpreter or an R library named by a relative path (`KDB_PY_PYTHON`, `KDB_R_LIB`,
90
+ `kdb.set_env`) is counted from the folder you work in, not from the run folder.
91
+ - `load_results(h5ad=)` checks the files it is given before it reads any run: a folder or a
92
+ file that is not `.h5ad` raises at once. Messages about an input file give its full path.
93
+ - The dependencies have lower bounds: numpy 1.23, pandas 1.5, matplotlib 3.6, scikit-learn 1.2,
94
+ anndata 0.9. The tests pass on these versions with Python 3.10.
95
+ - The license is stated as GPL-3.0-only AND MIT in the package metadata. MIT is the license of
96
+ the BNPSpace code in `methods/bnpspace_R/`.
97
+ - `envs/install_envs.sh` and `kdomainbench install` keep the packages of `~/.local` and
98
+ `PYTHONPATH` out of sight while the environments are created.
99
+ - The R package installer stops at once when R is older than the packages need, installs the
100
+ CRAN and Bioconductor packages in one pass, and builds up to four packages at a time.
101
+ - iSC.MEB is no longer on CRAN. The installer takes its release 1.0 from its authors' GitHub
102
+ repository, at a fixed commit. SC.MEB 1.1 is built as C++14, which the current RcppArmadillo
103
+ needs.
104
+ - An AnnData object where only a file will do (`kdb.run`, `kdb.run_all`, `load_results(h5ad=)`)
105
+ raises a `TypeError` that says to save it first.
106
+ - `kdb.run_all` prints the last lines of a failed method's log once, not twice.
107
+ - `dir(kdb)` lists the public names only.
108
+ - Python 3.10 or later.
109
+
110
+ ### Removed
111
+
112
+ - The `docs` extra of `pyproject.toml`. Use `docs/requirements.txt`.
113
+ - cowplot from `envs/install_r_packages.R`: no method script loads it.