Skip to content

Milo cleanup: address #181#986

Merged
Zethson merged 6 commits into
mainfrom
milo-cleanup
May 19, 2026
Merged

Milo cleanup: address #181#986
Zethson merged 6 commits into
mainfrom
milo-cleanup

Conversation

@Zethson
Copy link
Copy Markdown
Member

@Zethson Zethson commented May 19, 2026

Closes #181.

  • Rename add_covariate_to_nhoods_varadd_covariate_to_nhoods_obs (destination is mdata['milo'].obs). Old name kept as deprecated alias.
  • Preserve categorical dtypes when copying covariates (previous .astype('str') silently turned them into object, breaking downstream plots).
  • plot_nhood_counts_by_cond: clear error when test_var column is missing; coerce object columns to category.
  • da_nhoods: deprecate subset_samples (causes SpatialFDR bugs in edge cases — use contrasts or subset before kNN). Validate contrast levels against the design columns for both edgeR and pydeseq2 so the failure is informative instead of an opaque rpy2/pydeseq2 traceback.

Adds scverse-misc to dependencies for deprecated / deprecated_arg.

Zethson and others added 6 commits May 19, 2026 13:51
* Rename `add_covariate_to_nhoods_var` to `add_covariate_to_nhoods_obs`
  since the destination is `mdata['milo'].obs`, not `.var`. Keep the
  original name as a deprecated alias via `scverse_misc.deprecated`.
* Preserve categorical dtypes when copying covariates over (the previous
  `.astype('str')` silently turned categoricals into object dtype, which
  broke downstream plotting).
* `plot_nhood_counts_by_cond`: raise a clear error when `test_var` is
  missing (point at `add_covariate_to_nhoods_obs`) and coerce object
  columns to category before plotting.
* `da_nhoods`: deprecate `subset_samples` via `scverse_misc.deprecated_arg`
  (causes SpatialFDR bugs in edge cases; prefer contrasts or pre-subset
  cells before kNN graph building).
* `da_nhoods`: validate contrast levels against design columns for both
  edger and pydeseq2 solvers so users get a useful error instead of an
  rpy2/pydeseq2 traceback when a level is missing from the model matrix.

Closes #181.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test_tutorials: replace the hand-rolled BiocManager install + actions/cache
  step with `r-lib/actions/setup-r-dependencies@v2` and `use-public-rspm: true`,
  declaring `bioc::edgeR` and `any::statmod`. pak resolves the right Bioc
  release against the running R version, so we don't depend on BiocManager's
  autodetection (which started picking the wrong Bioc on R 4.5).
* Use a fully-qualified `:meth:` reference in the deprecated alias docstring
  so Sphinx can resolve it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Map it onto Sphinx's built-in `deprecated` directive so the docstring
fragments injected by `scverse_misc.deprecated` render without an
"Unknown directive type" error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nbsphinx-link is dead code in this repo — there are no `.nblink` files
and the tutorials submodule provides `.ipynb` directly. nbsphinx-link is
also incompatible with Sphinx 9 (vidartf/nbsphinx-link#26), which forced
the `<9.0` pin and in turn kept us off Sphinx 9's natively-supported
`.. version-deprecated::` directive that `scverse_misc.deprecated`
emits.

Dropping nbsphinx-link unblocks the Sphinx 9 upgrade and makes
`scverse_misc.deprecated` render without an "Unknown directive type"
error — so no extra registration in conf.py is needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Zethson Zethson merged commit d75da25 into main May 19, 2026
14 checks passed
@Zethson Zethson deleted the milo-cleanup branch May 19, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor issues in milopy tools

1 participant