cellgeni / sceasy

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

Error when converting anndata to seurat #56

Closed Merlin2333 closed 2 years ago

Merlin2333 commented 2 years ago

When I use the function sceasy::convertFormat(seurat_object, from="seurat", to="anndata",outFile='filename.h5ad'), an error occurs: Error in validObject(.Object) : invalid class "DimReduc" object: invalid object for slot "cell.embeddings" in class "DimReduc": got class "data.frame", should be or extend class "matrix".

It turns out that _scvi_extra_categoricals from the obsm field is data.frame rather than matrix (numpy). It would be greatly appreciated if the function can wraps/convert dataframs as matrix objects while reading them.

Lila14 commented 2 years ago

I fixed the issue in a fork: https://github.com/elementgenomicsinc/sceasy

Also created a PR

nh3 commented 2 years ago

Thank you @Merlin2333 for reporting the issue and @Lila14 for the fix.