View source: R/geneSetAnalysis.R
GOHyperGAll | R Documentation |
To test a sample population of genes for over-representation of GO terms, the
core function GOHyperGAll
computes for all nodes in the three GO networks
(BP, CC and MF) an enrichment test based on the hypergeometric distribution and
returns the corresponding raw and Bonferroni corrected p-values.
Subsequently, a filter function supports GO Slim analyses using default or
custom GO Slim categories. Several convenience functions are provided to process
large numbers of gene sets (e.g. clusters from partitioning results) and to
visualize the results.
Note: GOHyperGAll
provides similar utilities as the GOHyperG
function in the GOstats
package. The main difference is that
GOHyperGAll
simplifies processing of large numbers of gene sets, as well
as the usage of custom array-to-gene and gene-to-GO mappings.
## Generate gene-to-GO mappings and store as catDB object
makeCATdb(myfile, lib = NULL, org = "", colno = c(1, 2, 3), idconv = NULL,
rootUK=FALSE)
## Enrichment function
GOHyperGAll(catdb, gocat = "MF", sample, Nannot = 2)
## GO slim analysis
GOHyperGAll_Subset(catdb, GOHyperGAll_result, sample = test_sample,
type = "goSlim", myslimv)
## Reduce GO term redundancy
GOHyperGAll_Simplify(GOHyperGAll_result, gocat = "MF", cutoff = 0.001, correct = TRUE)
## Batch analysis of many gene sets
GOCluster_Report(catdb, setlist, id_type = "affy", method = "all", CLSZ = 10,
cutoff = 0.001, gocats = c("MF", "BP", "CC"), myslimv = "default",
correct = TRUE, recordSpecGO = NULL, ...)
## Bar plot of GOCluster_Report results
goBarplot(GOBatchResult, gocat)
myfile |
File with gene-to-GO mappings. Sample files can be downloaded from geneontology.org (http://geneontology.org/GO.downloads.annotations.shtml) or from BioMart as shown in example below. |
colno |
Column numbers referencing in |
org |
Optional argument. Currently, the only valid option is |
lib |
If the gene-to-GO mappings are obtained from a |
idconv |
Optional id conversion |
catdb |
|
rootUK |
If the argument |
sample |
|
Nannot |
Defines the minimum number of direct annotations per GO node from the sample set to determine the number of tested hypotheses for the p-value adjustment. |
gocat |
Specifies the GO type, can be assigned one of the following character values: "MF", "BP" and "CC". |
GOHyperGAll_result |
|
type |
The function |
myslimv |
optional argument to provide custom |
cutoff |
p-value cutoff for GO terms to show in result |
correct |
If |
setlist |
|
id_type |
specifies type of IDs in input, can be assigned |
method |
Specifies analysis type. Current options are |
CLSZ |
minimum gene set (cluster) size to consider. Gene sets below this cutoff will be ignored. |
gocats |
Specifies GO type, can be assigned the values "MF", "BP" and "CC". |
recordSpecGO |
argument to report in the result |
GOBatchResult |
|
... |
additional arguments to pass on |
GOHyperGAll_Simplify
: The result data frame from GOHyperGAll
will often contain several connected GO terms with significant scores which
can complicate the interpretation of large sample sets. To reduce this redundancy,
the function GOHyperGAll_Simplify
subsets the data frame
by a user specified p-value cutoff and removes from it all GO nodes with
overlapping children sets (OFFSPRING), while the best scoring nodes are
retained in the result data.frame
.
GOCluster_Report
: performs the three types of GO term enrichment
analyses in batch mode: GOHyperGAll
, GOHyperGAll_Subset
or
GOHyperGAll_Simplify
. It processes many gene sets (e.g. gene expression
clusters) and returns the results conveniently organized in a single result data frame.
makeCATdb
generates catDB
object from file.
Thomas Girke
This workflow has been published in Plant Physiol (2008) 147, 41-57.
GOHyperGAll_Subset
, GOHyperGAll_Simplify
, GOCluster_Report
, goBarplot
## Not run:
## Obtain annotations from BioMart
listMarts() # To choose BioMart database
m <- useMart("ENSEMBL_MART_PLANT"); listDatasets(m)
m <- useMart("ENSEMBL_MART_PLANT", dataset="athaliana_eg_gene")
listAttributes(m) # Choose data types you want to download
go <- getBM(attributes=c("go_accession", "tair_locus",
"go_namespace_1003"), mart=m)
go <- go[go[,3]!="",]; go[,3] <- as.character(go[,3])
write.table(go, "GOannotationsBiomart_mod.txt", quote=FALSE,
row.names=FALSE, col.names=FALSE, sep="\t")
## Create catDB instance (takes a while but needs to be done only once)
catdb <- makeCATdb(myfile="GOannotationsBiomart_mod.txt", lib=NULL, org="",
colno=c(1,2,3), idconv=NULL)
catdb
## Create catDB from Bioconductor annotation package
# catdb <- makeCATdb(myfile=NULL, lib="ath1121501.db", org="",
colno=c(1,2,3), idconv=NULL)
## AffyID-to-GeneID mappings when working with AffyIDs
# affy2locusDF <- systemPipeR:::.AffyID2GeneID(map = "ftp://ftp.arabidopsis.org/home/tair/Microarrays/Affymetrix/affy_ATH1_array_elements-2010-12-20.txt",
download=TRUE)
# catdb_conv <- makeCATdb(myfile="GOannotationsBiomart_mod.txt", lib=NULL, org="",
colno=c(1,2,3), idconv=list(affy=affy2locusDF))
# systemPipeR:::.AffyID2GeneID(catdb=catdb_conv,
affyIDs=c("244901_at", "244902_at"))
## Next time catDB can be loaded from file
save(catdb, file="catdb.RData")
load("catdb.RData")
## Perform enrichment test on single gene set
test_sample <- unique(as.character(catmap(catdb)$D_MF[1:100,"GeneID"]))
GOHyperGAll(catdb=catdb, gocat="MF", sample=test_sample, Nannot=2)[1:20,]
## GO Slim analysis by subsetting results accordingly
GOHyperGAll_result <- GOHyperGAll(catdb=catdb, gocat="MF", sample=test_sample, Nannot=2)
GOHyperGAll_Subset(catdb, GOHyperGAll_result, sample=test_sample, type="goSlim")
## Reduce GO term redundancy in 'GOHyperGAll_results'
simplifyDF <- GOHyperGAll_Simplify(GOHyperGAll_result, gocat="MF",
cutoff=0.001, correct=T)
# Returns the redundancy reduced data set.
data.frame(GOHyperGAll_result[GOHyperGAll_result[,1]
## Batch Analysis of Gene Clusters
testlist <- list(Set1=test_sample)
GOBatchResult <- GOCluster_Report(catdb=catdb, setlist=testlist, method="all",
id_type="gene", CLSZ=10, cutoff=0.001,
gocats=c("MF", "BP", "CC"),
recordSpecGO=c("GO:0003674", "GO:0008150", "GO:0005575"))
## Plot 'GOBatchResult' as bar plot
goBarplot(GOBatchResult, gocat="MF")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.