Automatic transfer to pan-disease CD8+ T cell atlas
We can use the trained model to transfer the cell type information from the reference to the query dataset using scatlasvae.pipeline.run_transfer.
Step1: Load the reference and query data
1import scatlasvae
2# available at https://zenodo.org/records/12542577/files/huARdb_v2_GEX.CD8.hvg4k.h5ad
3adata_reference = scatlasvae.read_h5ad("huARdb_v2_GEX.CD8.hvg4k.h5ad.h5ad")
4
5# Load the pre-computed cell latent representation
6# available at https://zenodo.org/records/13382785/files/huARdb_v2_GEX.CD8.hvg4k.X_gex.npy
7adata_reference.obsm['X_gex'] = np.load("huARdb_v2_GEX.CD8.hvg4k.X_gex.npy")
8
9# your query data
10adata_query = scatlasvae.read_h5ad("query_adata.h5ad")
11
12# If the number of genes in the query data is different from the reference data:
13
14adata_query = scatlasvae.pp._preprocess.subset_adata_by_genes_fill_zeros(
15 adata_query, adata_reference.var_names
16)
Step2: Transfer the cell type annotation
1scatlasvae.pipeline.run_transfer(
2 adata_reference,
3 adata_query,
4 "huARdb_v2_GEX.CD8.hvg4k.supervised.model", # available at https://zenodo.org/records/12542577/files/huARdb_v2_GEX.CD8.hvg4k.supervised.model
5 label_key = 'cell_subtype_3'
6)
Step3: Transfer the higher-resolution cell type annotation for Tex
1 # available at https://zenodo.org/records/13382785/files/huARdb_v2_GEX.CD8.Tex.hvg4k.h5ad?download=1
2adata_reference_tex = scatlasvae.read_h5ad("huARdb_v2_GEX.CD8.Tex.hvg4k.h5ad")
3adata_query_tex = adata_query[list(map(lambda x: 'Tex' in x, adata_query.obs['cell_subtype_3']))]
4
5scatlasvae.pipeline.run_transfer(
6 adata_reference_tex,
7 adata_query_tex,
8 "huARdb_v2_GEX.CD8.Tex.hvg4k.supervised.model", # available at https://zenodo.org/records/13382785/files/huARdb_v2_GEX.CD8.hvg4k.Tex.supervised.model
9 label_key = 'cell_subtype_4'
10)