Signature scoring¶
Score a gene programme per cell against a background of expression-matched
control genes. cell_cycle_scoring is add_module_score run twice, on the S and
G2/M lists, plus the discrete phase call.
The control genes are drawn at random from expression bins, so these scores carry an RNG. Against R Seurat the per-cell phase call is 96.6 % concordant and the continuous scores correlate at Pearson ≥ 0.998 — the residual is the control draw, and nothing else. Cell-cycle vignette.
add_module_score
¶
add_module_score(seurat, features: Union[Sequence[str], Sequence[Sequence[str]], dict], pool: Optional[list[str]] = None, nbin: int = 24, ctrl: int = 100, name: str = 'Cluster', assay: Optional[str] = None, layer: str = 'data', seed: int = 1, search: bool = False) -> 'object'
Score one or more gene programs per cell.
Mirrors R's AddModuleScore(): each program's score is the mean expression of its genes minus the mean expression of a control set drawn from the same average-expression bins (so highly/lowly expressed genes are controlled for).
Parameters:
-
features(Union[Sequence[str], Sequence[Sequence[str]], dict]) –a single gene list, a list of gene lists, or a name->list dict.
-
pool(Optional[list[str]], default:None) –genes to sample controls from (default: all features).
-
nbin(int, default:24) –number of average-expression bins (Seurat default 24).
-
ctrl(int, default:100) –control genes sampled per program gene (Seurat default 100).
-
name(str, default:'Cluster') –metadata column prefix; programs become
{name}1,{name}2… (or the dict keys whenfeaturesis a dict). -
seed(int, default:1) –RNG seed for control-gene sampling.
-
search(bool, default:False) –if True, resolve program genes not found verbatim by a case/punctuation-insensitive match (local
UpdateSymbolList).
Returns:
-
``seurat``, with one metadata column added per program.–
Source code in truecell/module_score.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
cell_cycle_scoring
¶
cell_cycle_scoring(seurat, s_features: Optional[list[str]] = None, g2m_features: Optional[list[str]] = None, assay: Optional[str] = None, layer: str = 'data', set_ident: bool = False, nbin: int = 24, ctrl: int = 100, seed: int = 1) -> 'object'
Score S and G2/M phases and assign a discrete phase per cell.
Mirrors R's CellCycleScoring(): runs AddModuleScore for the S and G2/M gene
sets, writes S.Score / G2M.Score to metadata, and assigns Phase:
G1 when both scores are ≤ 0, otherwise whichever of S / G2M is larger.
Defaults to the Tirosh 2016 human gene sets (CC_GENES).
If set_ident is True, the active identity is set to Phase.
Source code in truecell/module_score.py
The bundled gene lists¶
CC_GENES
module-attribute
¶
CC_GENES = {'s_genes': ['MCM5', 'PCNA', 'TYMS', 'FEN1', 'MCM7', 'MCM4', 'RRM1', 'UNG', 'GINS2', 'MCM6', 'CDCA7', 'DTL', 'PRIM1', 'UHRF1', 'MLF1IP', 'HELLS', 'RFC2', 'RPA2', 'NASP', 'RAD51AP1', 'GMNN', 'WDR76', 'SLBP', 'CCNE2', 'UBR7', 'POLD3', 'MSH2', 'ATAD2', 'RAD51', 'RRM2', 'CDC45', 'CDC6', 'EXO1', 'TIPIN', 'DSCC1', 'BLM', 'CASP8AP2', 'USP1', 'CLSPN', 'POLA1', 'CHAF1B', 'BRIP1', 'E2F8'], 'g2m_genes': ['HMGB2', 'CDK1', 'NUSAP1', 'UBE2C', 'BIRC5', 'TPX2', 'TOP2A', 'NDC80', 'CKS2', 'NUF2', 'CKS1B', 'MKI67', 'TMPO', 'CENPF', 'TACC3', 'FAM64A', 'SMC4', 'CCNB2', 'CKAP2L', 'CKAP2', 'AURKB', 'BUB1', 'KIF11', 'ANP32E', 'TUBB4B', 'GTSE1', 'KIF20B', 'HJURP', 'CDCA3', 'HN1', 'CDC20', 'TTK', 'CDC25C', 'KIF2C', 'RANGAP1', 'NCAPD2', 'DLGAP5', 'CDCA2', 'CDCA8', 'ECT2', 'KIF23', 'HMMR', 'AURKA', 'PSRC1', 'ANLN', 'LBR', 'CKAP5', 'CENPE', 'CTCF', 'NEK2', 'G2E3', 'GAS2L3', 'CBX5', 'CENPA']}