This is a test version of Biostars. For the public version, visit https://www.biostars.org.
results of topGO

Hi

Please guide me. I followed the following code ( script) for calculating the gene enrichment of my gene list, as you can see, I have to prepare gene2GO as a map for my gene list. But when I received the result of top GOdata and GO enrichment. I found out that some of my top GO terms don't exist in my gene2GO vector. I don't know how they appear in my results.

library(topGO)
library(GO.db)
library(AnnotationDbi)
library(S4Vectors)
library(ALL)
library(Rgraphviz)
library(ggplot2)
library(RColorBrewer)
library(wesanderson)
library(viridis)
library(tidyverse)
setwd("C:/Users/azadeh/Desktop/PHD_thesis/resaults/topGO")


#prepare gene2GO####

gene.go <- read.delim("GO_Gene.txt", stringsAsFactors = F)
head(gene.go)
gene.go <- gene.go[which(gene.go$GO !="" ),] # take out genes without GO terms
gene2GO <- tapply(gene.go$GO, gene.go$geneID, function(x)x)
geneuniver <- names(gene2GO)
print(geneuniver)

#gene list of all chromosomes for regions with Tajima's D value between -1.5 and -2 #####
#Enter the gene of the desired list as a list of characters 
##belowe methode make a vector from your gene list because, GOdata needs vector format to calculate GO enrichment

gene<- read.delim("genelist_allchr.txt", stringsAsFactors = F)
gene<- as.character(gene$Gene_ID)
genelist<- factor(as.integer(geneuniver%in% gene))
names(genelist)<- geneuniver

print(genelist)


#prepare GOdata according to Biological Process####

GOdata <- new("topGOdata",
              ontology = "BP",
              allGenes = genelist,
              geneSelectionFun=function(x)(x==1),
              annot =  annFUN.gene2GO, gene2GO=gene2GO)
print(GOdata)

resultFisher <- runTest(GOdata, algorithm = "elim", statistic = "fisher")

tab <- GenTable(GOdata, raw.p.value = resultFisher, topNodes = length(resultFisher@score),
                numChar = 120)
head(tab)
topgo go-term go-id gene2go

0 answers

No answers yet.

Log in to answer this question.