Question: How to get genes corresponding to a GO term from topGOData object?
gravatar for rishi.dasroy
23 months ago by
rishi.dasroy10 wrote:


I have a topGOdata object which is built with following command

> GOdata <- new("topGOdata",
                     description = "Simple session", ontology = "BP",
                     allGenes = na.omit(t), geneSel = topDiffGenes,
                     nodeSize = 10, annot = annFUN.gene2GO, gene2GO = microGeneID2GO)

> resultFisher <- runTest(GOdata, algorithm = "classic", statistic = "fisher")
> resultKS <- runTest(GOdata, algorithm = "classic", statistic = "ks")
> resultKS.elim <- runTest(GOdata, algorithm = "elim", statistic = "ks")
> allRes_topDiffGenes_.05 <- GenTable(GOdata, classicFisher = resultFisher,
                   classicKS = resultKS, elimKS = resultKS.elim,
                   orderBy = "elimKS",  ranksOf = "classicFisher", topNodes = 11)

With the help of following termStat ,

> termStat(GOdata,"GO:0051797")
           Annotated Significant Expected
GO:0051797        11          10     1.98

Now how can I extract the list of annotated and significant genes correspond to GO:0051797? I am getting following errors

> printGenes(GOdata,whichTerms = "GO:0051797")
Error in sub(".db$", "", chip) :
argument "chip" is missing, with no default

Please help,


> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

 [1] LC_CTYPE=fi_FI.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB          
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB          LC_PAPER=en_GB.UTF-8       LC_NAME=C                 

attached base packages:
 [1] stats4    parallel  grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] GOplot_1.0.1         genefilter_1.52.1   plyr_1.8.3           RColorBrewer_1.1-2   gridExtra_2.2.1     
 [7] ggdendro_0.1-18      ggplot2_2.1.0        ROCR_1.0-7           gplots_2.17.0        topGO_2.22.0         SparseM_1.7         
[13] GO.db_3.2.2          RSQLite_1.0.0        DBI_0.3.1            AnnotationDbi_1.32.3 IRanges_2.4.8        S4Vectors_0.8.11    
[19] Biobase_2.30.0       graph_1.48.0         BiocGenerics_0.16.1  mGSZm_1.0            limma_3.26.8         GenomeGraphs_1.30.0
[25] biomaRt_2.26.1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3            lattice_0.20-33        listenv_0.6.0          gtools_3.5.0           digest_0.6.9          
 [6] aroma.core_3.0.0       R.devices_2.14.0       R.huge_0.9.0           BiocInstaller_1.20.1   zlibbioc_1.16.0       
[11] annotate_1.48.0        gdata_2.17.0           R.utils_2.2.0          R.oo_1.20.0            preprocessCore_1.32.0
[16] labeling_0.3           splines_3.2.2          RCurl_1.95-4.8         munsell_0.4.3          base64enc_0.1-3       
[21] aroma.apd_0.6.0        R.rsp_0.21.0           globals_0.6.1          DNAcopy_1.44.0         codetools_0.2-14      
[26] matrixStats_0.50.1     XML_3.98-1.4           future_0.12.0          MASS_7.3-45            bitops_1.0-6          
[31] R.methodsS3_1.7.1      xtable_1.8-2           gtable_0.2.0           affy_1.48.0            scales_0.4.0          
[36] KernSmooth_2.23-15     aroma.affymetrix_3.0.0 PSCBS_0.61.0           affyio_1.40.0          R.filesets_2.10.0     
[41] tools_3.2.2            Cairo_1.5-9            R.cache_0.12.0         survival_2.38-3        colorspace_1.2-6      
[46] caTools_1.17.1      


ADD COMMENTlink modified 7 months ago by mt10220 • written 23 months ago by rishi.dasroy10
gravatar for mt1022
7 months ago by
mt10220 wrote:

By looking through its source code, I find a workaround:

go.ids <-  "GO:0051797"
# extract annotated genes in each term -> a list
term.genes <- genesInTerm(, go.ids)
# extract scores for genes in each term
term.gene.scores <- lapply(term.genes, function(x) stack(geneScore(, x)))




ADD COMMENTlink modified 7 months ago • written 7 months ago by mt10220
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 209 users visited in the last hour