appendGSTerms {HTSanalyzeR} | R Documentation

## Append gene set terms to GSCA results

### Description

This is a generic function.

When implemented as the S4 method for objects of class `GSCA`, this function finds corresponding annotation terms for KEGG and GO gene sets and inserts a column named "Gene.Set.Term" to each data frame in the GSCA results.

To use this function for objects of class `GSCA`:

appendGSTerms(object, keggGSCs=NULL, goGSCs=NULL)

### Usage

    appendGSTerms(object, ...)

### Arguments

`object` | an object. When this function is implemented as the S4 method of class 'GSCA', this argument is an object of class 'GSCA'.
`...` | other arguments depending on class (see below for the arguments supported by the method of class 'GSCA')

keggGSCs:

  a character vector of names of all KEGG gene set collections

goGSCs:

  a character vector of names of all GO gene set collections

### Details

This function makes the GSCA results more readable by appending a column of terms for KEGG and GO gene sets. To do this, the user needs to specify the names of the gene set collections based on KEGG and GO, respectively.

For each KEGG gene set, the species code in the KEGG id will be trimmed off, and then mapped to its corresponding annotation term using the function `mget` of the package `AnnotationDbi`.

For each GO gene set, the GO id will be mapped to corresponding GO term by the function `Term` of the package `GO.db`.

### Value

In the end, this function will return an updated object of class `GSCA`.

### Author(s)

Xin Wang xw264@cam.ac.uk

### Examples

    ## Not run:
    library(org.Dm.eg.db)
    library(KEGG.db)
    ##load data for enrichment analyses
    data("KcViab_Data4Enrich")
    ##select hits
    hits <- names(KcViab_Data4Enrich)[which(abs(KcViab_Data4Enrich) > 2)]
    ##set up a list of gene set collections
    PW_KEGG <- KeggGeneSets(species = "Dm")
    gscList <- list(PW_KEGG = PW_KEGG)
    ##create an object of class 'GSCA'
    gsca <- new("GSCA", listOfGeneSetCollections=gscList,
    geneList = KcViab_Data4Enrich, hits = hits)
    ##print gsca
    gsca
    ##do preprocessing (KcViab_Data4Enrich has already been preprocessed)
    gsca <- preprocess(gsca, species="Dm", initialIDs = "Entrez.gene",
    keepMultipleMappings = TRUE, duplicateRemoverMethod = "max",
    orderAbsValue = FALSE)
    ##print gsca again
    gsca
    ##do hypergeometric tests and GSEA
    gsca <- analyze(gsca, para = list(pValueCutoff = 0.05, pAdjustMethod
    = "BH", nPermutations = 1000, minGeneSetSize = 100,exponent = 1))
    ##append Kegg and GO gene set terms
    gsca<-appendGSTerms(gsca, keggGSCs="PW_KEGG")

    ## End(Not run)

[Package HTSanalyzeR version 2.32.0 Index]