question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Anndata.concatenate() fails when .X has a dimension of size 0

See original GitHub issue
>>> from anndata import AnnData
>>> import numpy as np
>>> adata = AnnData(X=np.empty([1,0]))
>>> adata
AnnData object with n_obs × n_vars = 1 × 0
>>> AnnData.concatenate(adata, adata)

Error: IndexError: index 0 is out of bounds for axis 0 with size 0

Running anndata ‘0.7.5’

The reason this is an issue for me is that the scirpy TCR package builds adata like that https://github.com/icbi-lab/scirpy/blob/507c943e50a2d2ba5b0011575030db85dd5b316b/scirpy/io/_convert_anndata.py#L81

A fix or workaround would be great, thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ivirshupcommented, Apr 9, 2021

@gokceneraslan I’ve opened a new issue for that since it seems different. I certainly think it’s a weird thing to do (since you are extending axis=1 with no elements), but I can’t think of a reason why we would want to error for that. It’s also a different bug from this since it’s coming from different code.

1reaction
chris-randscommented, Mar 25, 2021

The argument names appear a bit different e.g. batch_key>label, batch_categories>keys

Read more comments on GitHub >

github_iconTop Results From Across the Web

Anndata.concatenate() fails when .X has a dimension of size 0
Error: IndexError: index 0 is out of bounds for axis 0 with size 0. Running anndata '0.7.5'. The reason this is an issue...
Read more >
Concatenation — anndata 0.9.0.dev37+g312e6ff documentation
Concatenation is when we keep all sub elements of each object, and stack these elements in an ordered way. Merging is combining a...
Read more >
Release notes — anndata 0.9.0.dev36+g18078aa ...
AnnData object created from dataframes with sparse values will have sparse .X #395 I Virshup. Bug fixes. Fixed error from AnnData.concatenate by bumping ......
Read more >
AnnData.concatenate - Read the Docs
The concatenated object will just have an empty dict for uns . "same" : Only entries which have the same value in all...
Read more >
Release Notes — anndata 0.7.8 documentation
AnnData object created from dataframes with sparse values will have sparse .X PR 395 I Virshup. Bug fixes. Fixed error from AnnData.concatenate by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found