Skip to content

fix: preserve observation-major Harmony output - #487

Open
mvanhorn wants to merge 1 commit into
scverse:mainfrom
mvanhorn:fix/465-error-in-harmony-dimension-cannot-be-changed
Open

fix: preserve observation-major Harmony output#487
mvanhorn wants to merge 1 commit into
scverse:mainfrom
mvanhorn:fix/465-error-in-harmony-dimension-cannot-be-changed

Conversation

@mvanhorn

Copy link
Copy Markdown

Update _harmony in snapatac2/preprocessing/_harmony.py to normalize Z_corr against the input observation count: keep an observation-major result unchanged and transpose a component-major result for compatibility with older harmonypy releases. snap.pp.harmony currently transposes harmonypy's Z_corr result unconditionally before its public wrapper stores the matrix in .obsm.

Verify observation-major Z_corr is returned unchanged and can be written by harmony(..., inplace=True) to an AnnData .obsm entry with shape (n_obs, n_components); Verify legacy component-major Z_corr is transposed to the same observation-major shape, including the inplace=False return path.

Closes #465

@kaizhang

Copy link
Copy Markdown
Member

Thanks! I think the tests can be removed for such a small change.

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.

Error in harmony: 'dimension cannot be changed'

2 participants