cateGOry {Category} | R Documentation |
The function constructs a category membership data structure, such as used by
applyByCategory
,
from a list of gene identifiers and their annotated GO categories.
For each of the GO categories stated in categ
, it also
considers the implied annotation with all ancestors.
cateGOry(x, categ, sparse=TRUE)
x |
Character vector with (arbitrary) gene identifiers. They will be used for the column names of the resulting matrix. |
categ |
A character vector of the same length as x
with GO annotations for the genes in x . If a
gene has multiple GO annotations, it is expected to occur multiple
times in x , once for each different annotation. |
sparse |
Logical. See Section "Value". |
Requires the GO
package.
Depending on the value of sparse
:
If TRUE
, an object of class
graphNEL
whose edges represent GO category membership of genes.
This is really a bipartite graph, but the current implementation
simply uses ordinary directed graph representation.
If FALSE
, an integer matrix whose columns correspond to
x
and whose rows correspond to GO categories. Row names are the
GO category names, column names the gene identifiers. Matrix element
[i,j]
is 1 if gene j
is in category i
,
and 0 otherwise. For large vectors x
, the sparse format will be
more efficient.
W. Huber
g = cateGOry(c("CG2671", "CG2671", "CG2950"), c("GO:0000074", "GO:0001738", "GO:0003676")) edges(g)[c("GO:0000074", "GO:0003676", "CG2950")] m = cateGOry(c("CG2671", "CG2671", "CG2950"), c("GO:0000074", "GO:0001738", "GO:0003676"), sparse=FALSE) for(ct in rownames(m)) stopifnot(edges(g)[[ct]] == names(which(m[ct, ]!=0)))