rapids_singlecell.tl.score_genes

Contents

rapids_singlecell.tl.score_genes#

rapids_singlecell.tl.score_genes(adata, gene_list, *, ctrl_as_ref=True, ctrl_size=50, gene_pool=None, n_bins=25, score_name='score', random_state=0, copy=False, use_raw=None, layer=None)[source]#

Score a set of genes [SFG+15, TIP+16].

The score is the average expression of a set of genes subtracted with the average expression of a reference set of genes. The reference set is randomly sampled from the gene_pool for each binned expression value.

Parameters:
adata AnnData

The annotated data matrix.

gene_list Sequence[str] | Index

The list of gene names used for score calculation.

ctrl_as_ref bool (default: True)

Allow the algorithm to use the control genes as reference. Will be changed to False in scanpy 2.0.

ctrl_size int (default: 50)

Number of reference genes to be sampled from each bin. If len(gene_list) is not too low, you can set ctrl_size=len(gene_list).

gene_pool Sequence[str] | Index | None (default: None)

Genes for sampling the reference set. Default is all genes.

n_bins int (default: 25)

Number of expression level bins for sampling.

score_name str (default: 'score')

Name of the field to be added in .obs.

random_state int | None (default: 0)

The random seed for sampling.

copy bool (default: False)

Copy adata or modify it inplace.

use_raw bool | None (default: None)

Whether to use raw attribute of adata. Defaults to True if .raw is present.

layer str | None (default: None)

Key from adata.layers whose value will be used to perform tests on.

Return type:

AnnData | None

Returns:

Returns None if copy=False, else returns an AnnData object. Sets the following field:

adata.obs[score_name]numpy.ndarray (dtype float)

Scores of each cell.