This function creates an UpSet plot using the ComplexHeatmap package to
visualize intersections across multiple sets.
Supports both GenomicOverlapResult and SetOverlapResult objects.
Arguments
- overlap_object
A
GenomicOverlapResultorSetOverlapResultobject returned bycomputeOverlaps.- customSetOrder
Optional. A vector specifying the order of sets to display on the UpSet diagram. The vector should contain either numeric indices (corresponding to the sets in the overlap object) or character names (matching the set names). If
NULL(default), sets are displayed in decreasing order of their size (set_size()).- comb_col
Optional. Color(s) for the combination matrix dots and connecting lines. Can be a single color or a vector of colors (recycled to match the number of intersections). Default is "black".
Value
An UpSet plot object generated by ComplexHeatmap::UpSet. The
right-hand annotation bars are labeled "Region size" for a
GenomicOverlapResult input (the number of reduced or disjoint regions
per set, not the number of original input peaks) and "Set size" for a
SetOverlapResult input (no such transformation applies to gene/identifier
sets).
Examples
# Example with gene sets (built-in dataset)
data(gene_list)
res_sets <- computeOverlaps(gene_list)
# Default order (sets sorted by size)
plotUpSet(res_sets)
# Custom color
plotUpSet(res_sets, comb_col = "darkblue")
# Custom order by names
plotUpSet(res_sets, customSetOrder = c("random_genes_C",
"random_genes_A",
"random_genes_B"))
# Example with genomic regions (built-in dataset)
data(a549_chipseq_peaks)
res_genomic <- computeOverlaps(a549_chipseq_peaks)
plotUpSet(res_genomic)