Fix #32: scipy>=1.15 compat + lamindb modules flag#34
Conversation
- preprocess.additional_postprocess: cast pandas boolean Series to numpy before indexing AnnData.X, since scipy>=1.15 removed implicit relaxed indexing of sparse arrays with pandas Series (reported in #32). - docs/README: replace deprecated 'lamin init --schema bionty' with the current 'lamin init --modules bionty' (lamindb 2.1.x). - bump version to 2.1.3. Refs #32.
There was a problem hiding this comment.
Pull request overview
Fixes a preprocessing regression with SciPy ≥ 1.15 when boolean-indexing sparse AnnData.X using a pandas Series, and updates LaminDB initialization instructions to use the newer --modules flag. Also bumps the package version for downstream pinning.
Changes:
- Cast boolean masks to NumPy arrays before indexing
AnnData.Xinadditional_postprocess(SciPy ≥ 1.15 compatibility). - Update docs/README LaminDB init command from deprecated
--schema biontyto--modules bionty. - Bump project version from
2.1.2to2.1.3.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
scdataloader/preprocess.py |
Fix sparse boolean indexing by converting pandas boolean Series masks to NumPy arrays. |
README.md |
Update lamin init examples to use --modules bionty. |
pyproject.toml |
Bump project version to 2.1.3. |
docs/notebooks/1_download_and_preprocess.ipynb |
Update commented lamin init command to --modules bionty. |
docs/index.md |
Mirror README doc change for lamin init --modules bionty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=======================================
Coverage 48.02% 48.02%
=======================================
Files 10 10
Lines 1976 1976
=======================================
Hits 949 949
Misses 1027 1027 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #32.
Changes
preprocess.additional_postprocess: castpd.Seriesboolean mask to numpy before indexingAnnData.X. scipy >= 1.15 dropped the implicit relaxed indexing of sparse arrays with pandas Series (see scipy/scipy@66ec333), soadata.X[adata.obs[NEWOBS] == i]raisesAttributeError: 'Series' object has no attribute 'nonzero'. Casting with.to_numpy()fixes the regression and is forward-compatible.lamin init --schema biontywith--modules bionty(lamindb 2.1.x). Also matches the reporter's working notebook (gist).2.1.3so scPRINT-2 can pin to the fixed release.Test plan
additional_postprocess(adata)with a mock AnnData) on scipy 1.15 — no moreAttributeError.CC @Stfort52 — thanks for the very thorough bug report (including the scipy commit pointer).