# bioconductor v3.9.0 GOstats

A set of tools for interacting with GO and microarray

# Link to this section Summary

## Functions

Class "GOHyperGResult"

Defunct Functions in GOstats Package

Tools for manipulating GO and microarrays.

Distance matrices for the BCR/ABL and NEG subgroups.

Class "OBOHyperGResult"

A function to compute a correlation based graph from Gene Expression Data

A function to compute the distance between pairs of nodes in a graph.

Hypergeometric Tests for GO term association

Index to Dimnames

Construct a GO Graph

Find genes that are not connected to the others.

Construct the GO graph given a set of leaves.

Summarize Probe Sets Associated with a hyperGTest Result

Shortest Path Analysis

Functions to compute similarities between GO graphs and also between Entrez Gene IDs based on their induced GO graphs.

Extraction and Plotting of GO Terms from a GOHyperGResult Object

Triad Functions

# Link to this section Functions

# GOHyperGResult_class()

Class "GOHyperGResult"

## Description

This class represents the results of a test for overrepresentation of GO categories among genes in a selected gene set based upon the Hypergeometric distribution.

For details on extracting information from this object, be sure to read the accessor documentation in the Category package: HyperGResult-accessors .

## Seealso

## Author

Seth Falcon

# GOstats_defunct()

Defunct Functions in GOstats Package

## Description

The functions or variables listed here are no longer part of GOstats as they are not needed (any more).

## Usage

```
combGOGraph()
hyperGtable()
hyperG2Affy()
selectedGenes()
GOHyperG()
GOKEGGHyperG()
getGoGraph()
```

## Details

`combGOGraph`

was replaced by `join`

.
`hyperGtable`

was replaced by `summary`

.
`hyperG2Affy`

was replaced by `probeSetSummary`

.
`GOLeaves`

was replaced by `graph::leaves`

.
`selectedGenes`

was replaced by `geneIdsByCategory`

.
`GOHyperG`

was replaced by `hyperGTest`

.
`GOKEGGHyperG`

was replaced by `hyperGTest`

.
`getGoGraph`

was replaced by `GOGraph`

.

# GOstats_package()

Tools for manipulating GO and microarrays.

## Description

A set of tools for interacting with GO and microarray data. A variety of basic manipulation tools for graphs, hypothesis testing and other simple calculations.

## Details

