gson_union: Combine gene set collections

View source: R/union.R

gson_unionR Documentation

Combine gene set collections

Description

gson_union() merges GSON objects into one collection. Two objects are the same source when they declare the same gsname, and – once every object declares one – the same gsidtype; the gene sets of one source are joined by ID, so a gene set that appears in two files of one collection becomes one set holding every gene either file gives it. A gene set ID that two objects from different sources both use is a conflict, because the merged membership table would say that one ID names two sets of genes, and .conflict decides what happens: "error" refuses, "prefix" qualifies every gene set ID with the source it comes from (KEGG:hsa00010), and "rename" qualifies only the IDs that actually collide, leaving the rest of the collection alone. Where two objects name the same gene set or the same gene differently, the first object that says something wins.

Usage

gson_union(x = NULL, y = NULL, ..., .conflict = c("error", "prefix", "rename"))

Arguments

x, y

A GSON or GSONList object. Either may be omitted.

...

More GSON or GSONList objects.

.conflict

What to do about a gene set ID used by two different sources: "error", "prefix" or "rename".

Details

The metadata is merged by what the merged object can still honestly say: species, keytype and schema_version have to agree or the call is an error, because a membership table holds genes of one organism identified by one identifier type, while gsname, gsidtype, version, accessed_date and info are joined with " + " when the sources name themselves differently. urlpattern is kept only when every object declares the same one and no gene set ID was renamed – a pattern that resolves to a wrong page for part of the collection is worse than no pattern, and gson_url() says so.

Value

A GSON object holding every gene set of every input.

Examples

wpfile <- system.file('extdata', "wikipathways-20220310-gmt-Homo_sapiens.gmt", package='gson')
wp <- read.gmt.wp(wpfile, output = "GSON")
gson_union(wp[1:2], wp[3:4])

gson documentation built on Oct. 9, 2026, 5:09 p.m.