## load the dataset
data(geneList)
library(package = affyLib, character.only = TRUE)
## the distribution of the adjusted p-values
hist(geneList, 100)
## how many differentially expressed genes are:
sum(topDiffGenes(geneList))
## build the topGOdata class
GOdata <- new("topGOdata",
ontology = "BP",
allGenes = geneList,
geneSel = topDiffGenes,
description = "GO analysis of ALL data: Differential Expression between B-cell and T-cell",
annot = annFUN.db,
affyLib = affyLib)
## display the GOdata object
GOdata
##########################################################
## Examples on how to use the methods
##########################################################
## description of the experiment
description(GOdata)
## obtain the genes that will be used in the analysis
a <- genes(GOdata)
str(a)
numGenes(GOdata)
## obtain the score (p-value) of the genes
selGenes <- names(geneList)[sample(1:length(geneList), 10)]
gs <- geneScore(GOdata, whichGenes = selGenes)
print(gs)
## if we want an unnamed vector containing all the feasible genes
gs <- geneScore(GOdata, use.names = FALSE)
str(gs)
## the list of significant genes
sg <- sigGenes(GOdata)
str(sg)
numSigGenes(GOdata)
## to update the gene list
.geneList <- geneScore(GOdata, use.names = TRUE)
GOdata ## more available genes
GOdata <- updateGenes(GOdata, .geneList, topDiffGenes)
GOdata ## the available genes are now the feasible genes
## the available GO terms (all the nodes in the graph)
go <- usedGO(GOdata)
length(go)
## to list the genes annotated to a set of specified GO terms
sel.terms <- sample(go, 10)
ann.genes <- genesInTerm(GOdata, sel.terms)
str(ann.genes)
## the score for these genes
ann.score <- scoresInTerm(GOdata, sel.terms)
str(ann.score)
## to see the number of annotated genes
num.ann.genes <- countGenesInTerm(GOdata)
str(num.ann.genes)
## to summarise the statistics
termStat(GOdata, sel.terms)
Run the code above in your browser using DataLab