Repository navigation
fix(pp): add_tile_matrix shape error when input AnnData has 0 vars - #42
Open
Starlitnightly wants to merge 1 commit into
Open
Starlitnightly wants to merge 1 commit into
Starlitnightly wants to merge 1 commit into
Conversation
add_tile_matrix assigned the (n_cells, n_tiles) matrix to adata.X before setting var, but the incoming AnnData (from import_fragments) has 0 vars, so AnnData rejected it: 'Data matrix has wrong shape (N, n_tiles), need to be (N, 0)' (omicverse issue #840). X and var must become consistent together — rebuild the object in place via _init_as_actual (preserving obs/uns/obsm/obsp), keeping the lazy .X path as a fallback for backed / AnnDataOOM inputs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVqVNig3oV6wz42YiQ9obZ
3 tasks done
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.
Problem
epione.pp.add_tile_matrix(adata, bin_size=500)crashes (reported as omicverse #840):The AnnData produced by
import_fragmentshas 0 vars.add_tile_matrixassigned the(n_cells, n_tiles)tile matrix toadata.Xbefore replacingvar, so AnnData validated the newXagainst the current (empty)varand rejected it. Assigningvarfirst would fail symmetrically —Xandvarmust become consistent together.Fix
Rebuild the object in place via
AnnData._init_as_actual(...)with the newX+var(preservingobs/uns/obsm/obsp), keeping the original lazy.Xassignment as a fallback for backed /AnnDataOOMinputs.Verification
Minimal repro (0-var AnnData + a tiny
fragments.tsv) now succeeds:Fixes omicverse/omicverse#840
🤖 Generated with Claude Code