snapatac2.pl.motif_enrichment#
- snapatac2.pl.motif_enrichment(enrichment, min_log_fc=1, max_fdr=0.01, **kwargs)[source]#
Plot motif enrichment scores across groups.
Use this function to summarize motif enrichment tables returned for multiple groups as a clustered heatmap.
Anti-Patterns#
Do NOT pass a single enrichment table. Pass a mapping from group names to Polars DataFrames with matching motif rows.
Do NOT rename required columns. Each table must contain
id,log2(fold change),adjusted p-value, andp-value.
- type enrichment:
dict of (str, polars.DataFrame)
- param enrichment:
Mapping from group names to motif enrichment result tables. Tables must have aligned rows and include required motif statistics columns.
- type enrichment:
dict of (str, polars.DataFrame)
- type min_log_fc:
float
- param min_log_fc:
Keep motifs with at least one absolute log2 fold-change greater than or equal to this value.
- type min_log_fc:
float
- type max_fdr:
float
- param max_fdr:
Keep motifs with at least one adjusted p-value less than or equal to this value.
- type max_fdr:
float
- type **kwargs:
- param **kwargs:
Additional rendering options passed to
snapatac2.pl.heatmapandsnapatac2.pl.render_plot, such asshow,interactive,out_file, and clustering options accepted byheatmap.- returns:
Returns a Plotly figure when
show=Falseandout_file=None; otherwise renders or saves the plot and returnsNone.- rtype:
plotly.graph_objects.Figure or None
Examples
>>> import polars as pl >>> import snapatac2 as snap >>> table = pl.DataFrame({ ... "id": ["MA0001.1", "MA0002.1"], ... "log2(fold change)": [1.5, -0.8], ... "adjusted p-value": [0.001, 0.2], ... "p-value": [1e-5, 0.05], ... }) >>> enrichment = {"cluster_1": table, "cluster_2": table} >>> fig = snap.pl.motif_enrichment(enrichment, show=False) >>> fig.update_layout(title="Motif enrichment")