list(list("ll"), list(" ", "Package: ", list(), " GOstats", list(), " ", "Version: ", list(), " 1.7.4", list(), " ", "Date: ", list(), " 23-08-2006", list(), " ", "biocViews: ", list(), " Statistics, Annotation, GO, MultipleComparisons", list(), " ", "Depends: ", list(), " graph (>= 1.9.25), GO, annotate, RBGL, xtable, Biobase, ", "genefilter, multtest, Category (>= 1.3.7), methods", list(), " ", "Imports: ", list(), " methods, Category", list(), " ", "Suggests: ", list(), " hgu95av2.db (>= 1.6.0)",

`list(), "`

", "License: ", list(), " Artistic", list(), " "))

Index: list(" ", "ALL Acute Lymphoblastic Leukemia Data from the Ritz ", " Laboratory ", "GOstats-defunct Defunct Functions in GOstats Package ", "Ndists Distance matrices for the BCR/ABL and NEG ", " subgroups. ", "compCorrGraph A function to compute a correlation based graph ", " from Gene Expression Data ", "compGdist A function to compute the distance between ",

`" pairs of nodes in a graph.`

", "dropECode Drop GO labels for specified Evidence Codes ", "getEvidence Get the Evidence codes for a set of GO terms. ", "getGOTerm Functions to Access GO data. ", "getOntology Get GO terms for a specified ontology ", "hasGOannote Check for GO annotation ", "idx2dimnames Index to Dimnames ", "makeGOGraph Construct a GO Graph ", "notConn Find genes that are not connected to the ",

`" others.`

", "oneGOGraph Construct the GO graph given a set of leaves. ", "shortestPath Shortest Path Analysis ", "simLL Functions to compute similarities between GO ", " graphs and also between Entrez Gene IDs based on ", " their induced GO graphs. ", "triadCensus Triad Functions ")

Further information is available in the following vignettes: list(list("ll"), list(" ", list("GOstats"), " ", list(), " Using GOstats (source, pdf)", list(), " ", list("GOusage"), " ", list(), " Basic GO Usage (source, pdf)", list(), " ", list("GOvis"), " ", list(), " Visualizing Data Using GOstats (source, pdf)", list(), " "))

## Author

R. Gentleman with contributions from S. Falcon

Maintainer: R. Gentleman rgentlem@fhcrc.org

# Ndists()

Distance matrices for the BCR/ABL and NEG subgroups.

## Description

These are precomputed distance matrices between all transcription factors selected. In the future they will be computed on the fly but currently that takes about 3 hours and so precomputed versions are supplied.

## Format

These are both distance matrices.

## Usage

```
data(Ndists)
data(Bdists)
```

## Examples

```
data(Ndists)
data(Bdists)
```

# OBOHyperGResult_class()

Class "OBOHyperGResult"

## Description

This class represents the results of a test for overrepresentation of OBO categories among genes in a selected gene set based upon the Hypergeometric distribution.

For details on extracting information from this object, be sure to read the accessor documentation in the Category package: HyperGResult-accessors .

## Seealso

## Author

Robert Castelo

# compCorrGraph()

A function to compute a correlation based graph from Gene Expression Data

## Description

Given a set of gene expression data (an instance of the
`ExpressionSet`

class) this function computes a graph based on
correlations between the probes.

## Usage

`compCorrGraph(eSet, k = 1, tau = 0.6)`

## Arguments

Argument | Description |
---|---|

`eSet` | An instance of the `ExpressionSet` class. |

`k` | The power to raise the correlations to. |

`tau` | The lower cutoff for absolute correlations. |

## Details

Zhou et al. describe a method of computing a graph between probes (genes) based on estimated correlations between probes. This function implements some of their methods.

Pearson correlations between probes are computed and then these are
raised to the power `k`

. Any of the resulting estimates that are
less than `tau`

in absolute value are set to zero.

## Value

An instance of the `graph`

class. With edges and edge weights
determined by applying the algorithm described previously.

## Seealso

## Author

R. Gentleman

## References

Zhou et al., Transitive functional annotation by shortest-path analysis of gene expression data.

## Examples

```
## Create an ExpressionSet to work with
set.seed(123)
exprMat <- matrix(runif(50 * 5), nrow=50)
genData <- new("ExpressionSet", exprs=exprMat)
corrG = compCorrGraph(genData)
```

# compGdist()

A function to compute the distance between pairs of nodes in a graph.

## Description

Given a graph, `g`

, and a set of nodes in the graph,
`whNodes`

, Dijkstra's shortest path algorithm is used to compute
the distance between all pairs of nodes in `whNodes`

.

## Usage

`compGdist(g, whNodes, verbose = FALSE)`

## Arguments

Argument | Description |
---|---|

`g` | An instance of the `graph` class. |

`whNodes` | A vector of lables of the nodes in `g` for which distances are to be computed. |

`verbose` | If `TRUE` then output reporting the progress will be reported. |

## Details

This function can be quite slow, computation of the pairwise
distances is not especially fast and if `whNodes`

is long then
there are many of them to compute.

## Value

A matrix containing the pairwise distances. It might be worth making
this an instance of the `dist`

class at some point.

## Seealso

## Author

R. Gentleman

## Examples

```
example(compCorrGraph)
compGdist(corrG, nodes(corrG)[1:5])
```

# hyperGTest()

Hypergeometric Tests for GO term association

## Description

Given a `GOHyperGParams`

instance
containing a set of unique Entrez Gene Identifiers, a microarray
annotation data package name, and the GO ontology of interest, this
function will compute Hypergeomtric p-values for over or
under-representation of each GO term in the specified ontology among
the GO annotations for the interesting genes. The computations can
be done conditionally based on the structure of the GO graph.

## Arguments

Argument | Description |
---|---|

`p` | A `GOHyperGParams` or `OBOHyperGParams` instance |

## Details

When `conditional(p) == TRUE`

, the `hyperGTest`

function
uses the structure of the GO graph to estimate for each term whether
or not there is evidence beyond that which is provided by the term's
children to call the term in question statistically overrepresented.

The algorithm conditions on all child terms that are themselves
significant at the specified p-value, odds ratio, minimum or
maximum gene set size cutoff. Given a subgraph of
one of the three GO ontologies, or the ontology given in the
`OBOHyperGParams`

instance, the terms with no child categories
are tested first. Next the nodes whose children have already been
tested are tested. If any of a given node's children tested
significant, the appropriate conditioning is performed.

## Value

A `GOHyperGResult`

or `OBOHyperGResult`

instance.

## Seealso

`GOHyperGResult-class`

,
%code{link[Category]{geneCategoryHyperGeoTest}},
`geneGoHyperGeoTest`

,
`geneKeggHyperGeoTest`

## Author

Seth Falcon

## References

FIXME

# idx2dimnames()

Index to Dimnames

## Description

A function to map from integer offsets in an array to the corresponding values of the row and column names. There is probably a better way but I didn't find it.

## Usage

`idx2dimnames(x, idx)`

## Arguments

Argument | Description |
---|---|

`x` | a `matrix` or `data.frame` . |

`idx` | An integer vector of offsets into the matrix (values between 1 and the `length` of the matrix. |

## Value

A list with two components. If it is a LIST, use

*

## Seealso

## Author

R. Gentleman

## Examples

```
data(Ndists)
ltInf = is.finite(Ndists)
xx = idx2dimnames(Ndists, ltInf)
```

# makeGOGraph()

Construct a GO Graph

## Description

The directed acyclic graph (DAG) based on finding the most specific terms for the supplied Entrez Gene IDs is constructed and returned. The constructuion is per GO ontology (there are three, MF, BP and CC) and once the most specific terms have been identified then all less specific terms are found (these are the parents of the terms) and then their parents and so on, until the root is encountered.

## Usage

```
makeGOGraph(x, Ontology = "MF", removeRoot = TRUE, mapfun = NULL,
chip = NULL)
```

## Arguments

Argument | Description |
---|---|

`x` | A vector of Entrez Gene IDs. |

`Ontology` | Which GO ontology to use (CC, BP, or MF). |

`removeRoot` | A logical value indicating whether the GO root node should be removed or not. |

`mapfun` | A function taking a character vector of Entrez Gene IDs as its only argument and returning a list of "GO lists" matching the structure of the lists in the GO maps of annotation data packages. The function should behave similarly to `mget(x, eg2gomap, ifnotfound=NA)` , that is, `NA` should be returned if a specified Entrez ID has no GO mapping. See details for the interaction of `mapfun` and `chip` . |

`chip` | The name of a DB-based annotation data package (the name will end in ".db"). This package will be used to generate an Entrez ID to GO ID mapping instead of `mapfun` . |

## Details

For each supplied Entrez Gene identifier all the GO annotations (in the specified ontology) are found. The mapping is achieved in one of three ways:

If

`mapfun`

is provided, it will be used to perform the needed lookups. In this case,`chip`

will be ignored.If

`chip`

is provided and`mapfun=NULL`

, then the needed lookups will be done based on the Entrez to GO mappings encapsulated in the specified annotation data package. This is the recommended usage.If

`mapfun`

and`chip`

are`NULL`

or missing, then the function will attempt to load the GO package (the environment-based package, distinct from GO.db). This package contains a legacy environment mapping Entrez IDs to GO IDs. If the GO package is not available, an error will be raised. Omitting both`mapfun`

and`chip`

is not recommended as it is not compatible with the DB-based annotation data packages.

The mappings are different for the different ontologies. Typically a GO indentifier is used only in one specific ontology.

The resulting structure is stored in a graph using the `graph`

package, again from Bioconductor.

## Value

An object that inherits from the `graph`

class. The particular
implementation is not specified.

## Seealso

## Author

R. Gentleman

## References

The Gene Ontology Consortium

## Examples

```
library("hgu95av2.db")
set.seed(321)
gN <- unique(sample(keys(hgu95av2.db, 'ENTREZID'), 4))
gg1 <- makeGOGraph(gN, "BP", chip="hgu95av2.db")
```

# notConn()

Find genes that are not connected to the others.

## Description

A function that takes as input a distance matrix and finds those
entries that are not connected to any others (ie. those with distance
`Inf`

.

## Usage

`notConn(dists)`

## Arguments

Argument | Description |
---|---|

`dists` | A distance matrix. |

## Details

It is a very naive implementation. It presumes that not connected
entries are not connected to any other entries, and this might not be
true. Using the `connComp`

function from the `graph`

package or the `RBGL`

package might be a better approach.

## Value

A vector of the names of the items that are not connected.

## Seealso

## Author

R. Gentleman

## Examples

```
data(Ndists)
notConn(Ndists)
```

# oneGOGraph()

Construct the GO graph given a set of leaves.

## Description

Given one or more GO identifiers (which indicate the leaves in the graph) and a set of mappings to the less specific sets of nodes this function will construct the graph that includes that node and all children down to the root node for the ontology.

## Usage

```
oneGOGraph(x, dataenv)
GOGraph(x, dataenv)
```

## Arguments

Argument | Description |
---|---|

`x` | A character vector of GO identifiers. |

`dataenv` | An environment for finding the parents of that term. |

## Details

For any set of GO identifiers (from a common ontology) we define the induced GO graph to be that graph, based on the DAG structure (child - parent) of the GO ontology of terms, which takes the most specific set of GO terms that apply (for that ontology) and then joins these to all less specific terms. These functions help construct such graphs.

## Value

The induced GO graph (or NULL) for the given GO identifier.

## Seealso

## Author

R. Gentleman

## Examples

```
library("GO.db")
g1 <- oneGOGraph("GO:0003680", GOMFPARENTS)
g2 <- oneGOGraph("GO:0003701", GOMFPARENTS)
g3 <- join(g1, g2)
g4 <- GOGraph(c("GO:0003680", "GO:0003701"), GOMFPARENTS)
if( require("Rgraphviz") && interactive() )
plot(g3)
```

# probeSetSummary()

Summarize Probe Sets Associated with a hyperGTest Result

## Description

Given the result of a `hyperGTest`

run (an instance of
`GOHyperGResult`

), this function lists all Probe Set IDs
associated with the selected Entrez IDs annotated at each
significant GO term in the test result.

## Usage

`probeSetSummary(result, pvalue, categorySize, sigProbesets, ids = "ENTREZID")`

## Arguments

Argument | Description |
---|---|

`result` | A `GOHyperGResult` instance. This is the output of the `hyperGTest` function when testing the GO category. |

`pvalue` | Optional p-value cutoff. Only results for GO terms with a p-value less than the specified value will be returned. If omitted, `pvalueCutoff(result)` is used. |

`categorySize` | Optional minimum size (number of annotations) for the GO terms. Only results for GO terms with `categorySize` or more annotations will be returned. If omitted, no category size criteria will be used. |

`sigProbesets` | Optional vector of probeset IDs. See details for more information. |

`ids` | Character. The type of IDs used in creating the `GOHyperGResult` object. Usually 'ENTREZID', but may be e.g., 'ACCNUM' if using A. thaliana chip. |

## Details

Usually the goal of doing a Fisher's exact test on a set of significant probesets is to find pathways or cellular activities that are being perturbed in an experiment. After doing the test, one usually gets a list of significant GO terms, and the next logical step might be to determine which probesets contributed to the significance of a certain term.

Because the input for the Fisher's exact test consists of a vector of unique Entrez Gene IDs, and there may be multiple probesets that interrogate a particular transcript, the ouput for this function lists all of the probesets that map to each Entrez Gene ID, along with an indicator that shows which of the probesets were used as input.

The rationale for this is that one might not be able to assume a given probeset actually interrogates the intended transcript, so it might be useful to be able to check to see what other similar probesets are doing.

Because one of the first steps before running `hyperGTest`

is to
subset the input vectors of geneIds and universeGeneIds, any
information about probeset IDs that interrogate the same gene
transcript is lost. In order to recover this information, one can pass
a vector of probeset IDs that were considered significant. This vector
will then be used to indicate which of the probesets that map to a
given GO term were significant in the original analysis.

## Value

A `list`

of `data.frame`

. Each element of the list
corresponds to one of the GO terms (the term is provides as the name
of the element). Each `data.frame`

has three columns:
the Entrez Gene ID ( `EntrezID`

), the probe set ID
( `ProbeSetID`

), and a 0/1 indicator of whether the probe set ID
was provided as part of the initial input ( `selected`

)

Note that this 0/1 indicator will only be correct if the 'geneId'
vector used to construct the `GOHyperGParams`

object was a named
vector (where the names are probeset IDs), or if a vector of
'sigProbesets' was passed to this function.

## Author

S. Falcon and J. MacDonald

## Examples

```
## Fake up some data
library("hgu95av2.db")
library("annotate")
prbs <- ls(hgu95av2GO)[1:300]
## Only those with GO ids
hasGO <- sapply(mget(prbs, hgu95av2GO), function(ids)
if(!is.na(ids) && length(ids) > 1) TRUE else FALSE)
prbs <- prbs[hasGO]
prbs <- getEG(prbs, "hgu95av2")
## remove duplicates, but keep named vector
prbs <- prbs[!duplicated(prbs)]
## do the same for universe
univ <- ls(hgu95av2GO)[1:5000]
hasUnivGO <- sapply(mget(univ, hgu95av2GO), function(ids)
if(!is.na(ids) && length(ids) > 1) TRUE else FALSE)
univ <- univ[hasUnivGO]
univ <- unique(getEG(univ, "hgu95av2"))
p <- new("GOHyperGParams", geneIds=prbs, universeGeneIds=univ,
ontology="BP", annotation="hgu95av2", conditional=TRUE)
## this part takes time...
if(interactive()){
hyp <- hyperGTest(p)
ps <- probeSetSummary(hyp, 0.05, 10)
}
```

# shortestPath()

Shortest Path Analysis

## Description

The shortest path analysis was proposed by Zhou et. al. The basic computation is to find the shortest path in a supplied graph between two Entrez Gene IDs. Zhou et al claim that other genes annotated along that path are likely to have the same GO annotation as the two end points.

## Usage

`shortestPath(g, GOnode, mapfun=NULL, chip=NULL)`

## Arguments

Argument | Description |
---|---|

`g` | An instance of the `graph` class. |

`GOnode` | A length one character vector specifying the GO node of interest. |

`mapfun` | A function taking a character vector of GO IDs as its only argument and returning a list of character vectors of Enterz Gene IDs annotated at each corresponding GO ID. The function should behave similarly to `mget(x, go2egmap, ifnotfound=NA)` , that is, `NA` should be returned if a specified GO ID has no Entrez ID mappings. See details for the interaction of `mapfun` and `chip` . |

`chip` | The name of a DB-based annotation data package (the name will end in ".db"). This package will be used to generate an Entrez ID to GO ID mapping instead of `mapfun` . |

## Details

The algorithm implemented here is quite simple. All Entrez Gene
identifiers that are annotated at the GO node of interest are
obtained. Those that are found as nodes in the graph are retained and
used for the computation. For every pair of nodes at the GO term the
shortest path between them is computed using `sp.between`

from
the RBGL package.

There is a presumption that the graph is `undirected`

. This
restriction could probably be lifted if there was some reason for it -
a patch would be gratefully accepted.

The mapping of GO node to Entrez ID is achieved in one of three ways:

If

`mapfun`

is provided, it will be used to perform the needed lookups. In this case,`chip`

will be ignored.If

`chip`

is provided and`mapfun=NULL`

, then the needed lookups will be done based on the GO to Entrez mappings encapsulated in the specified annotation data package. This is the recommended usage.If

`mapfun`

and`chip`

are`NULL`

or missing, then the function will attempt to load the GO package (the environment-based package, distinct from GO.db). This package contains a legacy environment mapping GO IDs to Entrez IDs. If the GO package is not available, an error will be raised. Omitting both`mapfun`

and`chip`

is not recommended as it is not compatible with the DB-based annotation data packages.

## Value

The return values is a list with the following components:

*

## Seealso

## Author

R. Gentleman

## References

Transitive functional annotation by shortest-path analysis of gene expression data, by X. Zhou and M-C J. Kao and W. H. Wong, PNAS, 2002

## Examples

```
library("hgu95av2.db")
library("RBGL")
set.seed(321)
uniqun <- function(x) unique(unlist(x))
goid <- "GO:0005778"
egIds <- uniqun(mget(uniqun(hgu95av2GO2PROBE[[goid]]),
hgu95av2ENTREZID))
v1 <- randomGraph(egIds, 1:10, .3, weights=FALSE)
## Since v1 is random, it might be disconnected and we need a
## connected graph to guarantee the existence of a path.
c1 <- connComp(v1)
largestComp <- c1[[which.max(sapply(c1, length))]]
v2 <- subGraph(largestComp, v1)
a1 <- shortestPath(v2, goid, chip="hgu95av2.db")
```

# simLL()

Functions to compute similarities between GO graphs and also between Entrez Gene IDs based on their induced GO graphs.

## Description

Both `simUI`

and `simLP`

compute a similarity measure
between two GO graphs. For `simLL`

, first the induced GO graph
for each of its arguments is found and then these are passed to one
of `simUI`

or `simLP`

.

## Usage

```
simLL(ll1, ll2, Ontology = "MF", measure = "LP", dropCodes = NULL,
mapfun = NULL, chip = NULL)
simUI(g1, g2)
simLP(g1, g2)
```

## Arguments

Argument | Description |
---|---|

`ll1` | A Entrez Gene ID as a character vector. |

`ll2` | A Entrez Gene ID as a character vector. |

`Ontology` | Which ontology to use ("MF", "BP", "CC"). |

`measure` | Which measure to use ("LP", "UI"). |

`dropCodes` | A set of evidence codes to be ignored in constructing the induced GO graphs. |

`mapfun` | A function taking a character vector of Entrez Gene IDs as its only argument and returning a list of "GO lists" matching the structure of the lists in the GO maps of annotation data packages. The function should behave similarly to `mget(x, eg2gomap,` , that is, `NA` should be returned if a specified Entrez ID has no GO mapping. See details for the interaction of `mapfun` and `chip` . |

`chip` | The name of a DB-based annotation data package (the name will end in ".db"). This package will be used to generate an Entrez ID to GO ID mapping instead of `mapfun` . |

`g1` | An instance of the `graph` class. |

`g2` | An instance of the `graph` class. |

## Details

For each of `ll1`

and `ll2`

the set of most specific GO
terms within the ontology specified ( `Ontology`

) that are not
based on any excluded evidence code ( `dropCodes`

) are found. The
mapping is achieved in one of three ways:

If

`mapfun`

is provided, it will be used to perform the needed lookups. In this case,`chip`

will be ignored.If

`chip`

is provided and`mapfun=NULL`

, then the needed lookups will be done based on the Entrez to GO mappings encapsulated in the specified annotation data package. This is the recommended usage.If

`mapfun`

and`chip`

are`NULL`

or missing, then the function will attempt to load the GO package (the environment-based package, distinct from GO.db). This package contains a legacy environment mapping Entrez IDs to GO IDs. If the GO package is not available, an error will be raised. Omitting both`mapfun`

and`chip`

is not recommended as it is not compatible with the DB-based annotation data packages.

Next, the induced GO graphs are computed.

Finally these graphs are passed to one of `simUI`

, (union
intersection), or `simLP`

(longest path). For `simUI`

the
distance is the size of the intersection of the node sets divided by
the size of the union of the node sets. Large values indicate more
similarity. These similarities are between 0 and 1.

For `simLP`

the length of the longest path in the intersection
graph of the two supplied graph. Again, large values indicate more
similarity. Similarities are between 0 and the maximum leaf depth of
the graph for the specified ontology.

## Value

A list with:

If one of the supplied Gene IDs does not have any GO terms associated
with it, in the selected ontology and with the selected evidence codes
then `NA`

is returned.

## Seealso

## Author

R. Gentleman

## Examples

```
library("hgu95av2.db")
eg1 = c("9184", "3547")
bb = simLL(eg1[1], eg1[2], "BP", chip="hgu95av2.db")
```

# termGraphs()

Extraction and Plotting of GO Terms from a GOHyperGResult Object

## Description

These functions extract and plot `graph`

instances representing the
relationships among GO terms tested using `hyperGTest`

.

## Usage

```
termGraphs(r, id = NULL, pvalue = NULL, use.terms = TRUE)
inducedTermGraph(r, id, children = TRUE, parents = TRUE)
plotGOTermGraph(g, r = NULL, add.counts = TRUE, max.nchar = 20,
node.colors=c(sig="lightgray", not="white"),
node.shape="plaintext", ...)
```

## Arguments

Argument | Description |
---|---|

`r` | A `GOHyperGResult` object as returned by `hyperGTest` when given a `GOHyperGParams` object as input. |

`id` | A character vector of category IDs that specifies which terms should be included in the graph. |

`pvalue` | Numeric p-value cutoff to use for selecting category terms to include. Will be ignored if `id` is present. |

`use.terms` | Logical value indicating whether a `"term"` node attribute should be added to the returned graph providing the more descriptive, but possibly much longer, GO Terms. |

`children` | A logical value indicating whether to include direct child terms of the terms specified by `id` . |

`parents` | A logical value indicating whether to include direct parent terms of the terms specified by `id` . |

`g` | A `graph` object as returned by `inducedTermGraph` or `termGraphs` . |

`add.counts` | A logical value indicating whether category size counts should be added to the node labels when plotting. |

`max.nchar` | The maximum character length for node labels in the plot. |

`node.colors` | A named character vector of length two with compoents `sig` and `not` , giving color names for the significant and non-significant nodes, respectively. |

`node.shape` | This argument controls the shape of the plotted nodes and must take on a value allowed by Rgraphviz. |

`...` | For `plotGOTermGraph` , extra arguments are passed to the `plot` function. |

## Details

list("
", "

", " ", list(list("termGraphs"), list("returns a list of ", list("graph"), " objects each
", " representing one of the connected components of the subgraph of
", " the GO ontology induced by selecting the specified GO IDs (if
", " ", list("id"), " is present) or by selecting the GO IDs that have a
", " p-value less that ", list("pvalue"), ". If ", list("use.terms"), " is
", " ", list("TRUE"), " the GO IDs will be translated into GO Term names and
",

`" attached to the nodes as node attributes (see ", list("nodeData"), ").`

", " Edges in the graphs go from child (more specific) to parent (less ", " specific).")), " ", " ", " ", list(list("inducedTermGraph"), list("returns a ", list("graph"), " object representing ", " the GO graph induced by the terms specified by ", list("id"), ". The ", " ", list("children"), " and ", list("parent"), " arguments control whether direct ", " children and/or direct parents of the terms specified by ",

`list("id"), "`

", " are added to the graph (at least one of the two must be ", " ", list("TRUE"), ").")), " ", " ", " ", list(list("plotGOTermGraph"), list("Create a plot using Rgraphviz of a ", " ", list("graph"), " object as returned by either ", list("termGraphs"), " or ", " ", list("inducedTermGraph"), ". If a ", list("GOHyperGResult"), " object is ", " provided, then the nodes will be colored according to significance ", " (based on the result object's ",

`list("pvalueCutoff"), ") and counts will`

", " be added to show the size of the categories. ", " ")), " ", " ", " ")

## Author

Seth Falcon

# triadCensus()

Triad Functions

## Description

These functions provide some tools for finding triads in an undirected
graph. A triad is a clique of size 3. The function `triadCensus`

returns a list of all triads.

## Usage

```
triadCensus(graph)
isTriad(x, y, z, elz, ely)
reduce2Degreek(graph, k)
enumPairs(iVec)
```

## Arguments

Argument | Description |
---|---|

`graph` | An instance of the `graph` class. |

`k` | An integer indicating the minimum degree wanted. |

`x` | A node |

`y` | A node |

`z` | A node |

`elz` | The edgelist for `z` |

`ely` | The edgelist for `y` |

`iVec` | A vector of unique values |

## Details

`enumPairs`

takes a vector as input and returns a list of length
`choose(length(iVec),2)/2`

containing all unordered pairs of
elements.

`isTriad`

takes three nodes as arguments. It is already known
that `x`

has edges to both `y`

and `z`

and we want to
determine whether these are reciprocated. This is determined by
examining `elz`

for both `x`

and `y`

and then examining
`ely`

for both `x`

and `z`

.

`reduce2Degreek`

is a function that takes an undirected graph as
input and removes all nodes of degree less than `k`

. This process
is iterated until there are no nodes left (an error is thrown) or all
nodes remaining have degree at least `k`

. The resultant subgraph
is returned. It is used here because to be in a triad all nodes must
have degree 2 or more.

`triadCensus`

makes use of the helper functions described above
and finds all triads in the graph.

## Value

A list where each element is a triple indicating the members of the triad. Order is not important and all triads are reported in alphabetic order.

## Note

See the graph package, RBGL and Rgraphviz for more details and alternatives.

## Author

R. Gentleman

## Examples

```
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
```