TencentAILabHealthcare/scBERT

Code to annotate and plot cells?

patricks-lab opened this issue · 2 comments

Thanks a lot for the great work and paper. I was wondering if there is any code to annotate and plot cells from your pretrained model, in a similar way as Figure 2 of your paper (https://www.nature.com/articles/s42256-022-00534-z/figures/2)?

Thanks a lot in advance!

to see the pretrained embedding you can do:

adata = sc.read('Zheng68K.h5ad')

# move the tsne embedding to adata.obsm
adata.obsm['X_tsne'] = np.vstack((adata.obs['TSNE.1'].values, adata.obs['TSNE.2'].values)).T
adata.obs.drop(['TSNE.1', 'TSNE.2'], axis=1, inplace=True)

sc.pl.tsne(adata, color='celltype')

Please take a look at those commonly used packages for single-cell data analysis, such as Scanpy. There are a lot of easy-to-use tutorials on its website.