Fix all-NaN extra obs after PseudobulkSpace with groups_col#1006
Open
Zethson wants to merge 1 commit into
Open
Fix all-NaN extra obs after PseudobulkSpace with groups_col#1006Zethson wants to merge 1 commit into
Zethson wants to merge 1 commit into
Conversation
When `groups_col` is provided, `ps_adata.obs.index` is a joined string like "patient_cluster", so reindexing the per-group lookup against that index returned NaN for every extra column. The all-NaN `obs` then made formulaic drop every row, producing an empty-index design matrix that `DeseqDataSet` rejected (#1003). Reindex by the grouping columns themselves instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
pt.tl.PseudobulkSpace()#1003.PseudobulkSpace.computewas called withgroups_col, every obs column not produced bysc.get.aggregate(e.g.Efficacy,Treatment) came out all-NaN. The per-group lookup is aMultiIndex(target_col, groups_col), but it was being reindexed againstps_adata.obs.index, which is the joined"target_groups"string index — so nothing matched.DeseqDataSetrejects: with all-NaN factors, formulaic drops every row.Indexwhen there is one grouping col,MultiIndex.from_framewhen there are two), then re-attachps_adata.obs.index.groups_colis set.