Category (version 2.38.0)

HyperGResult-accessors: Accessors for HyperGResult Objects

Description

This manual page documents generic functions for extracting data from the result object returned from a call to hyperGTest. The result object will be a subclass of HyperGResultBase. Methods apply to all result object classes unless otherwise noted.

Usage

pvalues(r) oddsRatios(r) expectedCounts(r)
geneCounts(r) universeCounts(r) universeMappedCount(r) geneMappedCount(r)
geneIds(object, ...) geneIdUniverse(r, cond = TRUE) geneIdsByCategory(r, catids = NULL) sigCategories(r, p)
## R CMD check doesn't like these ## annotation(r) ## description(r)
testName(r) pvalueCutoff(r) testDirection(r)
chrGraph(r)

Arguments

r, object
An instance of a subclass of HyperGResultBase.
catids
A character vector of category identifiers.
p
Numeric p-value used as a cutoff for selecting a subset of the result.
cond
A logical value indicating whether to return conditional results for a conditional test. The default is TRUE. For non-conditional results, this argument is ignored.
...
Additional arguments that may be used by specializing methods.

Accessor Methods (Generic Functions)

organism
returns a "character" vector describing the organism for which the results were calculated.
geneCounts
returns an "integer" vector: for each category term tested, the number of genes from the gene set that are annotated at the term.
pvalues
returns a "numeric" vector: the ordered p-values for each category term tested.
universeCounts
returns an "integer" vector: for each category term tested, the number of genes from the gene universe that are annotated at the term.
universeMappedCount
returns an "integer" vector of length one giving the size of the gene universe set.
expectedCounts
returns a "numeric" vector giving the expected number of genes in the selected gene list to be found at each tested category term. These values may surprise you if you forget that your gene list and gene universe might have had to undergo further filtering to ensure that each gene has been labeled by at least one GO term.
oddsRatios
returns a "numeric" vector giving the odds ratio for each category term tested.
annotation
returns the name of the annotation data package used.
geneIds
returns the input vector of gene identifiers intersected with the universe of gene identifiers used in the computation.
geneIdUniverse
returns a list named by the tested categories. Each element of the list is a vector of gene identifiers (from the gene universe) annotated at the corresponding category term.
geneIdsByCategory
returns a list similar to geneIdUniverse, but each vector of gene IDs is intersected with the list of selected gene IDs from geneIds. The result is the selected gene IDs annotated at each category.
sigCategories
returns a character vector of category identifiers with a significant p-value. If argument p is missing, then the cutoff obtained from pvalueCutoff(r) will be used.
geneMappedCount
returns the size of the selected gene set used in the computation. This is simply length(geneIds(obj)).
pvalueCutoff
accessor for the pvalueCutoff slot.
testDirection
accessor for the testDirection slot. Contains a string indicating whether the test was for "over" or "under" representation of the categories.
description
returns a character string description of the test result.
testName
returns a string describing the testing method used.
summary
returns a data.frame summarizing the test result. Optional arguments pvalue and categorySize allow specification of maximum p-value and minimum categorySize, respectively.
The data frame contains the GOID, Pvalue, OddsRatio, ExpCount, Count, and Size. ExpCount is the expected count and the Count is how many instances of that term were actually oberved in your gene list while the Size is the number that could have been found in your gene list if every instance had turned up. Values like the ExpCount and the Size are going to be affected by what is included in the gene universe as well as by whether or not it was a conditional test.
htmlReport
writes an HTML version of the table produced by the summary method. The first argument should be a HyperGResult instance (or subclass). The path of a file to write the report to can be specified using the file argument. The default is file="" which will cause the report to be printed to the screen. If you wish to create a single report comprising multiple results you can set append=TRUE. The default is FALSE (overwrite pre-existing report file). You can specify a string to use as an identifier for each table by providing a value for the label argument. The number of digits displayed in numerical columns can be controlled using digits (defaults to 3). The summary method is called on the HyperGResult instance to generate a data frame that is transformed to HTML. You can pass additional arguments to the summary method which is used to generate the data frame that is transformed to HTML by specifying a named list using summary.args.

See Also

hyperGTest HyperGResult-class HyperGParams-class GOHyperGParams-class KEGGHyperGParams-class

Examples

Run this code
## Note that more in-depth examples can be found in the GOstats
## vignette (Hypergeometric tests using GOstats).
library("hgu95av2.db")
library("annotate")

## Retrieve 300 probeids that have PFAM ids
probids <- keys(hgu95av2.db,keytype="PROBEID",column="PFAM")[1:300]

## get unique Entrez Gene IDs
geneids <- select(hgu95av2.db, probids, 'ENTREZID', 'PROBEID')
geneids <- unique(geneids[['ENTREZID']])

## Now do the same for the universe
univ <- keys(hgu95av2.db,keytype="PROBEID",column="PFAM")
univ <- select(hgu95av2.db, univ, 'ENTREZID', 'PROBEID')
univ <- unique(univ[['ENTREZID']])

p <- new("PFAMHyperGParams", geneIds=geneids, universeGeneIds=univ,
         annotation="hgu95av2")
## this takes a while...
if(interactive()){
hypt <- hyperGTest(p)
summary(hypt)
htmlReport(hypt, file="temp.html", summary.args=list("htmlLinks"=TRUE))
}

Run the code above in your browser using DataLab