Question: GOseq: Determining ENSG IDs Associated with Genes Summarized by `numDEInCat` for Each Ontology Term
gravatar for JMallory
7 months ago by
JMallory0 wrote:

I have successfully conducted a gene ontology analysis using goseq. In presenting the findings of the analysis (i.e., the standard output generated by the `goseq` function) to a colleague, he quite reasonably asked which genes present in the vector passed to the `pwf` function were those associated with any given significant GO or KEGG term arising as output of the `goseq` function.

The columns `numDEInCat` and `numInCat` clearly summarize this information (i.e., as counts) in the output of `goseq`. I would like to know the ENSG IDs associated with the counts summarized by `numDEInCat` for each ontology term identified. What would be the most effective way to do this?   






ADD COMMENTlink modified 7 months ago by James W. MacDonald46k • written 7 months ago by JMallory0
gravatar for James W. MacDonald
7 months ago by
United States
James W. MacDonald46k wrote:
getGenes <- function(pwf, goterm, genome, ids){
    gene2cat <-  getgo(rownames(pwf), genome, ids)
    cat2gene <- split(rep(names(gene2cat), sapply(gene2cat, length)),
                      unlist(gene2cat, use.names = FALSE))
    out <- pwf[cat2gene[[goterm]],]
    out <- out[out$DEgenes > 0,]

And as an example, do

goterm <- pvals$category[1]
gns <- getGenes(pwf, goterm, "hg19","ensGene")

> dim(gns)
[1] 2113    3
> pvals[1,]
        category over_represented_pvalue under_represented_pvalue numDEInCat
11125 GO:0044699            2.042153e-11                        1       2113
      numInCat                    term ontology
11125     9122 single-organism process       BP
> head(gns)
                DEgenes       pwf
ENSG00000101444       1    1314.0 0.1619498
ENSG00000101333       1    4038.0 0.2271704
ENSG00000101187       1    2676.0 0.1982360
ENSG00000198959       1    1025.0 0.1429764
ENSG00000124181       1    5522.0 0.2282210
ENSG00000132821       1    1825.5 0.1752253




ADD COMMENTlink written 7 months ago by James W. MacDonald46k

Spot on. Thanks very much James. 

ADD REPLYlink written 7 months ago by JMallory0
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: 343 users visited in the last hour