scatrans.pl.enrich_upsetplot

scatrans.pl.enrich_upsetplot#

scatrans.pl.enrich_upsetplot(enrich_df, cluster_col=None, pval_cutoff=0.05, min_count=1, max_terms=40, title='Enriched Term Overlap (UpSet-style)', figsize=(11, 6.5), dpi=300, fontsize=10, save_path=None, show=True, use_style=False)[source]#

UpSet-style plot for term overlap across clusters/groups (compareCluster style).

Works directly on the output of:
  • scat.compare_enrichment(…)

  • scat.concat_compare_results(…)

  • or any df that has a “Cluster” (or cluster_col) + “Term”/”p.adjust”

It shows: - Which enriched terms (padj < cutoff) are shared between different clusters/contrasts. - Set sizes (number of significant terms per cluster). - Intersection sizes (classic UpSet matrix + bars).

This is especially powerful when you used extract_gene_lists(…, separate_directions=True) so that “up” and “down” from different contrasts appear as separate sets.

If no ‘Cluster’ column is present, the whole table is treated as a single set (degrades gracefully to a simple bar of top terms).

Parameters:
  • cluster_col (str or None) – Column that defines the groups. Auto-detected if None.

  • pval_cutoff (float) – Only terms with p.adjust (or similar) < cutoff are considered “enriched” for this plot.

  • min_count (int) – Minimum gene count in the enrichment row to include the term.

  • max_terms (int) – Cap on total unique terms considered (keeps plot readable).

  • title (str)

  • figsize (tuple[float, float])

  • dpi (int)

  • fontsize (int)

  • save_path (str | None)

  • show (bool)

  • use_style (bool)