create_venn_diagram
Compare differential expression, methylation, or abundance data across 2–3 assays and create Venn diagrams showing shared and directional overlaps.
Instructions
Create Venn diagrams comparing differential data between 2 or 3 assays.
Supports multiple data types:
'expression': Compares differentially expressed genes (upregulated/downregulated by log2fc)
'methylation': Compares differentially methylated genes (hypermethylated/hypomethylated by methylation_diff)
'abundance': Compares differentially abundant organisms (increased/decreased by log2fc; works for both DESeq2 and ANCOM-BC)
'expression_methylation': Cross-comparison showing directional overlaps between differentially expressed genes from one assay and differentially methylated genes from another assay (2-way only)
Creates side-by-side Venn diagrams showing:
Left: Positive direction (upregulated / hypermethylated / increased abundance)
Right: Negative direction (downregulated / hypomethylated / decreased abundance)
For 'expression_methylation' mode, this tool computes FOUR directional overlaps so the user can see which kind of expression–methylation coupling is happening. By default (direction_pair='all') it renders all four as a 2x2 grid:
Hypermethylated + Downregulated (classical epigenetic silencing — promoter methylation reducing expression)
Hypomethylated + Upregulated (loss of methylation enabling expression)
Hypermethylated + Upregulated (less canonical; e.g. gene-body methylation activating expression)
Hypomethylated + Downregulated (less canonical; non-classical) If the user names a specific pairing (e.g. "create a Venn of hypermethylated and downregulated genes"), pass direction_pair='hyper_down' to render just that one. The summary always reports the size of all four overlaps, regardless of which subset is rendered.
Methylation region location filters (for data_type='methylation' and the methylation side of 'expression_methylation'):
in_promoter, in_exon, in_intron: each accepts True (include only regions where this flag is true), False (exclude regions where this flag is true), or None (no filter). Multiple filters combine with AND. For example, in_promoter=True alone restricts to promoter-overlapping regions; in_promoter=True with in_intron=False restricts to promoter regions that are NOT intronic.
dist_to_feature_max: when set, include only regions whose distance to the nearest gene feature is <= this value (in bp). Useful for narrowing to regions tightly associated with gene bodies. dist_to_feature on the MethylationRegion node is the bp distance from the region to the nearest annotated feature. These filters apply during the Cypher query — they reduce the set of methylation regions BEFORE the overlap computation, so each gene set is the genes that have at least one methylation region passing all the filters and the magnitude/significance criteria.
Significance filtering:
'expression' and 'expression_methylation' (expression side): adj_p_value <= adj_p_threshold (default 0.05).
'methylation' and 'expression_methylation' (methylation side): q_value <= q_value_threshold (default 0.05).
'abundance' is method-aware: DESeq2 rows are filtered by adj_p_threshold, ANCOM-BC rows by q_value_threshold.
Magnitude filtering for 'abundance':
log2fc_threshold applies to every row (log2fc is populated for both methods).
lnfc_threshold (optional) adds an ANCOM-BC-specific |lnfc| filter; DESeq2 rows (lnfc IS NULL) pass through.
Returns a link to the plot and summary statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| in_exon | No | MethylationRegion location filter (data_type='methylation' or 'expression_methylation' only). When True, only include methylation regions overlapping an exon. When False, exclude exon-overlapping regions. None (default) imposes no exon filter. Maps directly to the in_exon property on MethylationRegion nodes. | |
| data_type | No | Type of data to compare. Options: 'expression' (differentially expressed genes), 'methylation' (differentially methylated genes), 'abundance' (differentially abundant organisms), 'expression_methylation' (overlap between DE genes and DM genes across assays) | expression |
| in_intron | No | MethylationRegion location filter (data_type='methylation' or 'expression_methylation' only). When True, only include methylation regions overlapping an intron. When False, exclude intron-overlapping regions. None (default) imposes no intron filter. Maps directly to the in_intron property on MethylationRegion nodes. | |
| assay_id_1 | Yes | First assay identifier | |
| assay_id_2 | Yes | Second assay identifier | |
| assay_id_3 | No | Third assay identifier (optional, for 3-way Venn diagram) | |
| session_id | No | Session id returned by `create_session()`. This server serves many users from one process; the session id is what keeps your output directory and generated plots private to you. Pass the SAME value on every tool call. If the server replies that the session is unknown or expired, call `create_session()` again and use the new id. | |
| in_promoter | No | MethylationRegion location filter (data_type='methylation' or 'expression_methylation' only). When True, only include methylation regions overlapping a gene promoter. When False, exclude promoter-overlapping regions. None (default) imposes no promoter filter. Maps directly to the in_promoter property on MethylationRegion nodes. | |
| figsize_width | No | Figure width in inches | |
| direction_pair | No | For data_type='expression_methylation' only: which directional overlap(s) to render. 'all' (default) renders a 2x2 grid of all four biologically meaningful combinations: hypermethylated+downregulated (classical epigenetic silencing), hypomethylated+upregulated (loss of methylation enabling expression), hypermethylated+upregulated, and hypomethylated+downregulated. Specify one of 'hyper_down', 'hypo_up', 'hyper_up', 'hypo_down' to render only that single overlap. Ignored for non-expression_methylation data types. | all |
| figsize_height | No | Figure height in inches | |
| lnfc_threshold | No | Optional minimum |lnfc| magnitude for the 'abundance' data type. Only applied to rows with lnfc populated (ANCOM-BC). DESeq2 rows are not filtered by this parameter. Ignored for non-abundance data types. Leave unset (None) to skip lnfc filtering. | |
| adj_p_threshold | No | Adjusted p-value threshold (default: 0.05). Applied to expression assays and to DESeq2 abundance rows. | |
| log2fc_threshold | No | Log2 fold change threshold for filtering genes (used for expression and abundance data types) | |
| q_value_threshold | No | q-value threshold (default: 0.05). Applied to methylation assays and to ANCOM-BC abundance rows. | |
| dist_to_feature_max | No | MethylationRegion distance filter (data_type='methylation' or 'expression_methylation' only). When set, only include methylation regions whose dist_to_feature (distance in bp to the nearest gene feature) is <= this value. Useful for restricting to regions close to gene bodies. None (default) imposes no distance filter. | |
| methylation_diff_threshold | No | Methylation difference threshold for filtering regions (used for methylation data type, default 0.0 means any change) |