scvi_criticism.PPC
Contents
scvi_criticism.PPC#
- class scvi_criticism.PPC(n_samples=1, raw_counts=None)#
Posterior predictive checks for comparing single-cell generative models
- Parameters
n_samples (
int(default:1)) – Number of posterior predictive samples to generateraw_counts (
Union[ndarray,csr_matrix,coo_matrix,None] (default:None)) – Raw counts matrix (cells x genes) as a numpy array, scipy coo_matrix, or scipy csr_matrix
Methods table#
|
Calculate the coefficient of variation (CV) for each model and the raw counts. |
|
Compute differential expression (DE) metrics. |
Calculate the Mann-Whitney U test between each model and the raw counts. |
|
|
Store posterior predictive samples for each model. |
Methods#
coefficient_of_variation#
- PPC.coefficient_of_variation(cell_wise=True)#
Calculate the coefficient of variation (CV) for each model and the raw counts.
- Parameters
cell_wise (
bool(default:True)) – Whether to calculate the CV cell-wise or gene-wise.
diff_exp#
- PPC.diff_exp(adata_obs_raw, adata_var_raw, de_groupby, de_method='t-test', var_gene_names_col=None, n_top_genes=None, n_top_genes_overlap=None)#
Compute differential expression (DE) metrics.
- Parameters
adata_obs_raw (
DataFrame) – Theobsdataframe from the raw AnnData object.adata_var_raw (
DataFrame) – Thevardataframe from the raw AnnData object.de_groupby (
str) – The column name inadata_obs_rawthat contains the groupby information.de_method (
str(default:'t-test')) – The DE method to use. Seerank_genes_groups()for more details.var_gene_names_col (
Optional[str] (default:None)) – The column name inadata_var_rawthat contains the gene names. IfNone, thenadata_var_raw.indexis used.n_top_genes (
Optional[int] (default:None)) – The number of top genes to use for the DE analysis. IfNone, then the default valueDEFAULT_DE_N_TOP_GENESis used.n_top_genes_overlap (
Optional[int] (default:None)) – The number of top genes to use for the DE analysis when computing the gene overlap metrics. IfNone, then the default valueDEFAULT_DE_N_TOP_GENES_OVERLAPis used.
mann_whitney_u#
- PPC.mann_whitney_u()#
Calculate the Mann-Whitney U test between each model and the raw counts.
store_posterior_predictive_samples#
- PPC.store_posterior_predictive_samples(models_dict, batch_size=32, indices=None)#
Store posterior predictive samples for each model.
- Parameters
models_dict – Dictionary of models to store posterior predictive samples for.
batch_size – Batch size for generating posterior predictive samples.
indices – Indices to generate posterior predictive samples for.