Repository navigation
fix: correctness fixes from the 0.7.0 code review - #217
Merged
Merged
Conversation
…istances'], logs convergence on the last sweep
…window, as 0.6.1 did Genes between two windows divided 0/0: NaN gene values for whole cells on the main thread, ZeroDivisionError in the serial kernel. _gene_values now takes the first window and window count per gene from _Layout.
…write_h5ad and write_zarr work
…constant rows, as for a dense one The CSR standardization kernel ignored duplicate entries and kept constant non-zero rows (rounding in the sum of squares). Densify into the float32 buffer and standardize in place instead; values match the old kernel within 1 ulp.
… from the lazy obs of read_lazy _obs_column moves to _util and loads one column of a lazy Dataset2D with its categories.
…ries; cnv_score obs_key warning points at the caller corr_iqr returns whether it sampled, so groups computed exactly after dropping constant cells are not reported as sampled. Unused categories got NaN scores; 0.6.1 left them out.
…nes without a start are left out NaN in the expression or the reference was read as 'inside the reference band' (0); it now raises. A gene without a start is dropped like a gene without a chromosome (pd.NA crashed, NaN was sorted last); a gene without an end ends at its start (0.6.1 never read end). chrM only, or min_mean leaving no gene on a chr chromosome, raised 'need at least one array to concatenate'.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
+ Coverage 92.96% 93.17% +0.20%
==========================================
Files 21 21
Lines 1593 1611 +18
==========================================
+ Hits 1481 1501 +20
+ Misses 112 110 -2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: This PR fixes six correctness problems that a code review of the 0.7.0 changes (v0.6.1 to main) found. Each one has a test that failed on main.
Changes:
tl.spatial_regions: it no longer modifies the caller's graph inadata.obsp. Before, removing the diagonal of a graph that stores one changed the shared CSR buffers and left the matrix inconsistent.obsp["distances"]is now rejected like other distance graphs.tl.infercnvwithwindow_size < step: genes outside every window are now left out, as in 0.6.1. Before, they gave 0/0, which produced NaN cell medians, or a ZeroDivisionError off the main thread.uns[...]["params"]: list-like values (pandas Index or Series, sets) are stored as lists. Before,write_h5adandwrite_zarrfailed after passing, for example,reference_cat=adata.obs["ct"].cat.categories[:2].tl.ithcnaandtl.ithgexon sparse input:anndata.experimental.read_lazy:tl.cnv_score, the ITH scores,tl.spatial_regionsand the fast heatmaps now read group columns through one helper, which also keeps the category order.tl.infercnvinput checks:Testing: The new tests failed on main and pass here. Gene values match infercnvpy 0.6.1 for several window and step combinations. The full suite passes on the HMGU cluster (641 passed, 12 skipped), and so do prek and mypy.