I am using topGO and the annFUN.org in that package to collect GO terms for enrichment using ensembl gene names. The analysis is done using the GO main category BP (Biological Process), but if needed one can of course also do it for BP and/or CC. I am not sure how to best summarise the data over the different contrasts and if all contrast are interesting to look at. The analysis described below focus on a single contrast, but it is easy enough to do it for all other contrasts as well, by just changing the input object.

# Function for creating named vector suitable for topGO analysis from Limma results. Note that the up and down alteres p-values so that only the up- respectively down- regulated once are retained as significant and the other class will have p-values of 1.
library(topGO)
## Loading required package: graph
## Loading required package: Biobase
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## 
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## 
## The following object is masked from 'package:stats':
## 
##     xtabs
## 
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, as.vector, cbind,
##     colnames, do.call, duplicated, eval, evalq, Filter, Find, get,
##     intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rep.int, rownames, sapply, setdiff, sort,
##     table, tapply, union, unique, unlist, unsplit
## 
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Loading required package: GO.db
## Loading required package: AnnotationDbi
## Loading required package: stats4
## Loading required package: GenomeInfoDb
## Loading required package: S4Vectors
## Loading required package: IRanges
## 
## Attaching package: 'AnnotationDbi'
## 
## The following object is masked from 'package:GenomeInfoDb':
## 
##     species
## 
## Loading required package: DBI
## 
## Loading required package: SparseM
## 
## Attaching package: 'SparseM'
## 
## The following object is masked from 'package:base':
## 
##     backsolve
## 
## groupGOTerms:    GOBPTerm, GOMFTerm, GOCCTerm environments built.
## 
## Attaching package: 'topGO'
## 
## The following objects are masked from 'package:IRanges':
## 
##     members, score, score<-
library(limma)
## 
## Attaching package: 'limma'
## 
## The following object is masked from 'package:BiocGenerics':
## 
##     plotMA
limmaTopGenes <- function(marray.lm, p.val = 0.05, direction = c("both", "up", "down")) {
    result.table.allgenes <- topTableF(marray.lm, adjust="BH", number=length(marray.lm$genes[, 1]))
    if (direction == "both") {
        # Use all significant genes in analysis
        # selected.genes <- result.table.allgenes[result.table.allgenes$adj.P.Val < p.val, ]
        result.table.allgenes[abs(result.table.allgenes[,3]) < 0.75, ncol(result.table.allgenes)] <- 1
        genes.pval <- setNames(result.table.allgenes$adj.P.Val, result.table.allgenes$ensembl_gene_id)
    } else if (direction == "up") {
        # Use the significant up-regulated genes in analysis, whereas the significant down-regulated genes get adjusted p-values of 1
        result.table.allgenes[result.table.allgenes[,3] < 0, ncol(result.table.allgenes)] <- 1  
        # selected.genes <- result.table.allgenes[result.table.allgenes$adj.P.Val < p.val, ]
        genes.pval <- setNames(result.table.allgenes$adj.P.Val, result.table.allgenes$ensembl_gene_id)
    } else {
        # Use the significant down-regulated genes in analysis, whereas the significant up-regulated genes get adjusted p-values of 1
        result.table.allgenes[result.table.allgenes[,3] > 0, ncol(result.table.allgenes)] <- 1
        # selected.genes <- result.table.allgenes[result.table.allgenes$adj.P.Val < p.val, ]
        genes.pval <- setNames(result.table.allgenes$adj.P.Val, result.table.allgenes$ensembl_gene_id)
    } 
}

topDiffGenes <- function(allScore) {
    return(allScore < 0.05)
    }

The code below will use the linear results from the earlier limma analysis and add GO terms and do the test of enrichment test using Fischer exact test as implemented in the topGO package. Please check the manual for more info on the created object.

# read in data from earlier analysis, but remove contrasts that iis within treatment and just over time.

load(file = "FitLM.rdata")
rm(fit.CeO2.time)
rm(fit.NAC.time)
rm(fit.SDC.time)
# note that this will analyse all significant, whereas dir = "up"/"down" will do the enrichment test for the up or downregulated genes sep. This will take care of cut-off for fold change and only retain genes where the absolute value of the foldchange is larger than 0.75.


