scanpy.tl.score_genes_cell_cycle#

scanpy.tl.score_genes_cell_cycle(adata, *, s_genes, g2m_genes, out=False, copy=False, **kwargs)[source]#

Score cell cycle genes [Satija et al., 2015].

Given two lists of genes associated to S phase and G2M phase, calculates scores and assigns a cell cycle phase (G1, S or G2M). See score_genes() for more explanation.

Array type support#

Array type

supported

… experimentally in dask Array

numpy.ndarray

✅

❌

scipy.sparse.{csr,csc}_{array,matrix}

✅

❌

Parameters:
adata AnnData

The annotated data matrix.

s_genes Sequence[str]

List of genes associated with S phase.

g2m_genes Sequence[str]

List of genes associated with G2M phase.

out CellCycleOut | bool (default: False)

Where to write the outputs. A mapping from output names to accessors writes only the outputs it names, each to a different place, e.g. {'phase': A.obs['cc_phase']}. strs are anndata.acc.AdAcc.resolve()d. If True, they are returned as a CellCycleResult instead of written. If False, they are written to their default locations. The outputs are:

s_score

By default written to A.obs['S_score'].

g2m_score

By default written to A.obs['G2M_score'].

phase

By default written to A.obs['phase'].

copy bool (default: False)

Deprecated since version 1.13.0: Copy adata before calling this function instead.

Copy adata or modify it inplace.

**kwargs

Are passed to score_genes(). ctrl_size is not possible, as it’s set as min(len(s_genes), len(g2m_genes)).

Return type:

AnnData | CellCycleResult | None

Returns:

Returns the outputs as a CellCycleResult if out=True, else None. By default sets the following fields (see out for others):

adata.obs['S_score']pandas.Series (dtype object)

The score for S phase for each cell.

adata.obs['G2M_score']pandas.Series (dtype object)

The score for G2M phase for each cell.

adata.obs['phase']pandas.Series (dtype object)

The cell cycle phase (S, G2M or G1) for each cell.

See also

score_genes

Examples

See this notebook.