scverse / scvi-tools

Deep probabilistic analysis of single-cell and spatial omics data
http://scvi-tools.org/
BSD 3-Clause "New" or "Revised" License
1.16k stars 341 forks source link

Specifying cell types in the new MRVI tool #2839

Closed jindalk closed 2 weeks ago

jindalk commented 2 weeks ago

I'm trying to use the new MRVI model, from scvi.external, how do I bias the model with existing cell type annotations? I've posted my code below, but wasn't sure if this was correct

sc.pp.highly_variable_genes(adata, n_top_genes=10000,
                            flavor="seurat", batch_key="batch",
                            inplace=True, subset=True)

sample_key = "sampleID_study"  # target covariate
batch_key= "batch"  # nuisance variable identifier
MRVI.setup_anndata(adata, sample_key=sample_key, batch_key=batch_key, labels_key="celltype")

model = MRVI(adata, u_prior_mixture_k=13)
model.train(max_epochs=400)
canergen commented 2 weeks ago

Hi, thanks for trying out MrVI. This is not a bug (so closing here). Please restrict the label to real bugs (unexpected behaviour). For user questions, we prefer our scverse discourse forum. To the original question: yes, and you don't have to worry u_prior_mixture_k. It automatically sets it to the number of celltypes in your study (so model = MRVI(adata) is safe.