appendGSTermsTS: Append gene set terms to GSCA results for each GSCA object of...

Description Usage Arguments Value See Also Examples

View source: R/gscaTS.R

Description

For each GSCA object in 'gscaList', this function finds corresponding annotation terms for GO, KEGG and MSigDB gene sets and inserts a column named "Gene.Set.Term" to each data frame in the GSCA results. In the same time, to make results more understandable, it will annotate the gene list with EntrezID to gene symbol under specific species.

Usage

1
2
3
4
5
6
7
appendGSTermsTS(
  gscaList,
  keggGSCs = NULL,
  goGSCs = NULL,
  msigdbGSCs = NULL,
  species = "Hs"
)

Arguments

gscaList

A named list of GSCA object.

keggGSCs

A character vector of names of all KEGG gene set collections.

goGSCs

A character vector of names of all GO gene set collections.

msigdbGSCs

A character vector of names of all MSigDB gene set collections.

species

A single character value specifying the species of the analyzed data. It supports all the species of OrgDb objects in AnnotationDbi. The format should be an abbreviation of the organism as setted by AnnotationDbi. For example, the commonly used ones are "Dm" ("Drosophila_melanogaster"), "Hs" ("Homo_sapiens"), "Rn" ("Rattus_norvegicus"), "Mm" ("Mus_musculus"), "Ce" ("Caenorhabditis_elegans"), and etc.

Value

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

See Also

appendGSTerms

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
data(d7, d13, d25)

## generate expInfor to describe the information of time series data
expInfor <- matrix(c("d7", "d13", "d25"), nrow = 3, ncol = 2,
                   byrow = FALSE, dimnames = list(NULL, c("ID", "Description")))

## package phenotypeTS into a list of phenotypes
datalist <- list(d7, d13, d25)
phenotypeTS <- lapply(datalist, function(x) {
                      tmp <- as.vector(x$neg.lfc)
                      names(tmp) <- x$id
                      tmp})

## set up a list of gene set collections
library(org.Hs.eg.db)
library(GO.db)
GO_BP <- GOGeneSets(species="Hs", ontologies=c("BP"))
ListGSC <- list(GO_BP=GO_BP)

## package hitsTS if you also want to do GSOA, otherwise ignore it
hitsTS <- lapply(datalist, function(x){
tmp <- x[x$neg.p.value < 0.01, "id"]
tmp})

## create an object of class GSCABatch with hitsTS
gscaTS <- GSCABatch(expInfor = expInfor, phenotypeTS = phenotypeTS,
                 listOfGeneSetCollections = ListGSC, hitsTS = hitsTS)

## preprocess GSCABatch
gscaTS1 <- preprocessGscaTS(gscaTS, species="Hs", initialIDs="SYMBOL",
                           keepMultipleMappings=TRUE, duplicateRemoverMethod="max",
                           orderAbsValue=FALSE)

## support parallel calculation using doParallel package
if (requireNamespace("doParallel", quietly=TRUE)) {
doParallel::registerDoParallel(cores=2)
} else {
}

## Not run: 
## do hypergeometric tests and GSEA
gscaTS2 <- analyzeGscaTS(gscaTS1, para=list(pValueCutoff=0.05, pAdjustMethod="BH",
                        nPermutations=100, minGeneSetSize=100,
                        exponent=1), doGSOA = TRUE, doGSEA = TRUE)
head(getResult(gscaTS2[[1]])$GSEA.results$GO_BP, 3)

## append gene set terms to results

gscaTS3 <- appendGSTermsTS(gscaTS2, goGSCs=c("GO_BP"),
                           species = "Hs")
head(getResult(gscaTS3[[1]])$GSEA.results$GO_BP, 3)

## End(Not run)

CityUHK-CompBio/HTSanalyzeR2 documentation built on Dec. 3, 2020, 2:35 a.m.