-
Notifications
You must be signed in to change notification settings - Fork 152
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
AttributeError: 'DataDict' object has no attribute 'copy' #895
Comments
Thanks for the report. That does seem strange. I think the issue that we're assuming the dict-like values are actually Did you literally run: import scanpy as sc
adata = sc.read_h5ad('/path/to/my.h5ad')
sc.pp.filter_cells(adata, min_genes=200) Because I don't think that should be able to give you anything in Could you please also report some info on your environment? E.g. the output of |
My apologies -- this happens when converting a pegasus object to anndata. adata = pg.read_input('../cellbender/SAM24425932/SAM24425932_cellbender_out_filtered.h5')
adata = adata.to_anndata()
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3)
AttributeError: 'DataDict' object has no attribute 'copy' Saving it first, then reading it with scanpy.read_h5ad works fine. adata = pg.read_input('../cellbender/SAM24425932/SAM24425932_cellbender_out_filtered.h5')
pg.write_output(adata, 'test.h5ad')
adata = sc.read_h5ad('test.h5ad')
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3) I guess this is more a question for the developers of pegasus, but it does seem like something is missing when converting, Context: (I can now load these h5 files from cellbender using the function provided here, but still have issues saving - hence why I'm trying to find a way to convert between the two 'formats'.) |
Yes, I think this would be an issue for pegasus. It shouldn't be putting You could maybe do something like: from collections.abc import Mapping
def sanitize_uns(d):
return {k: sanitize_uns(v) if isinstance(v, Mapping) else v for k, v in d.items()}
adata.uns = sanitize_uns(adata.uns) Potentially we should be more aggressive with converting on the anndata side. However, |
This issue has been automatically marked as stale because it has not had recent activity. |
I’m closing this because there was no follow-up. Please feel free to respond and we’ll re-open it. |
Trying to work with an anndata object that I can use with
pegasus
just fine returns the following error:Any ideas what could be going on and how to fix this?
The text was updated successfully, but these errors were encountered: