extract significant gene list from specific GO namber
1
0
Entering edit mode
Noy • 0
@7bb9ea1e
Last seen 22 months ago
Israel

Hi, I'm trying to extract a significant gene list from a specific GO number. This is my code and all I get is an empty list. This empty list is under the title "Values" and it is a "character (empty).

goID <- "GO:0003677"
gene.universe <- genes(GOdataUp.res2.2)
go.genes <- genesInTerm(GOdataUp.res2.2, goID)[[2]]
sig.genes <- sigGenes(GOdataUp.res2.2)
topGO • 1.4k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

You are just giving us code from the middle of your analysis, without context. I can assume that GOdataUp.res2.2 is a topGOdata object, but I shouldn't have to do that. Your goal should be to provide a question that doesn't require the answerer to infer what you have done. One way to do that is to provide a self-contained example. Like this:

> library(topGO)
> example("sigGenes")
## I have cut out the resuts from running this example. But you can run it yourself, because
## it's a self-contained example
> termStat(GOdata, sel.terms)
           Annotated Significant Expected
GO:0045333         7           0     1.04
GO:0032825         3           1     0.45
GO:1904030         1           0     0.15
GO:0050854         4           3     0.59          <------ this one has significant genes, so we will use that
GO:1902904         7           2     1.04
GO:0045638         5           1     0.74
GO:0071363        24           2     3.56

## here's all the 'genes' for that term
>  ann.genes[["GO:0050854"]]
[1] "35282_r_at" "40518_at"   "40519_at"   "40520_g_at"
## and we can subset to the significant ones, which are in the 'sg' vector
> ann.genes[["GO:0050854"]][ann.genes[["GO:0050854"]] %in% sg]
[1] "40518_at"   "40519_at"   "40520_g_at"
ADD COMMENT
0
Entering edit mode

Hi James, First thanks for the quick response! My problem is to produce a table of the significant LOC that belong to a significant GO number that has had a change in expression. I am trying to find this because there is a problem that is the same table as you entered above (In my code the table is called: "allResUp.res2.2"), written that the same GO number has 10 significant genes and in practice in the LOC table (In my code the table is called: "Final.loc.go.up.res2") there are more than 10 genes (there are actually 23 LOC) under the same GO. I wanted to ask if you have an idea for a command (in R software) in which I would be able to produce only the significant genes under the same GO? I enclose my last two chunks in the code (only the Upp Regulated) where the tables I mentioned appear are created:

enter code here

Step 11: my tray to combain geneID2GO2.table withe downgenes.res2.GO to get 1 file with LOC and GO

##upgenes
##Connecting tables by category
Loc.GO.up.res2 <- merge(upgenes.res2.GO,geneID2GO2.table, by.x='Symbol', by.y='geneid')
Loc.GO.up.res2 <- Loc.GO.up.res2[,c(1:5)] # only the relevant columns 

#delete all the rows with uncharacterized in the description column
library(dplyr)
Final.loc.go.up.res2 <-Loc.GO.up.res2 %>% 
  filter(!grepl('uncharacterized', description.x))

# Create pdf of the final.loc.go.up.res1
write.table(Final.loc.go.up.res2,
           file= "C:/Users/noy1/Desktop/RNASeq/Final.loc.go.up.res2.csv",
           row.names=F, sep= ",")

Step 12: New Enrichment

BiocManager::install("Rgraphviz")

without.up.res2 <- read.csv("C:/Users/noy1/Desktop/RNASeq/without.up.res2.3.csv", header = TRUE, row.names=NULL)
head(without.up.res2, 4)

without.up.res2 <- without.up.res2[,1:5]
head(without.up.res2, 4)

#up
final.loc.go.up.res2.2 <- without.up.res2 #create the real count matrix
rownames(final.loc.go.up.res2.2$Symbol,do.NULL = TRUE, prefix = "row")
final.loc.go.up.res2.2 <- factor(final.loc.go.up.res2.2$Symbol)
geneListUp.res2.2 <- factor(as.integer(geneNames %in% final.loc.go.up.res2.2))
names(geneListUp.res2.2) <- geneNames
str(geneListUp.res2.2)
GOdataUp.res2.2 <- new("topGOdata", ontology = "MF", allGenes = geneListUp.res2.2, annot = annFUN.gene2GO, gene2GO = geneID2GO2)
GOdataUp.res2.2

classic.fisher.Up.res2.2 <- runTest(GOdataUp.res2.2, algorithm = "classic", statistic = "fisher")
weight01.fisher.Up.res2.2 <- runTest(GOdataUp.res2.2, algorithm = "weight01", statistic = "fisher")

allResUp.res2.2 <- GenTable(GOdataUp.res2.2, classic = classic.fisher.Up.res2.2, weight = weight01.fisher.Up.res2.2, orderBy = "weight", ranksOf = "weight", topNodes = 20)
knitr::kable(allResUp.res2.2)
GO.up.res2.2 <- showSigOfNodes(GOdataUp.res2.2, score(classic.fisher.Up.res2.2), firstSigNodes = 20, useInfo = "all")
# Create pdf of the results_WORKED!!! was not necessary the command before save the file (saved it the original example folder (res10_tt_tp))
#up
pdf("GO_MF_up.res2.2.pdf")
GO.up.res2.2 <- showSigOfNodes(GOdataUp.res2.2, 'score'(classic.fisher.Up.res2.2), firstSigNodes = 20, useInfo = "all")
dev.off()

# Export the allResUp.res1 date to Exel file (worked):
write.table(allResUp.res2.2,
           file= "C:/Users/noy1/Desktop/RNASeq/allResUp.res2.2.csv",
           row.names=F, sep= ",")

To illustrate the problem, I also enclose a picture of the two tables facing each other: enter image description here

ADD REPLY
0
Entering edit mode

I do have a command to do that. It's the last line of the answer I already gave.

ADD REPLY
0
Entering edit mode

Hi James, I try your command and now my problem is that after I prepper the "sel.terms" I gett difrent GO namber then the GO namber I gett from the "allResUp.res2.2" table. Even the specific GO nember (GO:0003677) that I'm looking for is not apper in this list. The "GOdataUp.res2.2" is a larg topGOdate (2.8 MB). What I`m doing wrong?

sel.terms <- sample(usedGO(GOdataUp.res2.2), 20)
head(sel.terms, 20)
 [1] "GO:0048018" "GO:0005457" "GO:0004383" "GO:0052725" "GO:0019887" "GO:0030247" "GO:0004070" "GO:0016500" "GO:0016405" "GO:0016860" "GO:0016901" "GO:0060089"
[13] "GO:0015252" "GO:0051015" "GO:0070001" "GO:0016887" "GO:0016671" "GO:0004019" "GO:0003824" "GO:0005245"

Just to be precise, the "allResUp.res2.2" table is attached :

enter image description here

Many thanks in advance!!

ADD REPLY
0
Entering edit mode

Hi James, Update from now on is that I succeeded to create the correct table, but now my problem is that the last two lines in your code do not work. I got "character(0)" I need to find only the 10 significant genes that belong to this GO number (GO:0003677), maybe you have an idea of how to solve the problem? Attached is the latest code:

##command from James W. MacDonald:
##worked!!!
library(topGO)
example("sigGenes")
#Prepering the "sel.terms" file:
sel.terms <- sample(usedGO(GOdataUp.res2.2), 100)
head(sel.terms, 100)
#create a vector of the first column from "allResup.res2.2":
sg <- pull(allResUp.res2.2, GO.ID)
head(sg, 20)
## I have cut out the results from running this example. But you can run it yourself, because it's a self-contained example
termStat(GOdataUp.res2.2,sg)

##not worked
## here's all the 'genes' for that term
ann.genes[["GO:0003677"]]
head(ann.genes, 4)
## and we can subset to the significant ones, which are in the 'sg' vector
ann.genes[["GO:0003677"]][ann.genes[["GO:0003677"]] %in% sg]
head(ann.genes, 4)
[1] " ann.genes[["GO:0003677"]]
  [1] "LOC109029542" "LOC109029701" "LOC109029716" "LOC109029726" "LOC109029782" "LOC109029795" "LOC109029812" "LOC109029933" "LOC109029937" "LOC109029950"
 [11] "LOC109029976" "LOC109030068" "LOC109030169" "LOC109030192" "LOC109030197" "LOC109030260" "LOC109030364" "LOC109030378" "LOC109030471" "LOC109030479"
 [21] "LOC109030498" "LOC109030499" "LOC109030526" "LOC109030527" "LOC109030622" "LOC109030624" "LOC109030731" "LOC109030823" "LOC109030831" "LOC109030973"
 [31] "LOC109031006" "LOC109031024" "LOC109031043" "LOC109031074" "LOC109031124" "LOC109031140" "LOC109031151" "LOC109031170" "LOC109031171" "LOC109031237"
 [41] "LOC109031267" "LOC109031347" "LOC109031348" "LOC109031349" "LOC109031351" "LOC109031366" "LOC109031410" "LOC109031446" "LOC109031447" "LOC109031453"
 [51] "LOC109031540" "LOC109031570" "LOC109031617" "LOC109031625" "LOC109031641" "LOC109031643" "LOC109031733" "LOC109031793" "LOC109031812" "LOC109031829"
 [61] "LOC109031839" "LOC109031905" "LOC109031920" "LOC109031931" "LOC109032052" "LOC109032053" "LOC109032095" "LOC109032096" "LOC109032111" "LOC109032126"
 [71] "LOC109032153" "LOC109032203" "LOC109032245" "LOC109032254" "LOC109032279" "LOC109032371" "LOC109032386" "LOC109032418" "LOC109032475" "LOC109032575"
 [81] "LOC109032619" "LOC109032628" "LOC109032635" "LOC109032681" "LOC109032691" "LOC109032738" "LOC109032785" "LOC109032802" "LOC109032821" "LOC109032845"
 [91] "LOC109032867" "LOC109032886" "LOC109032898" "LOC109032963" "LOC109032979" "LOC109032980" "LOC109033006" "LOC109033007" "LOC109033008" "LOC109033012"
