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 MF 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.MF.CeO2.time1 <- new("topGOdata", description="GO annotation CeO2 time 1", ontology="MF", 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
##  ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.Ceo2.time1 <- runTest(go.MF.CeO2.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 873 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.CeO2.time1 <- GenTable(go.MF.CeO2.time1, classic = result.fischer.Ceo2.time1, topNodes = 20)
all.res.CeO2.time1
##         GO.ID                                        Term Annotated
## 1  GO:0005509                         calcium ion binding       369
## 2  GO:0017154                semaphorin receptor activity        10
## 3  GO:0005198                structural molecule activity       336
## 4  GO:0030414                peptidase inhibitor activity        88
## 5  GO:0061134                peptidase regulator activity       117
## 6  GO:0005201 extracellular matrix structural constitu...        24
## 7  GO:0032403                     protein complex binding       745
## 8  GO:0005102                            receptor binding       874
## 9  GO:0005515                             protein binding      5679
## 10 GO:0004857                   enzyme inhibitor activity       193
## 11 GO:0004872                           receptor activity       566
## 12 GO:0005507                          copper ion binding        41
## 13 GO:0003735          structural constituent of ribosome       125
## 14 GO:0005178                            integrin binding        69
## 15 GO:0038023                 signaling receptor activity       449
## 16 GO:0004888 transmembrane signaling receptor activit...       388
## 17 GO:0035591                  signaling adaptor activity        27
## 18 GO:0071889                      14-3-3 protein binding        17
## 19 GO:0003774                              motor activity        95
## 20 GO:0001948                        glycoprotein binding        68
##    Significant Expected classic
## 1           36    14.48 4.6e-07
## 2            5     0.39 2.0e-05
## 3           28    13.19 0.00015
## 4           12     3.45 0.00016
## 5           14     4.59 0.00019
## 6            6     0.94 0.00026
## 7           49    29.24 0.00026
## 8           55    34.30 0.00034
## 9          260   222.90 0.00057
## 10          18     7.58 0.00060
## 11          38    22.22 0.00088
## 12           7     1.61 0.00097
## 13          13     4.91 0.00125
## 14           9     2.71 0.00144
## 15          31    17.62 0.00167
## 16          27    15.23 0.00291
## 17           5     1.06 0.00360
## 18           4     0.67 0.00371
## 19          10     3.73 0.00405
## 20           8     2.67 0.00499
showSigOfNodes(go.MF.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 = 21 
## Number of Edges = 22 
## 
## $complete.dag
## [1] "A graph with 21 nodes."
CeO2.time4.pval.both <- limmaTopGenes(fit.CeO2.time4, dir="both") 
go.MF.CeO2.time4 <- new("topGOdata", description="GO annotation CeO2 time 4", ontology="MF", allGenes = CeO2.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.CeO2.time4 <- runTest(go.MF.CeO2.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 680 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.CeO2.time4 <- GenTable(go.MF.CeO2.time4, classic = result.fischer.CeO2.time4, topNodes = 20)
allRes.CeO2.time4
##         GO.ID                                        Term Annotated
## 1  GO:0004872                           receptor activity       566
## 2  GO:0001968                         fibronectin binding        24
## 3  GO:0004888 transmembrane signaling receptor activit...       388
## 4  GO:0004930         G-protein coupled receptor activity       183
## 5  GO:0038023                 signaling receptor activity       449
## 6  GO:0022843       voltage-gated cation channel activity        81
## 7  GO:0008201                             heparin binding        86
## 8  GO:0005244          voltage-gated ion channel activity       107
## 9  GO:0022832              voltage-gated channel activity       107
## 10 GO:0005515                             protein binding      5679
## 11 GO:0005539                   glycosaminoglycan binding       115
## 12 GO:0019838                       growth factor binding        98
## 13 GO:0050839              cell adhesion molecule binding       121
## 14 GO:0004871                  signal transducer activity       672
## 15 GO:0060089               molecular transducer activity       672
## 16 GO:0005509                         calcium ion binding       369
## 17 GO:0005520          insulin-like growth factor binding        21
## 18 GO:0005178                            integrin binding        69
## 19 GO:0016208                                 AMP binding        11
## 20 GO:0005261                     cation channel activity       154
##    Significant Expected classic
## 1           34    15.00 7.4e-06
## 2            6     0.64 3.0e-05
## 3           25    10.29 4.0e-05
## 4           15     4.85 0.00011
## 5           26    11.90 0.00016
## 6            9     2.15 0.00028
## 7            9     2.28 0.00045
## 8           10     2.84 0.00054
## 9           10     2.84 0.00054
## 10         181   150.54 0.00065
## 11          10     3.05 0.00096
## 12           9     2.60 0.00116
## 13          10     3.21 0.00141
## 14          31    17.81 0.00193
## 15          31    17.81 0.00193
## 16          20     9.78 0.00203
## 17           4     0.56 0.00203
## 18           7     1.83 0.00228
## 19           3     0.29 0.00260
## 20          11     4.08 0.00268
showSigOfNodes(go.MF.CeO2.time4, score(result.fischer.CeO2.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 31 
## Number of Edges = 39 
## 
## $complete.dag
## [1] "A graph with 31 nodes."
CeO2.time7.pval.both <- limmaTopGenes(fit.CeO2.time7, dir="both") 
go.MF.CeO2.time7 <- new("topGOdata", description="GO annotation CeO2 time 7", ontology="MF", allGenes = CeO2.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.CeO2.time7 <- runTest(go.MF.CeO2.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 956 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.CeO2.time7 <- GenTable(go.MF.CeO2.time7, classic = result.fischer.CeO2.time7, topNodes = 20)
allRes.CeO2.time7
##         GO.ID                                        Term Annotated
## 1  GO:0005515                             protein binding      5679
## 2  GO:0004871                  signal transducer activity       672
## 3  GO:0060089               molecular transducer activity       672
## 4  GO:0004872                           receptor activity       566
## 5  GO:0038023                 signaling receptor activity       449
## 6  GO:0005102                            receptor binding       874
## 7  GO:0019838                       growth factor binding        98
## 8  GO:0050431     transforming growth factor beta binding        15
## 9  GO:0008083                      growth factor activity        82
## 10 GO:0004888 transmembrane signaling receptor activit...       388
## 11 GO:0005200      structural constituent of cytoskeleton        41
## 12 GO:0001078 RNA polymerase II core promoter proximal...        59
## 13 GO:0042802                   identical protein binding       894
## 14 GO:0005516                          calmodulin binding       122
## 15 GO:0008022                  protein C-terminus binding       159
## 16 GO:0015081 sodium ion transmembrane transporter act...        62
## 17 GO:0047485                  protein N-terminus binding        93
## 18 GO:0005539                   glycosaminoglycan binding       115
## 19 GO:0004896                  cytokine receptor activity        45
## 20 GO:0005509                         calcium ion binding       369
##    Significant Expected classic
## 1          409   318.97 1.1e-11
## 2           69    37.74 7.1e-07
## 3           69    37.74 7.1e-07
## 4           60    31.79 1.4e-06
## 5           48    25.22 1.3e-05
## 6           79    49.09 1.5e-05
## 7           17     5.50 2.9e-05
## 8            6     0.84 9.9e-05
## 9           14     4.61 0.00017
## 10          39    21.79 0.00030
## 11           9     2.30 0.00037
## 12          11     3.31 0.00038
## 13          74    50.21 0.00045
## 14          17     6.85 0.00046
## 15          20     8.93 0.00059
## 16          11     3.48 0.00060
## 17          14     5.22 0.00065
## 18          16     6.46 0.00068
## 19           9     2.53 0.00076
## 20          36    20.73 0.00088
showSigOfNodes(go.MF.CeO2.time7, score(result.fischer.CeO2.time7), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 13 
## Number of Edges = 14 
## 
## $complete.dag
## [1] "A graph with 13 nodes."
SDC.time1.pval.both <- limmaTopGenes(fit.SDC.time1, dir="both") 
go.MF.SDC.time1 <- new("topGOdata", description="GO annotation SDC time 1", ontology="MF", allGenes = SDC.time1.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.SDC.time1 <- runTest(go.MF.SDC.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 678 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.SDC.time1 <- GenTable(go.MF.SDC.time1, classic = result.fischer.SDC.time1, topNodes = 20)
all.res.SDC.time1
##         GO.ID                                        Term Annotated
## 1  GO:0005509                         calcium ion binding       369
## 2  GO:0005507                          copper ion binding        41
## 3  GO:0015078 hydrogen ion transmembrane transporter a...        64
## 4  GO:0036442          hydrogen-exporting ATPase activity        19
## 5  GO:0003735          structural constituent of ribosome       125
## 6  GO:0043236                             laminin binding        20
## 7  GO:0022891 substrate-specific transmembrane transpo...       493
## 8  GO:0019829         cation-transporting ATPase activity        52
## 9  GO:0042625 ATPase activity, coupled to transmembran...        53
## 10 GO:0008553 hydrogen-exporting ATPase activity, phos...        11
## 11 GO:0001968                         fibronectin binding        24
## 12 GO:0022857          transmembrane transporter activity       546
## 13 GO:0015075      ion transmembrane transporter activity       461
## 14 GO:0050840                extracellular matrix binding        40
## 15 GO:0022892     substrate-specific transporter activity       581
## 16 GO:0008324 cation transmembrane transporter activit...       351
## 17 GO:0022804 active transmembrane transporter activit...       193
## 18 GO:0008137    NADH dehydrogenase (ubiquinone) activity        26
## 19 GO:0050136       NADH dehydrogenase (quinone) activity        26
## 20 GO:0003954                 NADH dehydrogenase activity        27
##    Significant Expected classic
## 1           21     9.27 0.00043
## 2            6     1.03 0.00051
## 3            7     1.61 0.00108
## 4            4     0.48 0.00112
## 5           10     3.14 0.00121
## 6            4     0.50 0.00138
## 7           24    12.38 0.00155
## 8            6     1.31 0.00185
## 9            6     1.33 0.00204
## 10           3     0.28 0.00223
## 11           4     0.60 0.00279
## 12          25    13.71 0.00285
## 13          22    11.58 0.00306
## 14           5     1.00 0.00310
## 15          26    14.59 0.00321
## 16          18     8.82 0.00339
## 17          12     4.85 0.00353
## 18           4     0.65 0.00378
## 19           4     0.65 0.00378
## 20           4     0.68 0.00435
showSigOfNodes(go.MF.SDC.time1, score(result.fischer.SDC.time1), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 41 
## Number of Edges = 49 
## 
## $complete.dag
## [1] "A graph with 41 nodes."
SDC.time4.pval.both <- limmaTopGenes(fit.SDC.time4, dir="both") 
go.MF.SDC.time4 <- new("topGOdata", description="GO annotation SDC time 4", ontology="MF", allGenes = SDC.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.SDC.time4 <- runTest(go.MF.SDC.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 648 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.SDC.time4 <- GenTable(go.MF.SDC.time4, classic = result.fischer.SDC.time4, topNodes = 20)
allRes.SDC.time4
##         GO.ID                                        Term Annotated
## 1  GO:0001968                         fibronectin binding        24
## 2  GO:0005509                         calcium ion binding       369
## 3  GO:0008083                      growth factor activity        82
## 4  GO:0051183                vitamin transporter activity        13
## 5  GO:0043395        heparan sulfate proteoglycan binding        14
## 6  GO:0004872                           receptor activity       566
## 7  GO:0005539                   glycosaminoglycan binding       115
## 8  GO:0061134                peptidase regulator activity       117
## 9  GO:0030414                peptidase inhibitor activity        88
## 10 GO:0043394                        proteoglycan binding        19
## 11 GO:0004930         G-protein coupled receptor activity       183
## 12 GO:0005179                            hormone activity        39
## 13 GO:0005520          insulin-like growth factor binding        21
## 14 GO:0004620                      phospholipase activity        69
## 15 GO:0005178                            integrin binding        69
## 16 GO:0052689         carboxylic ester hydrolase activity       101
## 17 GO:0004867 serine-type endopeptidase inhibitor acti...        49
## 18 GO:0005044                 scavenger receptor activity        26
## 19 GO:0005125                           cytokine activity        78
## 20 GO:0016298                             lipase activity        78
##    Significant Expected classic
## 1            5     0.41 4.3e-05
## 2           17     6.24 0.00018
## 3            7     1.39 0.00047
## 4            3     0.22 0.00121
## 5            3     0.24 0.00152
## 6           20     9.57 0.00152
## 7            7     1.95 0.00338
## 8            7     1.98 0.00372
## 9            6     1.49 0.00375
## 10           3     0.32 0.00379
## 11           9     3.10 0.00397
## 12           4     0.66 0.00412
## 13           3     0.36 0.00507
## 14           5     1.17 0.00619
## 15           5     1.17 0.00619
## 16           6     1.71 0.00733
## 17           4     0.83 0.00932
## 18           3     0.44 0.00932
## 19           5     1.32 0.01030
## 20           5     1.32 0.01030
showSigOfNodes(go.MF.SDC.time4, score(result.fischer.SDC.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 24 
## Number of Edges = 27 
## 
## $complete.dag
## [1] "A graph with 24 nodes."
SDC.time7.pval.both <- limmaTopGenes(fit.SDC.time7, dir="both") 
go.MF.SDC.time7 <- new("topGOdata", description="GO annotation SDC time 7", ontology="MF", allGenes = SDC.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.SDC.time7 <- runTest(go.MF.SDC.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 625 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.SDC.time7 <- GenTable(go.MF.SDC.time7, classic = result.fischer.SDC.time7, topNodes = 20)
allRes.SDC.time7
##         GO.ID                                        Term Annotated
## 1  GO:0008083                      growth factor activity        82
## 2  GO:0043565               sequence-specific DNA binding       525
## 3  GO:0001077 RNA polymerase II core promoter proximal...       115
## 4  GO:0001071 nucleic acid binding transcription facto...       655
## 5  GO:0003700 sequence-specific DNA binding transcript...       655
## 6  GO:0000982 RNA polymerase II core promoter proximal...       167
## 7  GO:0000977 RNA polymerase II regulatory region sequ...       229
## 8  GO:0070412                              R-SMAD binding        20
## 9  GO:0001012 RNA polymerase II regulatory region DNA ...       235
## 10 GO:0001228 RNA polymerase II transcription regulato...       150
## 11 GO:0000981 sequence-specific DNA binding RNA polyme...       294
## 12 GO:0004872                           receptor activity       566
## 13 GO:0005102                            receptor binding       874
## 14 GO:0000975               regulatory region DNA binding       425
## 15 GO:0001067      regulatory region nucleic acid binding       425
## 16 GO:0000976 transcription regulatory region sequence...       271
## 17 GO:0019838                       growth factor binding        98
## 18 GO:0016653 oxidoreductase activity, acting on NAD(P...        11
## 19 GO:0023023                 MHC protein complex binding        11
## 20 GO:0023026        MHC class II protein complex binding        11
##    Significant Expected classic
## 1            7     0.94 4.3e-05
## 2           16     6.04 0.00036
## 3            7     1.32 0.00036
## 4           18     7.53 0.00053
## 5           18     7.53 0.00053
## 6            8     1.92 0.00069
## 7            9     2.63 0.00133
## 8            3     0.23 0.00147
## 9            9     2.70 0.00158
## 10           7     1.72 0.00173
## 11          10     3.38 0.00213
## 12          15     6.51 0.00222
## 13          20    10.05 0.00245
## 14          12     4.89 0.00370
## 15          12     4.89 0.00370
## 16           9     3.12 0.00412
## 17           5     1.13 0.00543
## 18           2     0.13 0.00675
## 19           2     0.13 0.00675
## 20           2     0.13 0.00675
showSigOfNodes(go.MF.SDC.time7, score(result.fischer.SDC.time7), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 24 
## Number of Edges = 28 
## 
## $complete.dag
## [1] "A graph with 24 nodes."
NAC.time1.pval.both <- limmaTopGenes(fit.NAC.time1, dir="both") 
go.MF.NAC.time1 <- new("topGOdata", description="GO annotation NAC time 1", ontology="MF", allGenes = NAC.time1.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.NAC.time1 <- runTest(go.MF.NAC.time1, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 794 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
all.res.NAC.time1 <- GenTable(go.MF.NAC.time1, classic = result.fischer.NAC.time1, topNodes = 20)
all.res.NAC.time1
##         GO.ID                                        Term Annotated
## 1  GO:0001968                         fibronectin binding        24
## 2  GO:0005515                             protein binding      5679
## 3  GO:0008201                             heparin binding        86
## 4  GO:0002020                            protease binding        72
## 5  GO:0005539                   glycosaminoglycan binding       115
## 6  GO:0005201 extracellular matrix structural constitu...        24
## 7  GO:0005518                            collagen binding        48
## 8  GO:0043236                             laminin binding        20
## 9  GO:1901681                     sulfur compound binding       148
## 10 GO:0019838                       growth factor binding        98
## 11 GO:0008083                      growth factor activity        82
## 12 GO:0004866            endopeptidase inhibitor activity        83
## 13 GO:0001071 nucleic acid binding transcription facto...       655
## 14 GO:0003700 sequence-specific DNA binding transcript...       655
## 15 GO:0038024                     cargo receptor activity        39
## 16 GO:0050840                extracellular matrix binding        40
## 17 GO:0003690                 double-stranded DNA binding       102
## 18 GO:0030414                peptidase inhibitor activity        88
## 19 GO:0061135            endopeptidase regulator activity        89
## 20 GO:0022843       voltage-gated cation channel activity        81
##    Significant Expected classic
## 1            9     0.78 3.2e-08
## 2          234   185.06 1.3e-06
## 3           13     2.80 3.9e-06
## 4           11     2.35 2.0e-05
## 5           13     3.75 9.3e-05
## 6            6     0.78 9.5e-05
## 7            8     1.56 0.00014
## 8            5     0.65 0.00037
## 9           13     4.82 0.00110
## 10          10     3.19 0.00132
## 11           9     2.67 0.00136
## 12           9     2.70 0.00148
## 13          36    21.34 0.00151
## 14          36    21.34 0.00151
## 15           6     1.27 0.00152
## 16           6     1.30 0.00173
## 17          10     3.32 0.00179
## 18           9     2.87 0.00224
## 19           9     2.90 0.00242
## 20           8     2.64 0.00480
showSigOfNodes(go.MF.NAC.time1, score(result.fischer.NAC.time1), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 19 
## Number of Edges = 21 
## 
## $complete.dag
## [1] "A graph with 19 nodes."
NAC.time4.pval.both <- limmaTopGenes(fit.NAC.time4, dir="both") 
go.MF.NAC.time4 <- new("topGOdata", description="GO annotation NAC time 4", ontology="MF", allGenes = NAC.time4.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.NAC.time4 <- runTest(go.MF.NAC.time4, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 524 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.NAC.time4 <- GenTable(go.MF.NAC.time4, classic = result.fischer.NAC.time4, topNodes = 20)
allRes.NAC.time4
##         GO.ID                                        Term Annotated
## 1  GO:0003690                 double-stranded DNA binding       102
## 2  GO:0005520          insulin-like growth factor binding        21
## 3  GO:0008083                      growth factor activity        82
## 4  GO:0004866            endopeptidase inhibitor activity        83
## 5  GO:0008201                             heparin binding        86
## 6  GO:0030414                peptidase inhibitor activity        88
## 7  GO:0061135            endopeptidase regulator activity        89
## 8  GO:0005539                   glycosaminoglycan binding       115
## 9  GO:0004867 serine-type endopeptidase inhibitor acti...        49
## 10 GO:1901681                     sulfur compound binding       148
## 11 GO:0019838                       growth factor binding        98
## 12 GO:0017017 MAP kinase tyrosine/serine/threonine pho...        36
## 13 GO:0033549             MAP kinase phosphatase activity        37
## 14 GO:0043566              structure-specific DNA binding       224
## 15 GO:0048156                         tau protein binding        11
## 16 GO:0005515                             protein binding      5679
## 17 GO:0061134                peptidase regulator activity       117
## 18 GO:0004857                   enzyme inhibitor activity       193
## 19 GO:0019955                            cytokine binding        56
## 20 GO:0071889                      14-3-3 protein binding        17
##    Significant Expected classic
## 1           10     1.79 1.2e-05
## 2            5     0.37 2.6e-05
## 3            8     1.44 9.4e-05
## 4            8     1.46 0.00010
## 5            8     1.51 0.00013
## 6            8     1.55 0.00016
## 7            8     1.56 0.00017
## 8            9     2.02 0.00019
## 9            6     0.86 0.00021
## 10          10     2.60 0.00029
## 11           8     1.72 0.00033
## 12           5     0.63 0.00039
## 13           5     0.65 0.00044
## 14          12     3.94 0.00061
## 15           3     0.19 0.00080
## 16         124    99.81 0.00094
## 17           8     2.06 0.00107
## 18          10     3.39 0.00220
## 19           5     0.98 0.00296
## 20           3     0.30 0.00304
showSigOfNodes(go.MF.NAC.time4, score(result.fischer.NAC.time4), firstSigNodes = 10, useInfo = 'all')

## $dag
## A graphNEL graph with directed edges
## Number of Nodes = 26 
## Number of Edges = 30 
## 
## $complete.dag
## [1] "A graph with 26 nodes."
NAC.time7.pval.both <- limmaTopGenes(fit.NAC.time7, dir="both") 
go.MF.NAC.time7 <- new("topGOdata", description="GO annotation NAC time 7", ontology="MF", allGenes = NAC.time7.pval.both, geneSel = topDiffGenes, nodeSize = 10, annot = annFUN.org, mapping="org.Mm.eg.db", ID = "Ensembl")
## 
## Building most specific GOs ..... ( 3874 GO terms found. )
## 
## Build GO DAG topology .......... ( 4287 GO terms and 5292 relations. )
## 
## Annotating nodes ............... ( 13656 genes annotated to the GO terms. )
result.fischer.NAC.time7 <- runTest(go.MF.NAC.time7, algorithm = "classic", statistic = "fisher")
## 
##           -- Classic Algorithm -- 
## 
##       the algorithm is scoring 787 nontrivial nodes
##       parameters: 
##           test statistic:  fisher
allRes.NAC.time7 <- GenTable(go.MF.NAC.time7, classic = result.fischer.NAC.time7, topNodes = 20)
allRes.NAC.time7
##         GO.ID                                        Term Annotated
## 1  GO:0004872                           receptor activity       566
## 2  GO:0050839              cell adhesion molecule binding       121
## 3  GO:0001968                         fibronectin binding        24
## 4  GO:0015081 sodium ion transmembrane transporter act...        62
## 5  GO:0005178                            integrin binding        69
## 6  GO:0019838                       growth factor binding        98
## 7  GO:0008201                             heparin binding        86
## 8  GO:0015370            solute:sodium symporter activity        22
## 9  GO:0050840                extracellular matrix binding        40
## 10 GO:0004888 transmembrane signaling receptor activit...       388
## 11 GO:0005539                   glycosaminoglycan binding       115
## 12 GO:1901681                     sulfur compound binding       148
## 13 GO:0015075      ion transmembrane transporter activity       461
## 14 GO:0015291 secondary active transmembrane transport...       110
## 15 GO:0022891 substrate-specific transmembrane transpo...       493
## 16 GO:0005102                            receptor binding       874
## 17 GO:0022857          transmembrane transporter activity       546
## 18 GO:0038023                 signaling receptor activity       449
## 19 GO:0005515                             protein binding      5679
## 20 GO:0005231 excitatory extracellular ligand-gated io...        21
##    Significant Expected classic
## 1           43    18.57 2.5e-07
## 2           17     3.97 4.2e-07
## 3            8     0.79 5.8e-07
## 4           12     2.03 6.5e-07
## 5           12     2.26 2.2e-06
## 6           14     3.21 3.6e-06
## 7           13     2.82 4.2e-06
## 8            7     0.72 4.3e-06
## 9            9     1.31 4.5e-06
## 10          31    12.73 4.6e-06
## 11          15     3.77 5.1e-06
## 12          17     4.86 7.1e-06
## 13          34    15.12 9.0e-06
## 14          14     3.61 1.4e-05
## 15          35    16.17 1.5e-05
## 16          52    28.67 2.1e-05
## 17          37    17.91 2.4e-05
## 18          32    14.73 3.3e-05
## 19         228   186.31 3.3e-05
## 20           6     0.69 4.3e-05
showSigOfNodes(go.MF.NAC.time7, score(result.fischer.NAC.time7), firstSigNodes = 10, useInfo = 'all')

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