theislab / scib

Benchmarking analysis of data integration tools
MIT License
294 stars 63 forks source link

AssertionError: counts is not a valid key in adata.layers #314

Open smk5g5 opened 2 years ago

smk5g5 commented 2 years ago

Hi,

It seems that count layers is missing when converting seurat to anndata using read_seurat.

I basically converted my seurat object to anndata here and it seems that count layers is missing when I try to run

out = anndata.copy()
scvi.data.setup_anndata(out, layer="counts", batch_key = 'Batch')

Error: -

INFO     Using batches from adata.obs["Batch"]
INFO     No label_key inputted, assuming all cells have same label
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/scvi/data/_anndata.py", line 190, in setup_anndata
    x_loc, x_key = _setup_x(adata, layer)
  File "/usr/local/lib/python3.9/dist-packages/scvi/data/_anndata.py", line 776, in _setup_x
    assert (
AssertionError: counts is not a valid key in adata.layers

How do I go about in correcting it?

LuckyMD commented 2 years ago

Hi! We tried to make this work for Seurat v3, but I guess it might not be working in v4 anymore. Which version of Seurat are you running?

smk5g5 commented 2 years ago

FWIW I am using Seurat V4. I would like to be involved in writing wrappers which makes porting your data from Seurat to anndata easier also include seurat normalization like vst (for calling hvgs) etc if its not already there so that seurat users can easily port their data and take advantage of multitude of algorithms available in scverse without having to reprocess(renormalize/recluster) their data in anndata.