YangLabHKUST / STitch3D

Construction of a 3D whole organism spatial atlas by joint modeling of multiple slices
https://stitch3d-tutorial.readthedocs.io/en/latest/index.html#
MIT License
52 stars 2 forks source link

Problems in loading the human heart original dataset into R #20

Open cristalliao opened 1 year ago

cristalliao commented 1 year ago

Dear Professor,

I have encountered some problems in loading the human heart dataset into R. Could you please help me to check what the problem is?

Firstly, I read the original dataset in Python using tutorial code. I treat the "adata_st_list_raw" dataset as the original dataset for each slice 0-8.

Screen Shot 2023-08-12 at 3 09 38 pm

And I find this dataset's type is a list, and each element in this list is the AnnData object

Screen Shot 2023-08-12 at 3 11 00 pm

So I want to save each element in the list as an h5ad file since I want to read them in R: For example, I want to save slice0 original dataset as h5ad

Screen Shot 2023-08-12 at 3 12 19 pm

I use the code slice_0_raw.write_h5ad('/dski/nobackup/xiaoyinl/STitch3D_analysis_and_dataset/human_dataset_orignal/slice_0_raw.h5ad') And then in R use the code Convert("/dski/nobackup/xiaoyinl/STitch3D_analysis_and_dataset/human_dataset_orignal/slice_0_raw.h5ad", dest = "h5seurat", overwrite = F) But I encountered a very strange error in loading the h5seurat object, it said

"Validating h5Seurat file Warning: Non-unique features (rownames) present, making uniqueInitializing RNA with data Adding counts for RNA Adding scale.data for RNA Warning: Non-unique features (rownames) present, making uniqueAdding feature-level metadata for RNA Adding reduction loc_use Adding cell embeddings for loc_use Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from locuse to locuseWarning: All keys should be one or more alphanumeric characters followed by an underscore '', setting key to locuse_Adding miscellaneous information for loc_use Adding reduction spatial Adding cell embeddings for spatial Adding miscellaneous information for spatial Error in if (!x[[i]]$dims) { : the condition has length > 1"

The main error is "Error in if (!x[[i]]$dims) { : the condition has length > 1"

Screen Shot 2023-08-12 at 3 23 38 pm

Do you encounter the same error as me? Do you have any suggestions to solve this problem? Thanks a lot!

cristalliao commented 1 year ago

I think this error means this h5seurat is too big. Or do I have any other solutions to solve this problem? Thanks a lot!

gefeiwang commented 1 year ago

Hi Cristal,

This may be caused by some problem in the LoadH5Seurat function. You can load the data csv files (counts, locations, meta information, etc.) directly into R, or use anndata package to read h5ad files in R to run R packages.

Best, Gefei

cristalliao commented 1 year ago

Dear Professor Gefei, Thanks a lot! I will try it in another way. Thanks for your help! Very appreciated!

Best regards, Cristal