# Get GO terms of interest
library(GOstats); library(annotate)
GO.vec <- c("GO:0001775","GO:0007275")
g <- GOGraph(GO.vec, GOBPPARENTS)
g <- removeNode("all",g)
GOids <- names(nodes(g))
# Get p-values for all GO terms of interest
# (here, simulated for demonstration)
# Make sure names are GO term IDs
set.seed(1)
rawp <- rbeta(length(GOids), .2, 1)
names(rawp) <- GOids
# P-value adjustment using Short Focus Level
padj <- p.adjust.SFL(rawp, ontology='BP')
head(padj)
# These are in the same order as rawp, with
# names corresponding to GO terms.
# Calling GO terms significant when padj is
# less than alpha controls the FWER at alpha,
# within the context of the GO graph.
# See package vignette for larger examples with discussion:
# vignette("mvGST")
Run the code above in your browser using DataLab