stereo.algorithm.score_genes.ScoreGenes.main

ScoreGenes.main(genes_used, ctrl_as_ref=True, ctrl_size=50, genes_reference=None, n_bins=25, random_state=0, use_raw=None, res_key='score')[source]

Score a set of genes for each cell/bin.

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 genes_reference for each binned expression value.

Parameters:
  • genes_used (Union[ndarray, List[str], Tuple[str]]) – The list of gene names used for score calculation.

  • ctrl_as_ref (bool) – Allow to use the control genes as reference, defaults to True

  • ctrl_size (int) – Number of reference genes to be sampled from each bin, defaults to 50, you can set ctrl_size=len(genes_used) if the length of genes_used is not too short.

  • genes_reference (Union[ndarray, List[str], Tuple[str], None]) – Genes for sampling the reference set, default is all genes.

  • n_bins (int) – Number of expression level bins for sampling, defaults to 25

  • random_state (Union[int, RandomState, None]) – The random seed for sampling, defaults to 0, fixed value to fixed result.

  • use_raw (Optional[bool]) – Whether to use the data.raw, defaults to True if data.raw is not None

  • res_key (str) – the column name of the result to be added in data.cells, defaults to “score”