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:
- Created 2 years ago
- Comments:12 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
The argument names appear a bit different e.g. batch_key>label, batch_categories>keys