[101] "LOC109033110" "LOC109033145" "LOC109033188" "LOC109033212" "LOC109033219" "LOC109033221" "LOC109033228" "LOC109033313" "LOC109033345" "LOC109033350"
[111] "LOC109033355" "LOC109033380" "LOC109033385" "LOC109033394" "LOC109033417" "LOC109033423" "LOC109033454" "LOC109033520" "LOC109033635" "LOC109033704"
[121] "LOC109033719" "LOC109033735" "LOC109033816" "LOC109033838" "LOC109033846" "LOC109033911" "LOC109033963" "LOC109033973" "LOC109033979" "LOC109034049"
[131] "LOC109034071" "LOC109034113" "LOC109034152" "LOC109034183" "LOC109034214" "LOC109034263" "LOC109034281" "LOC109034288" "LOC109034331" "LOC109034358"
[141] "LOC109034359" "LOC109034368" "LOC109034373" "LOC109034412" "LOC109034413" "LOC109034418" "LOC109034497" "LOC109034518" "LOC109034612" "LOC109034616"
[151] "LOC109034622" "LOC109034628" "LOC109034727" "LOC109034748" "LOC109034752" "LOC109034767" "LOC109034785" "LOC109034786" "LOC109034800" "LOC109034807"
[161] "LOC109034819" "LOC109034933" "LOC109034942" "LOC109034946" "LOC109034984" "LOC109034993" "LOC109035027" "LOC109035033" "LOC109035035" "LOC109035100"
[171] "LOC109035135" "LOC109035144" "LOC109035149" "LOC109035170" "LOC109035201" "LOC109035208" "LOC109035295" "LOC109035306" "LOC109035348" "LOC109035426"
[181] "LOC109035439" "LOC109035441" "LOC109035453" "LOC109035456" "LOC109035474" "LOC109035478" "LOC109035546" "LOC109035556" "LOC109035563" "LOC109035586"
[191] "LOC109035623" "LOC109035709" "LOC109035827" "LOC109035835" "LOC109035839" "LOC109035952" "LOC109035966" "LOC109035987" "LOC109036007" "LOC109036037"
[201] "LOC109036076" "LOC109036077" "LOC109036086" "LOC109036097" "LOC109036145" "LOC109036146" "LOC109036148" "LOC109036156" "LOC109036176" "LOC109036197"
[211] "LOC109036223" "LOC109036228" "LOC109036322" "LOC109036364" "LOC109036371" "LOC109036381" "LOC109036409" "LOC109036442" "LOC109036453" "LOC109036456"
[221] "LOC109036503" "LOC109036558" "LOC109036570" "LOC109036600" "LOC109036653" "LOC109036705" "LOC109036706" "LOC109036772" "LOC109036792" "LOC109036794"
[231] "LOC109036814" "LOC109036815" "LOC109036816" "LOC109036851" "LOC109036865" "LOC109036881" "LOC109036933" "LOC109036944" "LOC109037080" "LOC109037116"
[241] "LOC109037127" "LOC109037136" "LOC109037138" "LOC109037170" "LOC109037178" "LOC109037216" "LOC109037335" "LOC109037359" "LOC109037406" "LOC109037412"
[251] "LOC109037441" "LOC109037451" "LOC109037491" "LOC109037517" "LOC109037557" "LOC109037603" "LOC109037650" "LOC109037663" "LOC109037741" "LOC109037749"
[261] "LOC109037797" "LOC109037829" "LOC109037902" "LOC109037911" "LOC109037915" "LOC109037919" "LOC109037920" "LOC109037930" "LOC109037934" "LOC109037944"
[271] "LOC109037947" "LOC109037978" "LOC109037982" "LOC109038002" "LOC109038009" "LOC109038057" "LOC109038109" "LOC109038157" "LOC109038177" "LOC109038224"
[281] "LOC109038261" "LOC109038359" "LOC109038418" "LOC109038450" "LOC109038497" "LOC109038513" "LOC109038518" "LOC109038591" "LOC109038645" "LOC109038745"
[291] "LOC109038785" "LOC109038905" "LOC109038923" "LOC109038932" "LOC109038937" "LOC109038961" "LOC109039025" "LOC109039060" "LOC109039089" "LOC109039140"
[301] "LOC109039150" "LOC109039153" "LOC109039162" "LOC109039172" "LOC109039274" "LOC109039291" "LOC109039306" "LOC109039335" "LOC109039356" "LOC109039383"
[311] "LOC109039493" "LOC109039561" "LOC109039565" "LOC109039623" "LOC109039629" "LOC109039682" "LOC109039703" "LOC109039780" "LOC109039804" "LOC109039846"
[321] "LOC109039894" "LOC109039909" "LOC109039915" "LOC109039982" "LOC109040070" "LOC109040075" "LOC109040076" "LOC109040088" "LOC109040098" "LOC109040107"
[331] "LOC109040148" "LOC109040150" "LOC109040151" "LOC109040165" "LOC109040174" "LOC109040189" "LOC109040207" "LOC109040218" "LOC109040222" "LOC109040252"
[341] "LOC109040280" "LOC109040309" "LOC109040318" "LOC109040320" "LOC109040329" "LOC109040360" "LOC109040409" "LOC109040503" "LOC109040510" "LOC109040552"
[351] "LOC109040696" "LOC109040713" "LOC109040748" "LOC109040769" "LOC109040796" "LOC109040849" "LOC109040856" "LOC109040864" "LOC109040873" "LOC109040953"
[361] "LOC109040971" "LOC109040982" "LOC109041020" "LOC109041035" "LOC109041068" "LOC109041141" "LOC109041149" "LOC109041154" "LOC109041181" "LOC109041214"
[371] "LOC109041216" "LOC109041224" "LOC109041266" "LOC109041284" "LOC109041368" "LOC109041399" "LOC109041400" "LOC109041404" "LOC109041425" "LOC109041455"
[381] "LOC109041584" "LOC109041661" "LOC109041669" "LOC109041676" "LOC109041730" "LOC109041820" "LOC109041826" "LOC109041840" "LOC109041841" "LOC109041843"
[391] "LOC109041844" "LOC109041849" "LOC109041860" "LOC109041867" "LOC109041979" "LOC109041983" "LOC109042000" "LOC109042056" "LOC109042062" "LOC109042123"
[401] "LOC109042139" "LOC109042141" "LOC109042223" "LOC109042273" "LOC109042389" "LOC109042428" "LOC109042473" "LOC109042565" "LOC109042580" "LOC109042604"
[411] "LOC109042648" "LOC109042658" "LOC109042719" "LOC109042740" "LOC109042749" "LOC109042811" "LOC109042883" "LOC109042904" "LOC109042930" "LOC109042944"
[421] "LOC109042946" "LOC109042973" "LOC109042994" "LOC109043006" "LOC109043043" "LOC109043044" "LOC109043086" "LOC109043096" "LOC109043192" "LOC109043199"
[431] "LOC109043208" "LOC109043256" "LOC109043279" "LOC109043328" "LOC109043334" "LOC109043352" "LOC109043405" "LOC109043445" "LOC109043447" "LOC109043462"
[441] "LOC109043516" "LOC109043591" "LOC109043627" "LOC109043632" "LOC109043648" "LOC109043661" "LOC109043664" "LOC109043696" "LOC109043732" "LOC109043749"
[451] "LOC109043751" "LOC109043789" "LOC109043822" "LOC109043866" "LOC109043913" "LOC109043920" "LOC109043932" "LOC109044016" "LOC109044029" "LOC109044039"
[461] "LOC109044065" "LOC109044119" "LOC109044134" "LOC109044145" "LOC109044165" "LOC109044176" "LOC109044182" "LOC109044254" "LOC109044266" "LOC109044286"
[471] "LOC109044299" "LOC109044365" "LOC109044486" "LOC109044496" "LOC109044505" "LOC109044530" "LOC109044537" "LOC109044551" "LOC109044559" "LOC109044674"
[481] "LOC109044733" "LOC109044736" "LOC109044746"
> ## and we can subset to the significant ones, which are in the 'sg' vector
> ann.genes[["GO:0003677"]][ann.genes[["GO:0003677"]] %in% sg]
character(0)"
ADD REPLY
0
Entering edit mode

I think you are confusing the example data and your own. The goal of example data is to provide you with workable examples that you can extrapolate to your own data. It's not intended to be used directly with your data. You need to use the example to figure out how to make the same thing as the sg vector using your own data.

ADD REPLY

Login before adding your answer.

Traffic: 472 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