bioconductor v3.9.0 TopGO

topGO package provides tools for testing GO terms while

Link to this section Summary

Functions

Gene set tests statistics

Sample topGOdata and topGOresult objects

Functions which map gene identifiers to GO terms

Class "classicCount"

Class "classicExpr"

Class "classicScore"

Utility functions to work with Directed Acyclic Graphs (DAG)

Diagnostic functions for topGOdata and topGOresult objects.

Classes "elimCount" and "weight01Count"

Class "elimExpr"

Classes "elimScore" and "weight01Score"

A toy example of a list of gene identifiers and the respective p-values

Convenient function to compute p-values from a gene expression matrix.

Interfaces for running the enrichment tests

Grouping of GO terms into the three ontologies

Class "groupStats"

The subgraph induced by a set of nodes.

Classes "parentChild" and "pC"

Visualisation functions

Enrichment analysis for Gene Ontology

Class "topGOdata"

Class "topGOresult"

Class "weightCount"

Link to this section Functions

Gene set tests statistics

Description

Methods which implement and run a group test statistic for a class inheriting from groupStats class. See Details section for a description of each method.

Usage

GOFisherTest(object)
GOKSTest(object)
GOtTest(object)
GOglobalTest(object)
GOSumTest(object)
GOKSTiesTest(object)

Arguments

ArgumentDescription
objectAn object of class groupStats or decedent class.

Details

GOFisherTest: implements Fischer's exact test (based on contingency table) for groupStats objects dealing with "counts".

GOKSTest: implements the Kolmogorov-Smirnov test for groupStats objects dealing with gene "scores". This test uses the ks.test function and does not implement the running-sum-statistic test based on permutations.

GOtTest: implements the t-test for groupStats objects dealing with gene "scores". It should be used when the gene scores are t-statistics or any other score following a normal distribution.

GOglobalTest: implement Goeman's globaltest.

Value

All these methods return the p-value computed by the respective test statistic.

Seealso

groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Sample topGOdata and topGOresult objects

Description

The GOdata contains an instance of a topGOdata object. It can be used to run an enrichment analysis directly.

The resultFisher contains the results of an enrichment analysis.

Usage

data(GOdata)

Examples

data(GOdata)

## print the object
GOdata

data(results.tGO)

## print the object
resultFisher

Functions which map gene identifiers to GO terms

Description

These functions are used to compile a list of GO terms such that each element in the list is a character vector containing all the gene identifiers that are mapped to the respective GO term.

Usage

annFUN.db(whichOnto, feasibleGenes = NULL, affyLib)
annFUN.org(whichOnto, feasibleGenes = NULL, mapping, ID = "entrez") 
annFUN(whichOnto, feasibleGenes = NULL, affyLib)
annFUN.gene2GO(whichOnto, feasibleGenes = NULL, gene2GO)
annFUN.GO2genes(whichOnto, feasibleGenes = NULL, GO2genes)
annFUN.file(whichOnto, feasibleGenes = NULL, file, ...)
readMappings(file, sep = "  ", IDsep = ",")
inverseList(l)

Arguments

