pegasus.calc_signature_score¶
-
pegasus.calc_signature_score(data, signatures, n_bins=50)[source]¶ Calculate signature / gene module score.
This is an improved version of Livnat et al. 2018 Cell implementation.
- Parameters
data (
anndata.AnnData) – Annotated data matrix with rows for cells and columns for genes.signatures (
Dict[str, List[str]]) – A dictionary containing multiple signature score calculation requests. Each score will be stored in data.obs field with key as the keyword. The value of the dict is a list of gene symbols.n_bins (
int, optional, default: 50) –
- Return type
None- Returns
None.Update
data.obs–data.obs["key"]: signature / gene module score for signature “key”
Update
data.var–data.var["mean"]: Mean expression of each gene across all cells. Only updated if “mean” does not exist in data.var.data.var["bins"]: Bin category for each gene. Only updated if data.uns[“sig_n_bins”] is updated.
Update
data.obsm–data.obsm["sig_background"]: Expected signature score for each bin category. Only updated if data.uns[“sig_n_bins”] is updated.
Update
data.uns–data.uns["sig_n_bins"]: Number of bins to partition genes into. Only updated if “sig_n_bins” does not exist or the recorded number of bins does not match n_bins.
Examples
>>> pg.calc_signature_score(data, {"T_cell_sig": ["CD3D", "CD3E", "CD3G", "TRAC"]})