Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading with ad.io.read_h5ad gives back csr_matrix even when saved with csr_array #1837

Open
2 of 3 tasks
alam-shahul opened this issue Jan 21, 2025 · 1 comment
Open
2 of 3 tasks

Comments

@alam-shahul
Copy link

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of anndata.
  • (optional) I have confirmed this bug exists on the master branch of anndata.

Report

Code:

import anndata as ad
import numpy as np
from scipy.sparse import csr_array

data = ad.AnnData(
    X=np.arange(10).reshape((5, 2)),
    obsp={
        'adjacency_matrix': csr_array(np.eye(5))
    }
)

data.write_h5ad('test_dataset.h5ad')

data = ad.io.read_h5ad('test_dataset.h5ad')

print(data.obsp['adjacency_matrix'])

Traceback:

Versions

0.11.3
@alam-shahul
Copy link
Author

Is this supposed to be the case?

@ilan-gold ilan-gold self-assigned this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants