Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predictions after scvi integration #145

Open
pirlowang opened this issue Feb 4, 2025 · 2 comments
Open

predictions after scvi integration #145

pirlowang opened this issue Feb 4, 2025 · 2 comments

Comments

@pirlowang
Copy link

I have run scvi integration for my 1.5 millions scRNA-seq data from multiple patients. when I run predictions = celltypist.annotate(adata, model = 'Adult_Human_Skin.pkl', majority_voting = True). It warning:
WARNING:celltypist.logger:⚠️ Warning: invalid expression matrix, expect all genes and log1p normalized expression to 10000 counts per cell. The prediction result may not be accurate

Then I run adata = adata.raw.to_adata() and rerun annotation. It goes well but running leiden clustering again. I never get this run done because the kernal is killed even if I set 100G memory.

The scvi command:
adata.layers['raw_counts']=adata.X.copy()
sc.pp.normalize_total(adata,target_sum=1e4)
sc.pp.log1p(adata)
adata.raw = adata
adata.raw = adata
scvi.model.SCVI.setup_anndata(adata, layer="raw_counts", batch_key='donor', categorical_covariate_keys=['platform'])
model = scvi.model.SCVI(adata, n_layers=1, n_latent=6, gene_likelihood="zinb")
model.train()
sc.pp.neighbors(adata, use_rep=SCVI_LATENT_KEY)
sc.tl.leiden(adata)
sc.tl.umap(adata)

@ChuanXu1
Copy link
Collaborator

@pirlowang, what's the shape of your raw count matrix? Does it contain only HVGs or all genes?

@pirlowang
Copy link
Author

adata has a layer 'raw_counts', and adata.raw.X contains all normalized gene counts. adata.X has only HVGs. here is my HVGs command:
sc.pp.highly_variable_genes(
adata,
flavor="seurat_v3",
n_top_genes=2000,
layer="counts",
batch_key="batch",
subset=True,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants