Skip to content

Error in harmony: 'dimension cannot be changed' #465

Description

@jeremymsimon

Previously ran some scATAC integration with harmony using snapATAC v2.8, recently updated to 2.9 and installed everything in a fresh mamba environment. Unfortunately now I'm getting a puzzling error:

snap.pp.harmony(obj, batch="sample")
[...]

Traceback (most recent call last):
  File "integrationClustering.py", line 158, in <module>
    main()
    ~~~~^^
  File "integrationClustering.py", line 28, in main
    snap.pp.harmony(obj, batch="sample")
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/jsimonlab/tools/miniforge3/envs/snapatac29/lib/python3.13/site-packages/snapatac2/preprocessing/_harmony.py", line 107, in harmony
    adata.obsm[use_rep + "_harmony"] = mat
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: dimension cannot be changed from 226129 to 30

The harmony part converged after 5 iterations and seemingly works up to the point where the matrix gets saved in the AnnDataSet .obsm, but fails at this step

My dimensionality reduction was with spectral embedding, so the default use_rep='X_spectral' should work fine here, and nothing appears to be wrong with my .obs['sample'] variable either

Any ideas what may be going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions