caokai1073 / uniPort

a unified single-cell data integration framework by optimal transport
MIT License
30 stars 3 forks source link

uniPort also does the annotations in the spatial data? #2

Open ankitbioinfo opened 1 year ago

ankitbioinfo commented 1 year ago

Thanks for making a such a beautiful program. I read the paper and it impute the genes in spatial data using scRNA-sequencing data. I was reading following tutorial https://uniport.readthedocs.io/en/latest/examples/MERFISH/MERFISH_and_scRNA.html

And it create a latent representation of combined spatial and sequencing data. I am more interested in following function uniport.metrics.label_transfer(ref, query, rep='latent', label='celltype') to transfer the annotation of single-cell sequencing into spatial data. So I am bit confused how to use label_transfer function for my data. I have the following (1) spatial data (adata_merfish): AnnData object with n_obs × n_vars = 7416 × 241 (2) sequencing data (adata_rna with HVG): AnnData object with n_obs × n_vars = 2239 × 2000 (3) adata_cm = adata_merfish.concatenate(adata_rna, join='inner', batch_key='domain_id') (4) adata = up.Run(adatas=[adata_merfish, adata_rna], adata_cm=adata_cm) AnnData object with n_obs × n_vars = 9655 × 188

Could you guide me that what should go in ref and query variable in the label_transfer because adata_merfish and adata_rna have different number of genes? Thank you.

caokai1073 commented 1 year ago

Hi, thanks for your interest in our work!

It seems that there are 188 common genes between spatial data and sequencing data in your data. The output adata of 'up.Run' contains both spatial data and sequencing data with common 188 genes. Therefore, you can use the following if you want to transfer labels from RNA to spatial:

RNA_ref = adata[adata.obs['source']=='RNA'] MERFISH_query = adata[adata.obs['source']=='MERFISH'] MERFISH_predict_label = uniport.metrics.label_transfer(ref=RNA_ref, query=MERFISH_query, label='cell_type')

Please tell me if that doesn't work. Thanks!

ankitbioinfo commented 1 year ago

Hi Thanks for the help. It seems working.