Hello, R experts,
I tried to retrieve all biological process GO terms at level 3 starting
"biological process" as level 1 using the code as bellows:
1 library(GO)
2 library(GOstats)
3
level2<-getGOChildren("GO:0008150")$"GO:0008150"$Children
4 for ( i in 1:length(level2)) {
5 level3 <- getGOChildren(level2[i])$level2[i]$Children
6 for ( j in 1:length(level3)){
7 level3term <- getGOTerm(as.character(level3[j]))$BP$level3[j]
8 level3term
9 }
10 }
What is the difference between line 3 and line5? In the line 3 I retrieved the
GO identifiers at level 2 successfullly but in the line 5 I got nothing. How to
correct the line 5 to retrieve the GO terms at level 3 correctly?
Thank you in advance!
Josh
szhan at uoguelph.ca writes:> Hello, R experts, > I tried to retrieve all biological process GO terms at level 3 starting > "biological process" as level 1 using the code as bellows: > > 1 library(GO) > 2 library(GOstats) > 3 level2<-getGOChildren("GO:0008150")$"GO:0008150"$Children > 4 for ( i in 1:length(level2)) { > 5 level3 <- getGOChildren(level2[i])$level2[i]$Children > 6 for ( j in 1:length(level3)){ > 7 level3term <- getGOTerm(as.character(level3[j]))$BP$level3[j] > 8 level3term > 9 } > 10 } > What is the difference between line 3 and line5? In the line 3 I retrieved the > GO identifiers at level 2 successfullly but in the line 5 I got nothing. How to > correct the line 5 to retrieve the GO terms at level 3 correctly? > Thank you in advance! > JoshI think you'll have better luck with that question if you take it to the Bioconductor list. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
szhan at uoguelph.ca wrote:> Hello, R experts, > I tried to retrieve all biological process GO terms at level 3 starting > "biological process" as level 1 using the code as bellows: > > 1 library(GO) > 2 library(GOstats) > 3 level2<-getGOChildren("GO:0008150")$"GO:0008150"$Children > 4 for ( i in 1:length(level2)) { > 5 level3 <- getGOChildren(level2[i])$level2[i]$ChildrenIf you want to index by an object that contains a character (or string), you have to use "[[]]" rather than "$". The question is completely independent of GO, so don't confuse potential responders who expect you to send messages re. Bioconductor packages to the corresponding list. Uwe Ligges> 6 for ( j in 1:length(level3)){ > 7 level3term <- getGOTerm(as.character(level3[j]))$BP$level3[j] > 8 level3term > 9 } > 10 } > What is the difference between line 3 and line5? In the line 3 I retrieved the > GO identifiers at level 2 successfullly but in the line 5 I got nothing. How to > correct the line 5 to retrieve the GO terms at level 3 correctly? > Thank you in advance! > Josh > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html