GOHyperGAll {systemPipeR} | R Documentation

## GO term enrichment analysis for large numbers of gene sets

### Description

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.

### Usage

    ## 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)

### Arguments

`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 `myfile` the three target columns containing GOID, GeneID and GOCAT, in that order.
`org` | Optional argument. Currently, the only valid option is `org="Arabidopsis"` to get rid of transcript duplications in this particular annotation.
`lib` | If the gene-to-GO mappings are obtained from a `*.db` package from Bioconductor then the package name can be specified under the `lib` argument of the `sampleDFgene2GO` function.
`idconv` | Optional id conversion `data.frame`
`catdb` | `catdb` object storing mappings of genes to annotation categories. For details, see ?"SYSargs-class".
`rootUK` | If the argument `rootUK` is set to `TRUE` then the root nodes are treated as terminal nodes to account for the new unknown terms.
`sample` | `character vector` containing the test set of gene identifiers
`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` | `data.frame` generated by `GOHyperGAll`
`type` | The function `GOHyperGAll_Subset` subsets the `GOHyperGAll` results by directly assigned GO nodes or custom `goSlim` categories. The argument `type` can be assigned the values `goSlim` or `assigned`.
`myslimv` | optional argument to provide custom `goSlim` vector
`cutoff` | p-value cutoff for GO terms to show in result `data.frame`
`correct` | If `TRUE` the function will favor the selection of terminal (informationich) GO terms that have at the same time a large number of sample matches.
`setlist` | `list` of `character vectors` containing gene IDs (or array feature IDs). The names of the `list` components correspond to the set labels, e.g. DEG comparisons or cluster IDs.
`id_type` | specifies type of IDs in input, can be assigned `gene` or `affy`
`method` | Specifies analysis type. Current options are `all` for `GOHyperGAll`, `slim` for `GOHyperGAll_Subset` or `simplify` for `GOHyperGAll_Simplify`.
`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 `data.frame` specific GO IDs for any of the 3 ontologies disregarding whether they meet the specified p-value `cutoff`, e.g: `recordSpecGO=c("GO:0003674", "GO:0008150", "GO:0005575")`
`GOBatchResult` | `data.frame` generated by `GOCluster_Report`
`...` | additional arguments to pass on

### Details

`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.

### Value

`makeCATdb` generates `catDB` object from file.

### Author(s)

Thomas Girke

### References

This workflow has been published in Plant Physiol (2008) 147, 41-57.

### See Also

`GOHyperGAll_Subset`, `GOHyperGAll_Simplify`, `GOCluster_Report`, `goBarplot`

### Examples

    ## 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)

[Package systemPipeR version 1.21.6 Index]