Skip to contents

Returns a two-column data.frame suitable for clusterProfiler::enricher(TERM2GENE = ...) or similar enrichment tools.

Requires an organism mapping attached via attach_org(). The returned table is restricted to GO terms present in the current GO or GOSubgraph object.

Optional size filtering can be applied to restrict the number of genes per GO term, similar to the minGSSize and maxGSSize arguments used by clusterProfiler.

Usage

as_term2gene(go, minGSSize = 10L, maxGSSize = 500L)

Arguments

go

A GO or GOSubgraph object with an attached organism mapping.

minGSSize

Minimum number of genes per GO term.

maxGSSize

Maximum number of genes per GO term.

Value

A data.frame with columns term and gene.

Examples

data("go_cc_ecoli", package = "GOcontext")

# Export GO mappings as TERM2GENE
term2gene <- as_term2gene(go_cc_ecoli)
head(term2gene)
#>         term   gene
#> 1 GO:0000345 946839
#> 2 GO:0000345 947050
#> 3 GO:0000345 947210
#> 4 GO:0000345 947567
#> 5 GO:0000345 947714
#> 6 GO:0000345 947794

# Apply size filtering similar to clusterProfiler
term2gene_filtered <- as_term2gene(
    go = go_cc_ecoli,
    minGSSize = 5,
    maxGSSize = 100
)
head(term2gene_filtered)
#>         term   gene
#> 1 GO:0000345 946839
#> 2 GO:0000345 947050
#> 3 GO:0000345 947210
#> 4 GO:0000345 947567
#> 5 GO:0000345 947714
#> 6 GO:0000345 947794