[go: nahoru, domu]

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

Anndata write error in saving uns #409

Closed
Hrovatin opened this issue Jul 31, 2020 · 2 comments
Closed

Anndata write error in saving uns #409

Hrovatin opened this issue Jul 31, 2020 · 2 comments
Assignees

Comments

@Hrovatin
Copy link
Hrovatin commented Jul 31, 2020

I get the below error when trying to save my anndata. The error occurs in uns saving. This does not seem to be the same as #52 as I did not change uns manually since last successfully saving my anndata (I only performed normalisation and HVG selection as suggested in a recent scanpy workshop).

Current uns:

OverloadedDict, wrapping:
	{'doublet_score_filter_colors': array(['#e62e0e', '#a8a8a8'], dtype=object), 'file_colors': array(['#1f77b4', '#ff7f0e', '#2ca02c'], dtype=object), 'log1p': {'base': None}}
With overloaded keys:
	['neighbors'].

The uns when I last successfully saved the object:

OverloadedDict, wrapping:
	{'doublet_score_filter_colors': array(['#e62e0e', '#a8a8a8'], dtype=object), 'file_colors': array(['#1f77b4', '#ff7f0e', '#2ca02c'], dtype=object)}
With overloaded keys:
	['neighbors'].

The error:

adata.write(shared_folder+'data_normalised.h5ad')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-24-1a519bf15528> in <module>
----> 1 adata.write(shared_folder+'data_normalised.h5ad')

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/anndata/_core/anndata.py in write_h5ad(self, filename, compression, compression_opts, force_dense, as_dense)
   1844             filename = self.filename
   1845 
-> 1846         _write_h5ad(
   1847             Path(filename),
   1848             self,

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/anndata/_io/h5ad.py in write_h5ad(filepath, adata, force_dense, as_dense, dataset_kwargs, **kwargs)
    110         write_attribute(f, "varp", adata.varp, dataset_kwargs=dataset_kwargs)
    111         write_attribute(f, "layers", adata.layers, dataset_kwargs=dataset_kwargs)
--> 112         write_attribute(f, "uns", adata.uns, dataset_kwargs=dataset_kwargs)
    113     if adata.isbacked:
    114         adata.file.open(filepath, "r+")

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/h5py/_hl/files.py in __exit__(self, *args)
    459     def __exit__(self, *args):
    460         if self.id:
--> 461             self.close()
    462 
    463     @with_phil

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/h5py/_hl/files.py in close(self)
    441                 for id_ in file_list:
    442                     while id_.valid:
--> 443                         h5i.dec_ref(id_)
    444 
    445                 self.id.close()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5i.pyx in h5py.h5i.dec_ref()

RuntimeError: Can't decrement id ref count (unable to close file, errno = 5, error message = 'Input/output error')
@ivirshup
Copy link
Member
ivirshup commented Aug 3, 2020

Thanks for the bug report!

Could you try removing None value from .uns["log1p"]["base"] = None and see if you're able to write then?

@ivirshup ivirshup self-assigned this Aug 3, 2020
@Hrovatin
Copy link
Author
Hrovatin commented Aug 3, 2020

Deleting "log1p" from uns does not help.
However, if I try to save it to a different location it works. Could be similar to scverse/scanpy#1351 (comment)?

@Hrovatin Hrovatin closed this as completed Aug 3, 2020
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

No branches or pull requests

2 participants