omicverse.utils.roe

omicverse.utils.roe(adata, sample_key, cell_type_key, pval_threshold=0.05, expected_value_threshold=5, order='F')[source]

Compute observed/expected (Ro/e) cell-type enrichment ratios.

Parameters:
  • adata (AnnData) – Input object with sample and cell-type annotations.

  • sample_key (str) – Column in adata.obs representing sample/condition groups.

  • cell_type_key (str) – Column in adata.obs representing cell-type labels.

  • pval_threshold (float, default=0.05) – Significance threshold for global contingency-table test.

  • expected_value_threshold (float, default=5) – Minimum expected count threshold used to judge chi-square validity.

  • order (str, default='F') – Optional comma-separated sample order for contingency table columns. Use 'F' to keep original order.

Returns:

Ro/e matrix with cell types as rows and samples as columns.

Return type:

pandas.DataFrame