brianhie / scanorama

Panoramic stitching of single cell data
http://scanorama.csail.mit.edu
MIT License
265 stars 49 forks source link

Cell cycle regress before run scanorama? #108

Closed Zifeng-L closed 2 years ago

Zifeng-L commented 2 years ago

Hi @brianhie , I tried to regress the cell-cycle genes effect before run scanorama. But I checked the source code of scanorama, it seemed that scanorama cannot use the result of regress out function for further analysis. How can I solve this problem?

brianhie commented 2 years ago

My suggestion would be to run PCA on the regressed out data before calling Scanorama, e.g., in Scanpy

# Load adata, s_genes, and g2m_genes
sc.tl.score_genes_cell_cycle(adata, s_genes=s_genes, g2m_genes=g2m_genes)
sc.pp.regress_out(adata, ['S_score', 'G2M_score'])
sc.pp.scale(adata)
sc.tl.pca(adata_cc_genes)
sc.external.pp.scanorama_integrate(adata, 'batch', basis='X_pca')

Then you can use adata.obsm['X_scanorama'] for further downstream analysis.