CeO2.time1.pval.both <- limmaTopGenes(fit.CeO2.time1, dir="both") 
go.BP.CeO2.time1 <- new("topGOdata", description="GO annotation CeO2 time 1", ontology="BP", allGenes = CeO2.time1.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs .....
## Loading required package: org.Mm.eg.db
##  ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.Ceo2.time1 <- runTest(go.BP.CeO2.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3490 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.CeO2.time1 <- GenTable(go.BP.CeO2.time1, classic = result.fischer.Ceo2.time1, topNodes = 20)
all.res.CeO2.time1
##         GO.ID                                        Term Annotated
## 1  GO:0007155                               cell adhesion       697
## 2  GO:0022610                         biological adhesion       702
## 3  GO:0048731                          system development      2673
## 4  GO:0048468                            cell development      1351
## 5  GO:0030154                        cell differentiation      2359
## 6  GO:0009888                          tissue development      1209
## 7  GO:0000904 cell morphogenesis involved in different...       506
## 8  GO:0006928                 cellular component movement      1044
## 9  GO:0044707       single-multicellular organism process      3827
## 10 GO:0032501            multicellular organismal process      3926
## 11 GO:0007166     cell surface receptor signaling pathway      1632
## 12 GO:0048513                           organ development      1970
## 13 GO:2000026 regulation of multicellular organismal d...      1072
## 14 GO:0048666                          neuron development       641
## 15 GO:0031175               neuron projection development       555
## 16 GO:0007156                    homophilic cell adhesion        52
## 17 GO:0022008                                neurogenesis       944
## 18 GO:0030182                      neuron differentiation       793
## 19 GO:0007167 enzyme linked receptor protein signaling...       541
## 20 GO:0007399                  nervous system development      1290
##    Significant Expected classic
## 1           59    27.86 3.4e-08
## 2           59    28.06 4.4e-08
## 3          154   106.84 4.4e-07
## 4           89    54.00 1.3e-06
## 5          137    94.29 1.6e-06
## 6           81    48.32 2.2e-06
## 7           43    20.23 2.5e-06
## 8           72    41.73 3.2e-06
## 9          201   152.97 3.4e-06
## 10         205   156.93 3.8e-06
## 11         101    65.23 3.9e-06
## 12         117    78.74 4.2e-06
## 13          73    42.85 4.3e-06
## 14          50    25.62 4.4e-06
## 15          45    22.18 5.0e-06
## 16          11     2.08 5.1e-06
## 17          66    37.73 5.5e-06
## 18          58    31.70 5.5e-06
## 19          44    21.62 5.9e-06
## 20          83    51.56 7.9e-06
showSigOfNodes(go.BP.CeO2.time1, score(result.fischer.Ceo2.time1), firstSigNodes = 10, useInfo = 'all')
## Loading required package: Rgraphviz
## Loading required package: grid
## 
## Attaching package: 'grid'
## 
## The following object is masked from 'package:topGO':
## 
##     depth

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 24 
## Number of Edges = 35 
## 
## $complete.dag
## [1] "A graph with 24 nodes."
CeO2.time4.pval.both <- limmaTopGenes(fit.CeO2.time4, dir="both") 
go.BP.CeO2.time4 <- new("topGOdata", description="GO annotation CeO2 time 4", ontology="BP", allGenes = CeO2.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.CeO2.time4 <- runTest(go.BP.CeO2.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3106 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.CeO2.time4 <- GenTable(go.BP.CeO2.time4, classic = result.fischer.CeO2.time4, topNodes = 20)
allRes.CeO2.time4
##         GO.ID                                        Term Annotated
## 1  GO:0044707       single-multicellular organism process      3827
## 2  GO:0051239 regulation of multicellular organismal p...      1592
## 3  GO:0032501            multicellular organismal process      3926
## 4  GO:0023052                                   signaling      3366
## 5  GO:0044700                   single organism signaling      3366
## 6  GO:0007165                         signal transduction      3060
## 7  GO:0007154                          cell communication      3437
## 8  GO:0007166     cell surface receptor signaling pathway      1632
## 9  GO:0003008                              system process       880
## 10 GO:0001503                                ossification       293
## 11 GO:0048731                          system development      2673
## 12 GO:0009888                          tissue development      1209
## 13 GO:0050896                        response to stimulus      4726
## 14 GO:0009653          anatomical structure morphogenesis      1689
## 15 GO:0022612                         gland morphogenesis        95
## 16 GO:0051716               cellular response to stimulus      3869
## 17 GO:0050793         regulation of developmental process      1395
## 18 GO:0030509                       BMP signaling pathway        82
## 19 GO:0048583          regulation of response to stimulus      2131
## 20 GO:0060429                      epithelium development       711
##    Significant Expected classic
## 1          156   103.27 1.8e-09
## 2           81    42.96 9.0e-09
## 3          156   105.95 1.2e-08
## 4          138    90.83 2.3e-08
## 5          138    90.83 2.3e-08
## 6          128    82.58 3.2e-08
## 7          139    92.75 4.9e-08
## 8           80    44.04 5.9e-08
## 9           52    23.75 7.0e-08
## 10          26     7.91 1.0e-07
## 11         112    72.13 3.4e-07
## 12          62    32.63 5.5e-07
## 13         172   127.54 9.1e-07
## 14          78    45.58 1.0e-06
## 15          13     2.56 1.5e-06
## 16         146   104.41 1.6e-06
## 17          67    37.65 1.9e-06
## 18          12     2.21 1.9e-06
## 19          91    57.51 3.1e-06
## 20          41    19.19 3.6e-06
showSigOfNodes(go.BP.CeO2.time4, score(result.fischer.CeO2.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 19 
## Number of Edges = 27 
## 
## $complete.dag
## [1] "A graph with 19 nodes."
CeO2.time7.pval.both <- limmaTopGenes(fit.CeO2.time7, dir="both") 
go.BP.CeO2.time7 <- new("topGOdata", description="GO annotation CeO2 time 7", ontology="BP", allGenes = CeO2.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.CeO2.time7 <- runTest(go.BP.CeO2.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3761 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.CeO2.time7 <- GenTable(go.BP.CeO2.time7, classic = result.fischer.CeO2.time7, topNodes = 20)
allRes.CeO2.time7
##         GO.ID                                        Term Annotated
## 1  GO:0044707       single-multicellular organism process      3827
## 2  GO:0032501            multicellular organismal process      3926
## 3  GO:0048731                          system development      2673
## 4  GO:0048856            anatomical structure development      3206
## 5  GO:0007275        multicellular organismal development      3069
## 6  GO:0044699                     single-organism process      8653
## 7  GO:0007154                          cell communication      3437
## 8  GO:0032502                       developmental process      3587
## 9  GO:0048513                           organ development      1970
## 10 GO:0030154                        cell differentiation      2359
## 11 GO:0044767       single-organism developmental process      3564
## 12 GO:0023052                                   signaling      3366
## 13 GO:0044700                   single organism signaling      3366
## 14 GO:0007165                         signal transduction      3060
## 15 GO:0046903                                   secretion       574
## 16 GO:0009653          anatomical structure morphogenesis      1689
## 17 GO:0051239 regulation of multicellular organismal p...      1592
## 18 GO:0050896                        response to stimulus      4726
## 19 GO:0007166     cell surface receptor signaling pathway      1632
## 20 GO:0048869              cellular developmental process      2536
##    Significant Expected classic
## 1          297   212.66 7.3e-12
## 2          301   218.16 2.2e-11
## 3          220   148.53 9.4e-11
## 4          248   178.15 1.9e-09
## 5          237   170.54 6.4e-09
## 6          552   480.83 1.5e-08
## 7          257   190.99 2.3e-08
## 8          266   199.32 2.5e-08
## 9          164   109.47 2.6e-08
## 10         189   131.08 3.0e-08
## 11         264   198.04 3.2e-08
## 12         251   187.04 4.9e-08
## 13         251   187.04 4.9e-08
## 14         232   170.04 5.3e-08
## 15          64    31.90 6.7e-08
## 16         143    93.85 9.4e-08
## 17         136    88.46 1.2e-07
## 18         330   262.61 1.2e-07
## 19         138    90.69 1.8e-07
## 20         196   140.92 2.4e-07
showSigOfNodes(go.BP.CeO2.time7, score(result.fischer.CeO2.time7), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 15 
## Number of Edges = 21 
## 
## $complete.dag
## [1] "A graph with 15 nodes."
SDC.time1.pval.both <- limmaTopGenes(fit.SDC.time1, dir="both") 
go.BP.SDC.time1 <- new("topGOdata", description="GO annotation SDC time 1", ontology="BP", allGenes = SDC.time1.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.SDC.time1 <- runTest(go.BP.SDC.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 2857 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.SDC.time1 <- GenTable(go.BP.SDC.time1, classic = result.fischer.SDC.time1, topNodes = 20)
all.res.SDC.time1
##         GO.ID                                        Term Annotated
## 1  GO:0006119                   oxidative phosphorylation        31
## 2  GO:0060740     prostate gland epithelium morphogenesis        25
## 3  GO:0060512                prostate gland morphogenesis        26
## 4  GO:0006935                                  chemotaxis       291
## 5  GO:0010035             response to inorganic substance       219
## 6  GO:0042330                                       taxis       292
## 7  GO:0030850                  prostate gland development        40
## 8  GO:0071621                      granulocyte chemotaxis        40
## 9  GO:0071241    cellular response to inorganic substance        58
## 10 GO:0022612                         gland morphogenesis        95
## 11 GO:0097530                       granulocyte migration        43
## 12 GO:0060560 developmental growth involved in morphog...       137
## 13 GO:0048589                        developmental growth       254
## 14 GO:0007155                               cell adhesion       697
## 15 GO:0022610                         biological adhesion       702
## 16 GO:0050921           positive regulation of chemotaxis        62
## 17 GO:0050795                      regulation of behavior       123
## 18 GO:0030593                       neutrophil chemotaxis        32
## 19 GO:1990266                        neutrophil migration        32
## 20 GO:0097529                 myeloid leukocyte migration        66
##    Significant Expected classic
## 1            6     0.78 0.00011
## 2            5     0.63 0.00034
## 3            5     0.65 0.00042
## 4           18     7.33 0.00042
## 5           15     5.51 0.00044
## 6           18     7.35 0.00044
## 7            6     1.01 0.00045
## 8            6     1.01 0.00045
## 9            7     1.46 0.00060
## 10           9     2.39 0.00064
## 11           6     1.08 0.00068
## 12          11     3.45 0.00069
## 13          16     6.39 0.00072
## 14          32    17.55 0.00076
## 15          32    17.67 0.00085
## 16           7     1.56 0.00090
## 17          10     3.10 0.00109
## 18           5     0.81 0.00113
## 19           5     0.81 0.00113
## 20           7     1.66 0.00131
showSigOfNodes(go.BP.SDC.time1, score(result.fischer.SDC.time1), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 93 
## Number of Edges = 168 
## 
## $complete.dag
## [1] "A graph with 93 nodes."
SDC.time4.pval.both <- limmaTopGenes(fit.SDC.time4, dir="both") 
go.BP.SDC.time4 <- new("topGOdata", description="GO annotation SDC time 4", ontology="BP", allGenes = SDC.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.SDC.time4 <- runTest(go.BP.SDC.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 2925 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.SDC.time4 <- GenTable(go.BP.SDC.time4, classic = result.fischer.SDC.time4, topNodes = 20)
allRes.SDC.time4
##         GO.ID                                        Term Annotated
## 1  GO:0003008                              system process       880
## 2  GO:0009888                          tissue development      1209
## 3  GO:0061448               connective tissue development       160
## 4  GO:0044057                regulation of system process       255
## 5  GO:0051239 regulation of multicellular organismal p...      1592
## 6  GO:0044707       single-multicellular organism process      3827
## 7  GO:0060429                      epithelium development       711
## 8  GO:0006936                          muscle contraction       148
## 9  GO:0048729                        tissue morphogenesis       426
## 10 GO:0009653          anatomical structure morphogenesis      1689
## 11 GO:0090257         regulation of muscle system process       110
## 12 GO:0043270        positive regulation of ion transport       116
## 13 GO:0032501            multicellular organismal process      3926
## 14 GO:0006937            regulation of muscle contraction        77
## 15 GO:0001503                                ossification       293
## 16 GO:0003012                       muscle system process       188
## 17 GO:0009605               response to external stimulus      1027
## 18 GO:0001656                     metanephros development        51
## 19 GO:0051480           cytosolic calcium ion homeostasis       129
## 20 GO:0043269                 regulation of ion transport       348
##    Significant Expected classic
## 1           42    15.26 1.7e-09
## 2           50    20.96 4.7e-09
## 3           16     2.77 1.8e-08
## 4           19     4.42 9.9e-08
## 5           56    27.60 1.4e-07
## 6          103    66.35 2.1e-07
## 7           33    12.33 2.2e-07
## 8           14     2.57 2.8e-07
## 9           24     7.39 3.9e-07
## 10          57    29.28 4.3e-07
## 11          12     1.91 4.4e-07
## 12          12     2.01 7.8e-07
## 13         103    68.07 8.0e-07
## 14          10     1.34 8.1e-07
## 15          19     5.08 8.5e-07
## 16          15     3.26 9.7e-07
## 17          40    17.81 1.0e-06
## 18           8     0.88 2.4e-06
## 19          12     2.24 2.4e-06
## 20          20     6.03 2.8e-06
showSigOfNodes(go.BP.SDC.time4, score(result.fischer.SDC.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 19 
## Number of Edges = 25 
## 
## $complete.dag
## [1] "A graph with 19 nodes."
SDC.time7.pval.both <- limmaTopGenes(fit.SDC.time7, dir="both") 
go.BP.SDC.time7 <- new("topGOdata", description="GO annotation SDC time 7", ontology="BP", allGenes = SDC.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.SDC.time7 <- runTest(go.BP.SDC.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 2346 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.SDC.time7 <- GenTable(go.BP.SDC.time7, classic = result.fischer.SDC.time7, topNodes = 20)
allRes.SDC.time7
##         GO.ID                                        Term Annotated
## 1  GO:0051239 regulation of multicellular organismal p...      1592
## 2  GO:0010628      positive regulation of gene expression      1014
## 3  GO:0040011                                  locomotion       935
## 4  GO:0042221                        response to chemical      1795
## 5  GO:0008284 positive regulation of cell proliferatio...       531
## 6  GO:0009888                          tissue development      1209
## 7  GO:0030154                        cell differentiation      2359
## 8  GO:0035914        skeletal muscle cell differentiation        55
## 9  GO:0007155                               cell adhesion       697
## 10 GO:0022610                         biological adhesion       702
## 11 GO:0016337        single organismal cell-cell adhesion       230
## 12 GO:0008283                          cell proliferation      1184
## 13 GO:0042127            regulation of cell proliferation       947
## 14 GO:0048870                               cell motility       784
## 15 GO:0051674                        localization of cell       784
## 16 GO:0006836                  neurotransmitter transport        93
## 17 GO:0048145      regulation of fibroblast proliferation        66
## 18 GO:0048144                    fibroblast proliferation        67
## 19 GO:0006928                 cellular component movement      1044
## 20 GO:0048731                          system development      2673
##    Significant Expected classic
## 1           40    18.25 1.1e-06
## 2           29    11.62 3.8e-06
## 3           27    10.72 7.3e-06
## 4           41    20.57 8.4e-06
## 5           19     6.09 1.1e-05
## 6           31    13.86 1.6e-05
## 7           48    27.04 2.6e-05
## 8            6     0.63 3.8e-05
## 9           21     7.99 4.7e-05
## 10          21     8.05 5.2e-05
## 11          11     2.64 6.9e-05
## 12          29    13.57 7.0e-05
## 13          25    10.85 7.4e-05
## 14          22     8.99 8.7e-05
## 15          22     8.99 8.7e-05
## 16           7     1.07 9.4e-05
## 17           6     0.76 0.00011
## 18           6     0.77 0.00012
## 19          26    11.97 0.00014
## 20          50    30.64 0.00016
showSigOfNodes(go.BP.SDC.time7, score(result.fischer.SDC.time7), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 46 
## Number of Edges = 73 
## 
## $complete.dag
## [1] "A graph with 46 nodes."
NAC.time1.pval.both <- limmaTopGenes(fit.NAC.time1, dir="both") 
go.BP.NAC.time1 <- new("topGOdata", description="GO annotation NAC time 1", ontology="BP", allGenes = NAC.time1.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.NAC.time1 <- runTest(go.BP.NAC.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3484 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.NAC.time1 <- GenTable(go.BP.NAC.time1, classic = result.fischer.NAC.time1, topNodes = 20)
all.res.NAC.time1
##         GO.ID                                        Term Annotated
## 1  GO:0044707       single-multicellular organism process      3827
## 2  GO:0032501            multicellular organismal process      3926
## 3  GO:0051239 regulation of multicellular organismal p...      1592
## 4  GO:0032502                       developmental process      3587
## 5  GO:0048731                          system development      2673
## 6  GO:0009888                          tissue development      1209
## 7  GO:0044767       single-organism developmental process      3564
## 8  GO:0007275        multicellular organismal development      3069
## 9  GO:0050793         regulation of developmental process      1395
## 10 GO:0048856            anatomical structure development      3206
## 11 GO:0003008                              system process       880
## 12 GO:0048513                           organ development      1970
## 13 GO:2000026 regulation of multicellular organismal d...      1072
## 14 GO:0009653          anatomical structure morphogenesis      1689
## 15 GO:0050896                        response to stimulus      4726
## 16 GO:0030154                        cell differentiation      2359
## 17 GO:0045595          regulation of cell differentiation      1015
## 18 GO:0010941                    regulation of cell death      1038
## 19 GO:0042221                        response to chemical      1795
## 20 GO:0051094 positive regulation of developmental pro...       649
##    Significant Expected classic
## 1          199   123.82 7.8e-15
## 2          199   127.02 1.2e-13
## 3          106    51.51 1.3e-13
## 4          184   116.05 7.8e-13
## 5          149    86.48 8.1e-13
## 6           86    39.12 1.5e-12
## 7          182   115.31 1.8e-12
## 8          161    99.29 1.0e-11
## 9           92    45.13 1.5e-11
## 10         164   103.73 4.6e-11
## 11          66    28.47 9.9e-11
## 12         113    63.74 2.8e-10
## 13          74    34.68 2.9e-10
## 14         100    54.65 7.7e-10
## 15         214   152.91 9.3e-10
## 16         127    76.32 9.4e-10
## 17          70    32.84 1.0e-09
## 18          71    33.58 1.1e-09
## 19         104    58.08 1.1e-09
## 20          52    21.00 1.3e-09
showSigOfNodes(go.BP.NAC.time1, score(result.fischer.NAC.time1), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 14 
## Number of Edges = 19 
## 
## $complete.dag
## [1] "A graph with 14 nodes."
NAC.time4.pval.both <- limmaTopGenes(fit.NAC.time4, dir="both") 
go.BP.NAC.time4 <- new("topGOdata", description="GO annotation NAC time 4", ontology="BP", allGenes = NAC.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.NAC.time4 <- runTest(go.BP.NAC.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3094 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.NAC.time4 <- GenTable(go.BP.NAC.time4, classic = result.fischer.NAC.time4, topNodes = 20)
allRes.NAC.time4
##         GO.ID                                        Term Annotated
## 1  GO:0050793         regulation of developmental process      1395
## 2  GO:0051239 regulation of multicellular organismal p...      1592
## 3  GO:2000026 regulation of multicellular organismal d...      1072
## 4  GO:0044707       single-multicellular organism process      3827
## 5  GO:0048731                          system development      2673
## 6  GO:0032501            multicellular organismal process      3926
## 7  GO:0009888                          tissue development      1209
## 8  GO:0007275        multicellular organismal development      3069
## 9  GO:0045595          regulation of cell differentiation      1015
## 10 GO:0048856            anatomical structure development      3206
## 11 GO:0070887      cellular response to chemical stimulus      1205
## 12 GO:0009605               response to external stimulus      1027
## 13 GO:0051093 negative regulation of developmental pro...       513
## 14 GO:0003008                              system process       880
## 15 GO:1901342       regulation of vasculature development       140
## 16 GO:0048514                  blood vessel morphogenesis       364
## 17 GO:0048519 negative regulation of biological proces...      2851
## 18 GO:0030154                        cell differentiation      2359
## 19 GO:0032502                       developmental process      3587
## 20 GO:0051094 positive regulation of developmental pro...       649
##    Significant Expected classic
## 1           64    24.79 5.1e-13
## 2           69    28.29 7.1e-13
## 3           54    19.05 1.5e-12
## 4          118    68.02 6.4e-12
## 5           93    47.51 7.4e-12
## 6          118    69.78 3.9e-11
## 7           54    21.49 1.5e-10
## 8           98    54.55 2.4e-10
## 9           48    18.04 3.0e-10
## 10         100    56.98 5.3e-10
## 11          52    21.42 1.2e-09
## 12          47    18.25 1.4e-09
## 13          31     9.12 2.4e-09
## 14          42    15.64 3.6e-09
## 15          16     2.49 3.7e-09
## 16          25     6.47 7.5e-09
## 17          89    50.67 8.9e-09
## 18          78    41.93 9.8e-09
## 19         104    63.75 1.3e-08
## 20          34    11.53 1.4e-08
showSigOfNodes(go.BP.NAC.time4, score(result.fischer.NAC.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 21 
## Number of Edges = 33 
## 
## $complete.dag
## [1] "A graph with 21 nodes."
NAC.time7.pval.both <- limmaTopGenes(fit.NAC.time7, dir="both") 
go.BP.NAC.time7 <- new("topGOdata", description="GO annotation NAC time 7", ontology="BP", allGenes = NAC.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 8852 GO terms found. )
## 
## Build GO DAG topology .......... ( 12170 GO terms and 28213 relations. )
## 
## Annotating nodes ............... ( 13785 genes annotated to the GO terms. )
result.fischer.NAC.time7 <- runTest(go.BP.NAC.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 3285 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.NAC.time7 <- GenTable(go.BP.NAC.time7, classic = result.fischer.NAC.time7, topNodes = 20)
allRes.NAC.time7
##         GO.ID                                        Term Annotated
## 1  GO:0003008                              system process       880
## 2  GO:0044707       single-multicellular organism process      3827
## 3  GO:0032501            multicellular organismal process      3926
## 4  GO:0022610                         biological adhesion       702
## 5  GO:0007155                               cell adhesion       697
## 6  GO:0050877                 neurological system process       556
## 7  GO:0009653          anatomical structure morphogenesis      1689
## 8  GO:0048731                          system development      2673
## 9  GO:0009888                          tissue development      1209
## 10 GO:0006811                               ion transport       859
## 11 GO:0007610                                    behavior       439
## 12 GO:0051239 regulation of multicellular organismal p...      1592
## 13 GO:0007154                          cell communication      3437
## 14 GO:0023052                                   signaling      3366
## 15 GO:0044700                   single organism signaling      3366
## 16 GO:0050806 positive regulation of synaptic transmis...        55
## 17 GO:0009887                         organ morphogenesis       616
## 18 GO:0007275        multicellular organismal development      3069
## 19 GO:0048729                        tissue morphogenesis       426
## 20 GO:2000026 regulation of multicellular organismal d...      1072
##    Significant Expected classic
## 1           71    29.05 1.4e-12
## 2          192   126.32 1.2e-11
## 3          195   129.59 1.9e-11
## 4           59    23.17 2.8e-11
## 5           58    23.01 6.2e-11
## 6           48    18.35 9.6e-10
## 7           99    55.75 5.0e-09
## 8          138    88.23 9.0e-09
## 9           77    39.91 1.2e-08
## 10          60    28.35 2.5e-08
## 11          38    14.49 5.6e-08
## 12          91    52.55 8.2e-08
## 13         163   113.44 9.5e-08
## 14         160   111.10 1.2e-07
## 15         160   111.10 1.2e-07
## 16          12     1.82 1.7e-07
## 17          46    20.33 1.8e-07
## 18         148   101.30 1.9e-07
## 19          36    14.06 2.3e-07
## 20          67    35.38 2.5e-07
showSigOfNodes(go.BP.NAC.time7, score(result.fischer.NAC.time7), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 20 
## Number of Edges = 25 
## 
## $complete.dag
## [1] "A graph with 20 nodes."