Skip to content

Suggestion: Include an example to extract gene combinations from UpSetR output #1251

@EveliaCoss

Description

@EveliaCoss

Hi! First of all, thank you for the great work on the package <3. I'm currently using it for a gene expression analysis comparing experimental groups, and I encountered a recurring need: extracting the specific gene lists that correspond to each combination shown in the UpSet plot.

I’d like to propose adding the following example to the documentation (book or vignette) under the UpSetR section, as it could benefit researchers working with biological datasets—particularly those dealing with transcriptomics or pathway analysis.

# Obtain set names
set_names <- set_name(m1)

# Get binary names of combinations
comb_bin <- comb_name(m1)

# Create list with subsets by combination
comb_sets <- lapply(comb_name(m1), function(nm) extract_comb(m1, nm))

# Generate readable names for combinations
comb_labels <- sapply(comb_bin, function(bin) {
  active <- as.logical(as.integer(strsplit(bin, "")[[1]]))
  paste(set_names[active], collapse = ",")
})

# Assign these names to the list
names(comb_sets) <- comb_labels

str(comb_sets) # list 15

This approach provides a modular and interpretable way to bridge the visual output of the plot with downstream analyses like enrichment testing (e.g., GO or KEGG). It's especially useful when prioritizing subsets based on their biological relevance or visual prominence in the plot.

Thanks for considering this addition—and again, congrats on the great tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions