zoom.sc_tool.score_cell_zoom
- zoom.sc_tool.score_cell_zoom(adata: anndata.AnnData, gene_rep: pandas.DataFrame, weight_key: str, sign_key: str, p_perm_key: str, weight_perm: pandas.DataFrame, sign_perm: pandas.DataFrame, direction: bool, gene_size: int, ctrl_match_key: str, weight_opt: str, n_genebin: int, return_ctrl_raw_score: bool, return_ctrl_norm_score: bool, n_jobs: int) pandas.DataFrame[source]
Calculates single-cell SBP-relevant enrichment scores.
- Parameters:
adata (ad.AnnData) – The AnnData object containing expression data. - adata.X should have underwent gene specificity score normalization. - adata.uns[‘GENE_STATS’] should be present.
gene_rep (pd.DataFrame) – Results for PLS-R, must contain following columns: - weight_key: Column name indicating the original gene weights for scoring. - sign_key: Column name indicating the direction of genes. - p_perm_key: Column name indicating the permutation p-values.
weight_perm (pd.DataFrame) – Gene weights in permutation tests.
sign_perm (pd.DataFrame) – Signed gene weights in permutation tests.
direction (bool) – If True, find gene set relevant to the positive direction of given SBP else negative direction.
gene_size (int) – Number of genes used for scoring.
ctrl_match_key (str) – Gene-level statistic used for matching control and SBP-relevant genes, must be present in adata.uns[‘GENE_STATS’].
weight_opt (str) – Gene-level statistic used for re-weighting SBP-relevant genes, must be present in adata.uns[‘GENE_STATS’].
n_genebin (int) – Number of bins for dividing genes by ctrl_match_key.
return_ctrl_raw_score (bool) – If True, return raw scores for control gene sets.
return_ctrl_norm_score (bool) – If True, return normalized scores for control gene sets.
n_jobs (int) – Number of cores used for parallel computation.
- Returns:
df_res – Results of single-cell SBP-relevant enrichment scores and other statistics. - raw_socre: Raw enrichment scores. - norm_score: Normalized enrichment scores. - p_perm: Single-cell level p-values estimated on spatial permutation tests of the same cell. - pval: Pooled p-value estimated on all permutation tests, all cells
- Return type:
pd.DataFrame
References