_venn_plots
Venn and overlap-enrichment helpers from _plotting/_venn_plots.py.
Important package note: this module exists in _plotting/, but it is not currently re-exported by _plotting/__init__.py. Use a direct submodule import when needed.
from adata_science_tools._plotting._venn_plots import venn_plot_2list
Public functions
venn_plot_2listvenn_plot_3listgeneset_enrichment_venngeneset_enrichemnt_ol_ven_M_n_N_x
venn_plot_2list
Creates a two-set Venn diagram and optionally returns a summary DataFrame.
Full signature
def venn_plot_2list(list1, list2, set_label_list, plot_title,show_plot=True,return_df=True):
overlap_df = venn_plot_2list(
list1=genes_a,
list2=genes_b,
set_label_list=["A", "B"],
plot_title="Overlap of A and B",
show_plot=True,
return_df=True,
)
Important behavior:
Inputs are converted to Python sets before overlap calculation.
The returned
DataFramesummarizes unique and shared members as stringified lists.show_plot=Falsesuppresses the Matplotlib rendering.
venn_plot_3list
Creates a three-set Venn diagram and optionally returns an overlap summary DataFrame.
Full signature
def venn_plot_3list(list1, list2, list3, set_label_list, plot_title,show_plot=False,return_df=False):
Important behavior:
Inputs are converted to sets.
The returned
DataFramekeeps theElementscolumn as Python lists rather than strings.The default arguments are
show_plot=Falseandreturn_df=False.
geneset_enrichment_venn
Computes a hypergeometric enrichment p-value and displays a Venn diagram for:
Full signature
def geneset_enrichment_venn(universe, geneset, hits,
dataset_label="DEGs",
geneset_label="GeneSet",
plot_title="",
shift_overlap=True,
shift_overlap_labely=0.1):
universegenesethits
The function returns a dict with:
MnNxp_enrichmentoverlap
Important behavior:
All three inputs are intersected with the supplied universe.
The overlap label is rewritten to include the overlap count and enrichment p-value.
The function always shows the plot.
geneset_enrichemnt_ol_ven_M_n_N_x
This legacy helper also computes a hypergeometric enrichment display from three sets.
Full signature
def geneset_enrichemnt_ol_ven_M_n_N_x(
M_set, n_set, N_set,
dataset_label="dataset_label",
geneset_label="geneset_label",
plot_title="plot_title",
shift_overlap=True,
shift_overlap_labely=0.1
):
Important behavior:
The function name is misspelled in the source and docs to match the current API.
It prints the universe and overlap statistics.
It shows the plot.
The current implementation does not return a value.
Coverage note
This module is documented from source code rather than dedicated tests.