ArgumentDescription
whichOntocharacter string specifying one of the three GO ontologies, namely: "BP" , "MF" , "CC"
feasibleGenescharacter vector containing a subset of gene identifiers. Only these genes will be used to annotate GO terms. Default value is NULL which means that there are no genes filtered.
affyLibcharacter string containing the name of the Bioconductor annotaion package for a specific microarray chip.
gene2GOnamed list of character vectors. The list names are genes identifiers. For each gene the character vector contains the GO identifiers it maps to. Only the most specific annotations are required.
GO2genesnamed list of character vectors. The list names are GO identifiers. For each GO the character vector contains the genes identifiers which are mapped to it. Only the most specific annotations are required.
mappingcharacter string specifieng the name of the Bioconductor package containing the gene mappings for a specific organism. For example: mapping = "org.Hs.eg.db" .
IDcharacter string specifing the gene identifier to use. Currently only the following identifiers can be used: c("entrez", "genbank", "alias", "ensembl", "symbol",
filecharacter string specifing the file containing the annotations.
...other parameters
septhe character used to separate the columns in the CSV file
IDsepthe character used to separate the annotated entities
la list containing mappings

Details

All these function restrict the GO terms to the ones belonging to the specified ontology and to the genes listed in the feasibleGenes attribute (if not empty).

The function annFUN.db uses the mappings provided in the Bioconductor annotation data packages. For example, if the Affymetrix hgu133a chip it is used, then the user should set affyLib = "hgu133a.db" .

The functions annFUN.gene2GO and annFUN.GO2genes are used when the user provide his own annotations either as a gene-to-GOs mapping, either as a GO-to-genes mapping.

The annFUN.org function is using the mappings from the "org.XX.XX" annotation packages. The function supports different gene identifiers.

The annFUN.file function will read the annotationsof the type gene2GO or GO2genes from a text file.

Value

A named(GO identifiers) list of character vectors.

Seealso

topGOdata-class

Author

Adrian Alexa

Examples

library(hgu133a.db)
set.seed(111)

## generate a gene list and the GO annotations
selGenes <- sample(ls(hgu133aGO), 50)
gene2GO <- lapply(mget(selGenes, envir = hgu133aGO), names)
gene2GO[sapply(gene2GO, is.null)] <- NA

## the annotation for the first three genes
gene2GO[1:3]

## inverting the annotations
G2g <- inverseList(gene2GO)

## inverting the annotations and selecting an ontology
go2genes <- annFUN.gene2GO(whichOnto = "CC", gene2GO = gene2GO)


## generate a GO list with the genes annotations
selGO <- sample(ls(hgu133aGO2PROBE), 30)
GO2gene <- lapply(mget(selGO, envir = hgu133aGO2PROBE), as.character)

GO2gene[1:3]

## select only the GO terms for a specific ontology
go2gene <- annFUN.GO2genes(whichOnto = "CC", GO2gene = GO2gene)


##################################################
## Using the org.XX.xx.db annotations
##################################################

## GO to Symbol mappings (only the BP ontology is used)
xx <- annFUN.org("BP", mapping = "org.Hs.eg.db", ID = "symbol")
head(xx)

allGenes <- unique(unlist(xx))
myInterestedGenes <- sample(allGenes, 500)
geneList <- factor(as.integer(allGenes%in% myInterestedGenes))
names(geneList) <- allGenes

GOdata <- new("topGOdata",
ontology = "BP",
allGenes = geneList,
nodeSize = 5,
annot = annFUN.org,
mapping = "org.Hs.eg.db",
ID = "symbol")
Link to this function

classicCount_class()

Class "classicCount"

Description

This class that extends the virtual class "groupStats" by adding a slot representing the significant members.

Details

This class is used for test statistic based on counts, like Fisher's exact test

Seealso

classicScore-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

##---- Should be DIRECTLY executable !! ----
Link to this function

classicExpr_class()

Class "classicExpr"

Description

This class that extends the virtual class "groupStats" by adding two slots for accomodating gene expression data.

Seealso

classicScore-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

showClass("classicExpr")
Link to this function

classicScore_class()

Class "classicScore"

Description

A class that extends the virtual class "groupStats" by adding a slot representing the score of each gene. It is used for tests like Kolmogorov-Smirnov test.

Seealso

classicCount-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

## define the type of test you want to use
test.stat <- new("classicScore", testStatistic = GOKSTest, name = "KS tests")

Utility functions to work with Directed Acyclic Graphs (DAG)

Description

Basic functions to work witg DAGs

Usage

buildLevels(dag, root = NULL, leafs2root = TRUE)
getNoOfLevels(graphLevels)
getGraphRoot(dag, leafs2root = TRUE)
reverseArch(dirGraph, useAlgo = "sparse", useWeights = TRUE)

Arguments

ArgumentDescription
dagA graphNEL object.
rootA character vector specifing the root(s) of the DAG. If not specified the root node is autmatically computed.
leafs2rootThe leafs2root parameter tell if the graph has edges directed from the leaves to the root, or vice-versa
graphLevelsAn object of type list, returned by the buildLevels function.
dirGraphA graphNEL object containing a directed graph.
useAlgoA character string specifing one of the following options c("sparse", "normal") . By default, useAlgo = "sparse" , a sparce matrix object is used to transpose the adjacency matrix. Otherwise a standard R martix is used.
useWeightsIf weights should be used (if useAlgo = then the weigths are used anyway)

Details

buildLevels function determines the levels of a Directed Acyclic Graph (DAG). The level of a node is defined as the longest path from the node to the root. The function take constructs a named list containg varios information about each nodes level. The root has level 1.

getNoOfLevels - a convenient function to extract the number of levels from the object returned by buildLevels

getGraphRoot finds the root(s) of the DAG

reverseArch - simple function to invert the direction of edges in a DAG. The returned graph is of class graphNEL. It can use either simple matrices or sparse matrices (SparseM library)

Value

buildLevels returns a list containing:

An object of class graphNEL-class is returned.

Seealso

topGOdata-class , inducedGraph

Author

Adrian Alexa

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--or do  help(data=index)  for the standard data sets.
Link to this function

diagnosticMethods()

Diagnostic functions for topGOdata and topGOresult objects.

Description

The GenTable function generates a summary of the results of the enrichment analysis.

The showGroupDensity function plots the distributions of the gene' scores/ranks inside a GO term.

The printGenes function shows a short summary of the top genes annotated to the specified GO terms.

Usage

GenTable(object, ...)
showGroupDensity(object, whichGO, ranks = FALSE, rm.one = TRUE) 
printGenes(object, whichTerms, file, ...)

Arguments

ArgumentDescription
objectan object of class topGOdata .
whichGOthe GO terms for which the plot should be generated.
ranksif ranks should be used instead of scores.
rm.onethe p-values which are 1 are removed.
whichTermscharacter vector listing the GO terms for which the summary should be printed.
filecharacter string specifying the file in which the results should be printed.

|list() | %%GenTable(object, ..., orderBy = 1, ranksOf = 2, topNodes = 10, numChar = 40) Extra arguments for GenTable can be: list(" ", " ", list(list(list()), list(" ", " one or more objects of class ", list("topGOresult"), ". ", " ")), " ", " ", list(list(list("orderBy")), list(" ", " if more than one ", list("topGOresult"), " object is given then ", " ", list("orderBy"), " gives the index of which scores will be ", " used to order the resulting table. Can be an integer index ", " or a character vector given the name of the ", list("topGOresult"), " ", " object. ", " ")), " ", " ", |

list(list(list("ranksOf")), list("

", " same as ", list("orderBy"), " argument except that this parameter shows ", " the relative ranks of the specified result. ", " ")), " ", " ", list(list(list("topNodes")), list(" ", " the number of top GO terms to be included in the table. ", " ")), " ", " ", list(list(list("numChar")), list(" ", " the GO term definition will be truncated such that only ", " the first ", list("numChar"), " characters are shown. ", " ")),

"

", " ") %% printGenes(object, whichTerms, chip, numChar = 100, simplify = TRUE, geneCufOff = 50, pvalCutOff) %% printGenes(object, whichTerms, file, oneFile = FALSE, ...) Extra arguments for printGenes can be: list(" ", " ", list(list(list("chip")), list(" ", " character string containing the name of the Bioconductor ", " annotation package for a microarray chip. ", " ")), " ", " ", list(list(list("numChar")), list(" ", " the gene description is trimmed such that it has ", " ", list("numChar"), " characters. ", " ")), " ", " ", list(list(list("simplify")), list(" ", " logical variable affecting how the results are returned. ", " ")), " ", " ", list(list(

list("geneCutOff")), list("

", " the maximal number of genes shown for each term. ", " ")), " ", " ", list(list(list("pvalCutOff")), list(" ", " only the genes with a p-value less than ", list("pvalCutOff"), " are shown. ", " ")), " ", " ", list(list(list("oneFile")), list(" ", " if ", list("TRUE"), " then a file for each GO term is generated. ", " ")), " ", " ")

Details

GenTable is an easy to use function for summarising the most significant GO terms and the corresponding p-values. The function dispatches for topGOdata and topGOresult objects, and it can take an arbitrary number of the later, making comparison between various results easier.

Note: One needs to type the complete attribute names (the exact name) of this function, like: topNodes = 5 , rankOf = "resultFis" , etc. This being the price paid for flexibility of specifying different number of topGOdata objects.

The showGroupDensity function analyse the distribution of the gene-wise scores for a specified GO term. The function will show the distribution of the genes in a GO term compared with the complementary set, using a lattice plot.

printGenes The function will generate a table with all the probes annotated to the specified GO term. Various type of identifiers, the gene name and the gene-wise statistics are provided in the table.

One or more GO identifiers can be given to the function using the whichTerms argument. When more than one GO is specified, the function returns a list of data.frames , otherwise only one data.frame is returned.

The function has a argument file which, when specified, will save the results into a file using the CSV format.

For the moment the function will work only when the chip used has an annotation package available in Bioconductor. It will not work with other type of custom annotations.

Value

A data.frame or a list of data.fames.

Seealso

groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

data(GOdata)


########################################
## GenTable
########################################

## load two topGOresult sample objects: resultFisher and resultKS
data(results.tGO)

## generate the result of Fisher's exact test
sig.tab <- GenTable(GOdata, Fis = resultFisher, topNodes = 20)

## results of both test
sig.tab <- GenTable(GOdata, resultFisher, resultKS, topNodes = 20)

## results of both test with specified names
sig.tab <- GenTable(GOdata, Fis = resultFisher, KS = resultKS, topNodes = 20)

## results of both test with specified names and specified ordering
sig.tab <- GenTable(GOdata, Fis = resultFisher, KS = resultKS, orderBy = "KS", ranksOf = "Fis", topNodes = 20)


########################################
## showGroupDensity
########################################

goID <- "GO:0006091"
print(showGroupDensity(GOdata, goID, ranks = TRUE))
print(showGroupDensity(GOdata, goID, ranks = FALSE, rm.one = FALSE))



########################################
## printGenes
########################################

library(hgu95av2.db)
goID <- "GO:0006629"

gt <- printGenes(GOdata, whichTerms = goID, chip = "hgu95av2.db", numChar = 40)

goIDs <- c("GO:0006629", "GO:0007076")
gt <- printGenes(GOdata, whichTerms = goIDs, chip = "hgu95av2.db", pvalCutOff = 0.01)

gt[goIDs[1]]
Link to this function

elimCount_class()

Classes "elimCount" and "weight01Count"

Description

Classes that extend the "classicCount" class by adding a slot representing the members that need to be removed.

Seealso

classicScore-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Link to this function

elimExpr_class()

Class "elimExpr"

Description

Classes that extend the "classicExpr" class by adding a slot representing the members that need to be removed.

Details

TODO: Some datails here.....

Seealso

classicScore-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

showClass("elimExpr")
Link to this function

elimScore_class()

Classes "elimScore" and "weight01Score"

Description

Classes that extend the "classicScore" class by adding a slot representing the members that need to be removed.

Details

TODO:

Seealso

classicScore-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

##---- Should be DIRECTLY executable !! ----

A toy example of a list of gene identifiers and the respective p-values

Description

The geneList data is compiled from a differential expression analysis of the ALL dataset. It contains just a small number of genes with the corespondent p-values. The information on where to find the GO annotations is stored in the ALL object.

The topDiffGenes function included in this dataset will select the differentially expressed genes, at 0.01 significance level, from geneList .

Usage

data(geneList)

Examples

data(geneList)

## print the object
head(geneList)
length(geneList)

## the number of genes with a p-value less than 0.01
sum(topDiffGenes(geneList))

Convenient function to compute p-values from a gene expression matrix.

Description

Warping function of "mt.teststat", for computing p-values of a gene expression matrix.

Usage

getPvalues(edata, classlabel, test = "t", alternative = c("greater", "two.sided", "less")[1],
   genesID = NULL, correction = c("none", "Bonferroni", "Holm", "Hochberg", "SidakSS", "SidakSD",
   "BH", "BY")[8])

Arguments

ArgumentDescription
edataGene expression matrix.
classlabelThe phenotype of the data
testWhich test statistic to use
alternativeThe alternative of the test statistic
genesIDif a subset of genes is provided
correctionMultiple testing correction procedure

Value

An named numeric vector of p-values.

Seealso

GOKSTest , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

library(ALL)
data(ALL)

## discriminate B-cell from T-cell
classLabel <- as.integer(sapply(ALL$BT, function(x) return(substr(x, 1, 1) == 'T')))

## Differentially expressed genes
geneList <- getPvalues(exprs(ALL), classlabel = classLabel,
alternative = "greater", correction = "BY")

hist(geneList, 50)

Interfaces for running the enrichment tests

Description

These function are used for dispatching the specific algorithm for a given topGOdata object and a test statistic.

Usage

getSigGroups(object, test.stat, ...)
runTest(object, algorithm, statistic, ...)
whichAlgorithms()
whichTests()

Arguments

ArgumentDescription
objectAn object of class topGOdata This object contains all data necessary for runnig the test.
test.statAn object of class groupStats . This object defines the test statistic.
algorithmCharacter string specifing which algorithm to use.
statisticCharacter string specifing which test to use.
list()Other parameters. In the case of runTest they are used for defining the test statistic

Details

The runTest function can be used only with a predefined set of test statistics and algorithms. The algorithms and the statistical tests which are accessible via the runTest function are shown by the whichAlgorithms() and whichTests() functions.

The runTest function is a warping of the getSigGroups and the initialisation of a groupStats object functions.

...

Value

An object of class topGOresult .

Seealso

topGOdata-class , groupStats-class , topGOresult-class

Author

Adrian Alexa

Examples

## load a sample topGOdata object
data(GOdata)
GOdata

##############################
## getSigGroups interface
##############################

## define a test statistic
test.stat <- new("classicCount", testStatistic = GOFisherTest, name = "Fisher test")
## perform the test
resultFis <- getSigGroups(GOdata, test.stat)
resultFis



##############################
## runTest interface
##############################

## Enrichment analysis by using the "classic" method and Fisher's exact test
resultFis <- runTest(GOdata, algorithm = "classic", statistic = "fisher")
resultFis

## weight01 is the default algorithm
weight01.fisher <- runTest(GOdata, statistic = "fisher")
weight01.fisher


## not all combinations are possible!
# weight.ks <- runTest(GOdata, algorithm = "weight", statistic = "t")

Grouping of GO terms into the three ontologies

Description

This function split the GOTERM environment into three different ontologies. The newly created environments contain each only the terms from one of the following ontologies 'BP', 'CC', 'MF'

Usage

groupGOTerms(where)

Arguments

ArgumentDescription
whereThe the environment where you want to bind the results.

Value

The function returns NULL.

Seealso

topGOdata-class , GOTERM

Author

Adrian Alexa

Examples

groupGOTerms()
Link to this function

groupStats_class()

Class "groupStats"

Description

A virtual class containing basic gene set information: the gene universe, the member of the current group, the test statistic defined for this group, etc.

Seealso

classicCount-class , getSigGroups-methods

Author

Adrian Alexa

The subgraph induced by a set of nodes.

Description

Given a set of nodes (GO terms) this function is returning the subgraph containing these nodes and their ancestors.

Usage

inducedGraph(dag, startNodes)
nodesInInducedGraph(dag, startNodes)

Arguments

ArgumentDescription
dagAn object of class graphNEL containing a directed graph.
startNodesA character vector giving the starting nodes.

Value

An object of class graphNEL-class is returned.

Seealso

topGOdata-class , reverseArch ,

Author

Adrian Alexa

Examples

data(GOdata)

## the GO graph
g <- graph(GOdata)
g

## select 10 random nodes
sn <- sample(nodes(g), 10)


## the subgraph induced by these nodes
sg <- inducedGraph(g, sn)
sg
Link to this function

parentChild_class()

Classes "parentChild" and "pC"

Description

Classes that extend the "classicCount" class by adding support for the parent-child test.

Seealso

classicCount-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

showClass("parentChild")
showClass("pC")
Link to this function

printGraph_methods()

Visualisation functions

Description

Functions to plot the subgraphs induced by the most significant GO terms

Usage

showSigOfNodes(GOdata, termsP.value, firstSigNodes = 10, reverse = TRUE,
               sigForAll = TRUE, wantedNodes = NULL, putWN = TRUE,
               putCL = 0, type = NULL, showEdges = TRUE,  swPlot = TRUE,
               useFullNames = TRUE, oldSigNodes = NULL, useInfo = c("none", "pval", "counts", "def", "np", "all")[1],
               plotFunction = GOplot, .NO.CHAR = 20)
printGraph(object, result, firstSigNodes, refResult, ...)

Arguments

ArgumentDescription
objectan object of class topGOdata .
GOdataan object of class topGOdata .
resultan object of class topGOresult .
firstSigNodesthe number of top scoring GO terms which ....
refResultan object of class topGOresult .
termsP.valuenamed vector of p-values.
reversethe direction of the edges.
sigForAllif TRUE the score/p-value of all nodes in the DAG is shown, otherwise only the score for the sigNodes
wantedNodesthe nodes that we want to find, we will plot this nodes with a different color. The vector contains the names of the nodes
putWNthe graph is generated with using the firstSigNodes and the wantedNodes.
putCLwe generate the graph from the nodes given by all previous parameters, plus their children. if putCL = 1 than only the children are added, if putCL = n we get the nodes form the next n levels.
typeused for ploting pie charts
showEdgesif TRUE the edge are shown
swPlotif true the graph is ploted, if not no ploting is done.
useInfoaditional info to be ploted to each node.
oldSigNodesused to plot the (new) sigNodes in the same collor range as the old ones
useFullNamesargument for internal use ..
plotFunctionargument for internal use ..
.NO.CHARargument for internal use ..

|list() | Extra arguments for printGraph can be: list(" ", " ", list(list(list("fn.prefix")), list(" ", " character string giving the file name prefix. ", " ")), " ", " ", list(list(list("useInfo")), list(" ", " as in ", list("showSigOfNodes"), " function. ", " ")), " ", " ", list(list(list("pdfSW")), list(" ", " logical attribute switch between PDF or PS formats. ", " ")), " ", " ") |

Details

There are two functions available. The showSigOfNodes will plot the induced subgraph to the current graphic device. The printGraph is a warping function for showSigOfNodes and will save the resulting graph into a PDF or PS file.

In the plots, the significant nodes are represented as rectangles. The plotted graph is the upper induced graph generated by these significant nodes.

Seealso

groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

data(GOdata)
data(results.tGO)

showSigOfNodes(GOdata, score(resultFisher), firstSigNodes = 5, useInfo = 'all')
printGraph(GOdata, resultFisher, firstSigNodes = 5, fn.prefix = "sampleFile", useInfo = "all", pdfSW = TRUE)
Link to this function

topGO_package()

Enrichment analysis for Gene Ontology

Description

topGO package provides tools for testing GO terms while accounting for the topology of the GO graph. Different test statistics and different methods for eliminating local similarities and dependencies between GO terms can be implemented and applied.

Details

list(list("ll"), list(" ", " Package: ", list(), " topGO", list(), " ", " Type: ", list(), " Package", list(), " ", " Version: ", list(), " 1.0", list(), " ", " Date: ", list(), " 2006-10-02", list(), " ", " License: ", list(), " What license is it under?", list(), " ", " ")) TODO: An overview of how to use the package, including the most important functions

Seealso

topGOdata-class , groupStats-class , getSigGroups-methods

Author

Adrian Alexa, J"org Rahnenf"uhrer

Maintainer: Adrian Alexa

References

Alexa A., Rahnenf"uhrer J., Lengauer T., Improved scoring of functional groups from gene expression data by decorrelating GO graph structure, Bioinformatics 22(13): 1600-1607, 2006

Link to this function

topGOdata_class()

Class "topGOdata"

Description

TODO: The node attributes are environments containing the genes/probes annotated to the respective node

If genes is a numeric vector than this should represent the gene's score. If it is factor it should discriminate the genes in interesting genes and the rest

TODO: it will be a good idea to replace the allGenes and allScore with an ExpressionSet class. In this way we can use tests like global test, globalAncova.... -- ALL variables starting with . are just for internal class usage (private)

Seealso

buildLevels , annFUN

Author

Adrian Alexa

Examples

## 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)
Link to this function

topGOresult_class()

Class "topGOresult"

Description

Class instance created by getSigGroups-methods or by runTest

Seealso

groupStats-class , getSigGroups-methods

Author

Adrian Alexa

Examples

data(results.tGO)

s <- score(resultFisher)

go <- sort(names(s))
go.sub<- sample(go, 100)
go.mixed <- c(sample(go, 50), sample(ls(GOCCTerm), 20))
go.others <- sample(ls(GOCCTerm), 100)


str(go)
str(go.sub)
str(go.mixed)
str(go.others)

str(score(resultFisher, whichGO = go))
str(score(resultFisher, whichGO = go.sub))
str(score(resultFisher, whichGO = go.mixed))
str(score(resultFisher, whichGO = go.others))

avgResult <- combineResults(resultFisher, resultKS)
avgResult
combineResults(resultFisher, resultKS, method = "min")
Link to this function

weightCount_class()

Class "weightCount"

Description

~~ A concise (1-5 lines) description of what the class is. ~~

Details

TODO: Some details here.....

Seealso

groupStats-class , getSigGroups-methods

Author

Adrian Alexa