cellgeni / sceasy

A package to help convert different single-cell data formats to each other
GNU General Public License v3.0
346 stars 52 forks source link

from AnnData to Seurat, AttributeError: 'dict' object has no attribute 'dtype' #47

Closed ekernf01 closed 2 years ago

ekernf01 commented 2 years ago

I'm converting an h5ad file to seurat and I get the error in the title. The h5ad file is from the kallisto|bustools pipeline, but I can't share it because it contains unpublished data. I also can't find publicly available example output from kb, but if you think it would help, I can try to generate some. For context, I provide:

I'm not familiar with the h5ad specification. Do you think this is a problem with the file, or maybe some version incompatibility? Thanks!

Versions

Ubuntu 20.04.3 focal fossa
R 4.1.2 bird hippie
conda 4.11.0
anndata                   0.6.19                     py_0    bioconda
Kallisto version: "0.46.2"
bustools version: "0.40.0"

Python packages from conda list

python_packages.txt

R packages from renv lockfile

renv.lock.txt

Traceback

Error in py_call_impl(callable, dots$args, dots$keywords) : 
AttributeError: 'dict' object has no attribute 'dtype'
7.
stop(structure(list(message = "AttributeError: 'dict' object has no attribute 'dtype'", 
call = py_call_impl(callable, dots$args, dots$keywords), 
cppstack = structure(list(file = "", line = -1L, stack = c("/home/ekernf01/.cache/R/renv/cache/v5/R-4.1/x86_64-pc-linux-gnu/reticulate/1.22/b34a8bb69005168078d1d546a53912b2/reticulate/libs/reticulate.so(Rcpp::exception::exception(char const*, bool)+0x74) [0x7fb00c5268d4]", 
"/home/ekernf01/.cache/R/renv/cache/v5/R-4.1/x86_64-pc-linux-gnu/reticulate/1.22/b34a8bb69005168078d1d546a53912b2/reticulate/libs/reticulate.so(Rcpp::stop(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x29) [0x7fb00c5165e9]", ...
6.
_args_from_dict at base.py#2146
5.
_read_args_from_h5ad at read.py#496
4.
read_h5ad at read.py#446
3.
anndata$read_h5ad(inFile)
2.
func(obj, outFile = outFile, main_layer = main_layer, ...)
1.
sceasy::convertFormat("../quantification/kallisto_bustools/counts_unfiltered/adata.h5ad", 
from = "anndata", to = "seurat", outFile = "../quantification/kallisto_bustools/counts_unfiltered/seurat.rds")
ekernf01 commented 2 years ago

I wonder if this is https://github.com/theislab/anndata/issues/287 . I will see if there is a fix there.

ekernf01 commented 2 years ago

Yes, it is. Fixed by using a newer version of anndata, available from conda-forge but not bioconda.

conda install "anndata>=0.7" -c conda-forge