g = cateGOry(c("CG2671", "CG2671", "CG2950"),
c("GO:0090079", "GO:0001738", "GO:0003676"), sparse=TRUE)
g
rowSums(g) ## number of genes in each category
## Filter out categories with less than minMem and more than maxMem members.
## This is toy data, in real applications, a choice of minMem higher
## than 2 will be more appropriate.
filter = function(x, minMemb = 2, maxMemb = 35) ((x>=minMemb) & (x<=maxMemb))
g[filter(rowSums(g)),,drop=FALSE ]
Run the code above in your browser using DataLab