nichesphere.tl.get_PIC_BG_OEratios_DF

nichesphere.tl.get_PIC_BG_OEratios_DF#

nichesphere.tl.get_PIC_BG_OEratios_DF(adata, annot_col, target_pairs, nreps=1000, njobs=10, downsample_cells=False, cell_list_downsample=None, downsampling_factor=6, pseudocount=1e-10)#

Generate nreps sets of O/E ratios for cell type pair co-localization probabilities by running PIC_BGdoubletsOEratios_parallel() in parallel.

Parameters:
  • adata (AnnData) – Singlets (scRNA-seq) anndata object.

  • annot_col (str) – Name of the cell type annotation column in adata.obs.

  • target_pairs (list or pd.Index) – Cell type pairs to evaluate.

  • nreps (int, default 1000) – Number of random background iterations.

  • njobs (int, default 10) – Number of parallel jobs (passed to joblib.Parallel).

  • downsample_cells (bool, default False) – Downsample over-represented cell types before pairing (see downsample_class()).

  • cell_list_downsample (list or None, default None) – Cell types to downsample (used only when downsample_cells=True).

  • downsampling_factor (int, default 6) – Reduction factor for downsampling.

  • pseudocount (float, default 1e-10) – Pseudocount passed to PIC_BGdoubletsOEratios_parallel().

Returns:

df – DataFrame of shape (nreps, n_pairs); each row is one set of O/E ratios and each column corresponds to a cell type pair.

Return type:

pd.DataFrame