GOseq: Determining ENSG IDs Associated with Genes Summarized by `numDEInCat` for Each Ontology Term
1
0
Entering edit mode
JMallory • 0
@jmallory-13488
Last seen 5.6 years ago

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?   

 

 

  

 

 

goseq gene ontology • 3.2k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
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,]
    out
    }

And as an example, do

example(goseq)
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 bias.data       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 COMMENT
0
Entering edit mode

Spot on. Thanks very much James. 

ADD REPLY

Login before adding your answer.

Traffic: 489 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6