scanpy.tl.score_genes#
- scanpy.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 [Tirosh et al., 2016]. - The score is the average expression of a set of genes after subtraction by the average expression of a reference set of genes. The reference set is randomly sampled from the - gene_poolfor each binned expression value.- This reproduces the approach in Seurat [Tirosh et al., 2016] (“MITF and AXL expression programs and cell scores” in materials and methods) and has been implemented for Scanpy by Davide Cittaro. - Parameters:
- adata
- The annotated data matrix. 
- gene_list
- The list of gene names used for score calculation. 
- ctrl_as_ref default: True
- Allow the algorithm to use the control genes as reference. Will be changed to - Falsein scanpy 2.0.
- ctrl_size 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 default: None
- Genes for sampling the reference set. Default is all genes. 
- n_bins default: 25
- Number of expression level bins for sampling. 
- score_name default: 'score'
- Name of the field to be added in - .obs.
- random_state default: 0
- The random seed for sampling. 
- copy default: False
- Copy - adataor modify it inplace.
- use_raw default: None
- Whether to use - rawattribute of- adata. Defaults to- Trueif- .rawis present.- Changed in version 1.4.5: Default value changed from - Falseto- None.
- layer default: None
- Key from - adata.layerswhose value will be used to perform tests on.
 
- Returns:
- Returns - Noneif- copy=False, else returns an- AnnDataobject. Sets the following field:- adata.obs[score_name]- numpy.ndarray(dtype- float)
- Scores of each cell. 
 
 - Examples - See this notebook.