scib.metrics.pcr_comparison
- scib.metrics.pcr_comparison(adata_pre, adata_post, covariate, embed=None, n_comps=50, scale=True, verbose=False)
Principal component regression score
Compare the explained variance before and after integration using
pc_regression()
. Return either the difference of variance contribution before and after integration or a score between 0 and 1 (scaled=True
) with 0 if the variance contribution hasn’t changed. The larger the score, the more different the variance contributions are before and after integration.- Parameters
adata_pre – anndata object before integration
adata_post – anndata object after integration
covariate – Key for adata.obs column to regress against
embed – Embedding to use for principal components. If None, use the full expression matrix (
adata.X
), otherwise use the embedding provided inadata_post.obsm[embed]
.n_comps – Number of principal components to compute
scale – If True, scale score between 0 and 1 (default)
verbose –
- Returns
Difference of variance contribution of PCR (scaled between 0 and 1 by default)