From dcdfec9d997af24033685572f70647dcbc4eb8c8 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Thu, 30 Jul 2026 08:43:56 +0200 Subject: [PATCH 1/2] bump cellmapper_scvi's base image and align both obsm keys The 1.0.0 tag is on python 3.10, which caps cellmapper at 0.2.3, and 0.2.3 builds the map_obsm key as f"{key}_{prediction_postfix}" -- so the "_pred" postfix gave mod2__pred and the component KeyError'd on every run. The sliding :1 tag is on 3.12 and installs 0.2.6, which builds the key without the extra underscore. * Bump cellmapper_scvi to openproblems/base_pytorch_nvidia:1 * Require cellmapper>=0.2.6 in both components * Switch cellmapper_linear to the same "_pred" postfix, so both read obsm["mod2_pred"] --- CHANGELOG.md | 4 ++++ src/methods/cellmapper_linear/config.vsh.yaml | 3 ++- src/methods/cellmapper_linear/script.py | 4 ++-- src/methods/cellmapper_scvi/config.vsh.yaml | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e107b8bb..750cb8f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ ## BUG FIXES +* `cellmapper_scvi`: Bump the base image from `openproblems/base_pytorch_nvidia:1.0.0` to `:1`. The pinned tag was on Python 3.10, which caps cellmapper at 0.2.3 -- and 0.2.3 builds the `map_obsm` output key as `f"{key}_{prediction_postfix}"`, so the `"_pred"` postfix produced `mod2__pred` and every run raised `KeyError: 'mod2_pred'`. On the sliding tag (Python 3.12) cellmapper 0.2.6 installs, which builds the key without the extra underscore, and the existing postfix is correct (PR #53). + +* `cellmapper_linear`: Use `prediction_postfix="_pred"` so both cellmapper components read `obsm["mod2_pred"]`. Both now require `cellmapper>=0.2.6`, since the key format depends on the version (PR #53). + * `process_dataset`: Fall back to holding out a quarter of the batches when the dataset has no `obs["is_train"]`, rather than silently producing four empty h5ads. `obs["is_train"]` carries the NeurIPS 2021 competition split and stays optional; `obs["cell_type"]` is now declared and required (PR #28). * Fix the component paths, build paths and `rename_keys` separator in the helper scripts, which prevented `scripts/create_datasets/test_resources.sh` and both `run_test.sh` scripts from running at all (PR #22). diff --git a/src/methods/cellmapper_linear/config.vsh.yaml b/src/methods/cellmapper_linear/config.vsh.yaml index 821a846b..89552c7c 100644 --- a/src/methods/cellmapper_linear/config.vsh.yaml +++ b/src/methods/cellmapper_linear/config.vsh.yaml @@ -66,7 +66,8 @@ engines: setup: - type: python packages: - - cellmapper>=0.2.2 + # >= 0.2.6 builds the map_obsm output key as f"{key}{prediction_postfix}" + - cellmapper>=0.2.6 runners: - type: executable - type: nextflow diff --git a/src/methods/cellmapper_linear/script.py b/src/methods/cellmapper_linear/script.py index a3635928..194235e2 100644 --- a/src/methods/cellmapper_linear/script.py +++ b/src/methods/cellmapper_linear/script.py @@ -48,8 +48,8 @@ cmap.compute_mapping_matrix(kernel_method=par['kernel_method']) print("Predict on test data", flush=True) -cmap.map_obsm(key="mod2", prediction_postfix="pred") -mod2_pred = csc_matrix(cmap.query.obsm["mod2pred"]) +cmap.map_obsm(key="mod2", prediction_postfix="_pred") +mod2_pred = csc_matrix(cmap.query.obsm["mod2_pred"]) print("Write output AnnData to file", flush=True) output = ad.AnnData( diff --git a/src/methods/cellmapper_scvi/config.vsh.yaml b/src/methods/cellmapper_scvi/config.vsh.yaml index a86f6502..2cb45813 100644 --- a/src/methods/cellmapper_scvi/config.vsh.yaml +++ b/src/methods/cellmapper_scvi/config.vsh.yaml @@ -69,11 +69,14 @@ resources: dest: utils.py engines: - type: docker - image: openproblems/base_pytorch_nvidia:1.0.0 + image: openproblems/base_pytorch_nvidia:1 setup: - type: python packages: - - cellmapper>=0.2.2 + # >= 0.2.6 builds the map_obsm output key as f"{key}{prediction_postfix}", + # which is what the "_pred" postfix below relies on. Needs Python >= 3.12, + # hence the sliding base image tag rather than 1.0.0 (which was on 3.10). + - cellmapper>=0.2.6 - scvi-tools>=1.3.0 - muon>=0.1.6 From 7224ca9b5cd9ee0c8c3278c07584ee0ba778ef61 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Thu, 30 Jul 2026 08:50:08 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Robrecht Cannoodt --- CHANGELOG.md | 4 +--- src/methods/cellmapper_linear/config.vsh.yaml | 1 - src/methods/cellmapper_scvi/config.vsh.yaml | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 750cb8f4..f83ddd97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,9 +32,7 @@ ## BUG FIXES -* `cellmapper_scvi`: Bump the base image from `openproblems/base_pytorch_nvidia:1.0.0` to `:1`. The pinned tag was on Python 3.10, which caps cellmapper at 0.2.3 -- and 0.2.3 builds the `map_obsm` output key as `f"{key}_{prediction_postfix}"`, so the `"_pred"` postfix produced `mod2__pred` and every run raised `KeyError: 'mod2_pred'`. On the sliding tag (Python 3.12) cellmapper 0.2.6 installs, which builds the key without the extra underscore, and the existing postfix is correct (PR #53). - -* `cellmapper_linear`: Use `prediction_postfix="_pred"` so both cellmapper components read `obsm["mod2_pred"]`. Both now require `cellmapper>=0.2.6`, since the key format depends on the version (PR #53). +* `cellmapper_scvi`: Bump the base image from `openproblems/base_pytorch_nvidia:1.0.0` to `:1`. (PR #53). * `process_dataset`: Fall back to holding out a quarter of the batches when the dataset has no `obs["is_train"]`, rather than silently producing four empty h5ads. `obs["is_train"]` carries the NeurIPS 2021 competition split and stays optional; `obs["cell_type"]` is now declared and required (PR #28). diff --git a/src/methods/cellmapper_linear/config.vsh.yaml b/src/methods/cellmapper_linear/config.vsh.yaml index 89552c7c..e824cd85 100644 --- a/src/methods/cellmapper_linear/config.vsh.yaml +++ b/src/methods/cellmapper_linear/config.vsh.yaml @@ -66,7 +66,6 @@ engines: setup: - type: python packages: - # >= 0.2.6 builds the map_obsm output key as f"{key}{prediction_postfix}" - cellmapper>=0.2.6 runners: - type: executable diff --git a/src/methods/cellmapper_scvi/config.vsh.yaml b/src/methods/cellmapper_scvi/config.vsh.yaml index 2cb45813..c54b1963 100644 --- a/src/methods/cellmapper_scvi/config.vsh.yaml +++ b/src/methods/cellmapper_scvi/config.vsh.yaml @@ -73,9 +73,6 @@ engines: setup: - type: python packages: - # >= 0.2.6 builds the map_obsm output key as f"{key}{prediction_postfix}", - # which is what the "_pred" postfix below relies on. Needs Python >= 3.12, - # hence the sliding base image tag rather than 1.0.0 (which was on 3.10). - cellmapper>=0.2.6 - scvi-tools>=1.3.0 - muon>=0.1.6