scib.metrics.cell_cycle
- scib.metrics.cell_cycle(adata_pre, adata_post, batch_key, embed=None, agg_func=<function mean>, organism='mouse', n_comps=50, verbose=False, recompute_cc=True, precompute_pcr_key=None)
Cell cycle conservation score
Compare the variance contribution of S-phase and G2/M-phase cell cycle scores before and after integration. Cell cycle scores are computed per batch on the unintegrated data set, eliminating the batch effect confounded by the
batch_key
variable.\[CC \, conservation = 1 - \frac { |Var_{after} - Var_{before}| } {Var_{before}}\]Variance contribution is obtained through principal component regression using
pc_regression()
. The score can be computed on full corrected feature spaces and latent embeddings.- Parameters
adata_pre – adata before integration
adata_post – adata after integration
embed – Name of embedding in adata_post.obsm. If
embed=None
, use the full expression matrix (adata.X
), otherwise use the embedding provided inadata_post.obsm[embed]
agg_func – any function that takes a list of numbers and aggregates them into a single value. If
agg_func=None
, all results will be returnedorganism – ‘mouse’ or ‘human’ for choosing cell cycle genes
recompute_cc – If True, force recompute cell cycle score, otherwise use precomputed scores if available as ‘S_score’ and ‘G2M_score’ in adata.obs
precompute_pcr_key – Key in adata_pre for precomputed PCR values for cell cycle scores. Ignores cell cycle scores in adata_pre if present.
- Returns
A score between 1 and 0. The larger the score, the stronger the cell cycle variance is conserved.