Anndata Import Error with 0.8.0

Was having issues uploading h5ad files to galaxy (see error below). Turned out I was saving files with scanpy but the version of anndata was 0.8. Replacing anndata with 0.7.8 and writing with scanpy resolved the issue. Thought this may help someone.

Steps

  1. Downloaded " Single Cell Phenotyping on data 270 and data 317" from Galaxy.
  2. Uploaded to squidpy tool in galaxy-me–>worked fine
  3. read in file with anndata .8 and immediate re-wrote as new file. Uploaded to galaxy-me squidpy tool and got error below.
  4. Uninstalled anndata and installed anndata 0.7.8 and repeated step 3–>worked fine

Error:
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/anndata/_io/utils.py”, line 177, in func_wrapper
return func(elem, *args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/anndata/_io/h5ad.py”, line 527, in read_group
EncodingVersions[encoding_type].check(
File “/usr/lib/python3.8/enum.py”, line 387, in getitem
return cls.member_map[name]
KeyError: ‘dict’
During handling of the above exception, another exception occurred:

line 29, in main
adata = read_h5ad(anndata)
File “/usr/local/lib/python3.8/dist-packages/anndata/_io/h5ad.py”, line 421, in read_h5ad
d[k] = read_attribute(f[k])
File “/usr/lib/python3.8/functools.py”, line 875, in wrapper
return dispatch(args[0].class)(*args, **kw)
File “/usr/local/lib/python3.8/dist-packages/anndata/_io/utils.py”, line 183, in func_wrapper
raise AnnDataReadError(
anndata._io.utils.AnnDataReadError: Above error raised while reading key ‘/layers’ of type <class ‘h5py._hl.group.Group’> from /.

1 Like

Hi @glbarlow

Forwards and backwards compatibility between the anndata versions mentioned, and between other prior versions, is a clear technical challange but we don’t have any Q&A at this forum about it. Thanks for posting your help :rocket: I also created a tag for it specifically. This will be the first topic associated.

What Galaxy currently provides:

  • We try to document requirements in places that are directly accessible in the GUI to scientists. Below is one example of the key places to review a tool form – in addition to any details around input/parameter inputs and in the middle Help section.

    Screenshot of the top showing the tool name, Galaxy wrapper version, navigation through versions, plus linkouts to resources with full details.

    And, the very bottom of a tool form with citations in BibTeX and minimum technical dependency requirements.

  • The Dataset Information view ( :information_source: icon) also includes dependency information, but that is only available after a tool is used (lists what was actually used).

  • Tutorials include FAQ notes like this (training-data/method-version vs tool-wrapper-versions).

  • Galaxy itself also has some open issues.

  • Arguably, this tool could use a bit more information. Maybe the expected “data version range”, directly under the input selection area? With more in the Help section? If you or anyone else reading would like to help with that, or suggest the text to add, please open a request issue here or a PR against the development repository here.


XRef: for context, anndata specification issues with scientific community and author discussion are (at least) here and here