anndata: adata.write errors

Hi guys,

I’m really enjoying the efficiency and scalability of anndata. I have been using it to manage my large datasets. Excellent work!

But unfortunately i’m having bad luck in writing adata object to .h5ad-formatted hdf5 file.

adata.write(results_file)

It takes very long time and ends up with one of the errors below (I haven’t managed to store adata object in file)

  1. IndexError: too many indices for array 2)ValueError: name already used as a name or title

In adata object, I’m using different annotations including uns, obs, vars, obsm and it works smoothly without any errors. But each time i try to write it to file, the aforementioned errors are thrown out.

I will really appreciate your opinions. Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (15 by maintainers)

Most upvoted comments

Hi all, i have been using scanpy library for three months now, just discovered that adata.write will give “ValueError: name already used as a name or title” error if adata.obs contains a column name ‘index’.

Just sharing in case anyone else has this problem too.

Hi, for me it has something to do with duplicated column ( or duplication between column and index), you might want to remove that

Attaching a demo dataset with test conversion script.
issue_52_demo.tar.gz

For me, it errors like this:

$ ./demo_load_maggie.py 
Variable names are not unique. To make them unique, call `.var_names_make_unique`.
/opt/Python-3.7.0/lib/python3.7/site-packages/anndata/readwrite/write.py:301: UserWarning: Could not save field with key = "uns/condition_categories" to hdf5 file.
  'to hdf5 file.'.format(key))