lhc17 / HoloNet

HoloNet. Reveal the holograph of functional communication events in spatial transcriptomics. Help understand how microenvironments shaping cellular phenotypes
MIT License
20 stars 3 forks source link

Integration and obtain proper .h5ad file #7

Open yugengjiang opened 9 months ago

yugengjiang commented 9 months ago

Hi, I have also attempted to integrate single-cell and spatial transcriptomic data to obtain a predicted matrix of cell types, but I encountered issues during the conversion process between Seurat and h5ad formats, and was unable to obtain the desired .h5ad file as input for this project. Do you have any suggestions on how to resolve this issue? Thank you very much.

Louis

lhc17 commented 9 months ago

Thank you for using it ~ First you can use the generic method to convert Seurat object to h5ad.

sdata.loom <- as.loom(x = seurat.obj, filename = "./xx.loom", verbose = FALSE)
sdata.loom$close_all()

results_file = './xx.loom'

adatas = sc.read_loom(results_file, sparse=True, cleanup=False, dtype='float32')
adatas.write('./xx_seurat2scanpy.h5ad')

If you get an error, save the spatial transcriptome-specific part as a separate csv file. After that, you can look at the structure of the example adata and fill in the missing parts.

yugengjiang commented 9 months ago

Appreciate your reply, but based on the snippet of your reply, I have more doubts.

I recently learned by myself through an online tutorial to achieve the integration of the single-cell RNA data in the RDS format reference and the ST data and write it into h5ad through anndata, which did not use the conversion to the loom data format. In addition, I can't find the RDS-type single-cell reference dataset provided by the online tutorial, so I have a lot of doubts about the process of integrating my data, and I want to learn your complete R language fusion data code and the format of the input data.

Here's my code: integration

Thank you again for your interest.