1. Over 10 results
I am trying to get pathway names using a list of 16 list of enzymes (list of lists). I used lapply and works correctly for the first 10 enzymes from each list.
# list of 16 list of enzymes
list_Enz <- lapply(read_files, function(z) paste0("ec:",z[,3]))
# example enzymes
x<- c("ec:1.1.1.2", "ec:6.2.1.1", "ec:1.2.4.1", "ec:2.3.1.12", "ec:1.8.1.4", "ec:1.2.1.51",
"ec:1.1.1.27", "ec:1.2.1.4", "ec:1.2.1.5", "ec:2.7.1.11", "ec:4.1.2.13", "ec:2.7.1.40",
"ec:1.2.1.49", "ec:2.7.2.3", "ec:5.3.1.9", "ec:5.3.1.1", "ec:2.7.1.1", "ec:2.7.1.2",
"ec:2.7.1.147", "ec:5.4.2.2", "ec:5.4.2.5", "ec:5.4.2.6", "ec:5.2.2.2", "ec:5.1.3.3", "ec:2.7.1.1")
y <- c("ec:1.1.1.1", "ec:1.1.1.71", "ec:1.1.1.27", "ec:1.2.1.4", "ec:1.2.1.5", "ec:2.7.1.11",
"ec:4.2.1.11", "ec:3.6.1.7", "ec:1.2.1.12", "ec:4.1.2.13", "ec:1.2.4.1", "ec:2.3.1.12",
"ec:2.7.1.147", "ec:5.3.1.9", "ec:3.2.1.20", "ec:3.2.1.28", "ec:2.4.1.186", "ec:2.4.1.11",
"ec:2.4.1.11", "ec:2.4.1.18", "ec:2.4.1.1", "ec:3.2.1.1")
# trial 25 enzymes
list_Enzh<- list(x,y)
listpaths <- lapply(list_Enzh, function(m) keggGet(m))
How could I use a for or while loops to got all the information?. Tried a nested loop and it doesn't work:
for (k in 1:16){
for (l in 1:25){
listpaths2 <- lapply(list_Enzh, function(m) keggGet(m[[k]][[l]]))
}
}
Error in m[[k]][[l]] : subscript out of bounds
2. Error for some enzyme records I used while loop for a single list of enzymes. It works correctly, but for "ec:5.2.2.2" (x example list) gives an error message.
paths <- c()
i<- 1
while (i < length (x)){
paths[i] <- keggGet(x[i])
}
Error in .getUrl(url, .flatFileParser) : Not Found (HTTP 404).
I appreciate a lot any help!