Skip to content
Snippets Groups Projects
Commit b55ced8f authored by GUILMINEAU Camille's avatar GUILMINEAU Camille
Browse files

use use_KEGGREST function

parent 90dd0d48
No related branches found
No related tags found
No related merge requests found
......@@ -96,10 +96,10 @@ overlap_coefficient <- function(pathwayA, pathwayB, pathways = NULL, organism =
}
code <- substr(pathwayA, start = 1, stop = nchar(pathwayA) - 5)
kegg_org <- KEGGREST::keggList("organism")
kegg_org <- use_KEGGREST(KEGGREST::keggList("organism"))
if (!code %in% kegg_org) {
pathlist <- KEGGREST::keggList("pathway", organism)
pathlist <- use_KEGGREST(KEGGREST::keggList("pathway", organism))
pathlist <- as.data.frame(pathlist)
pathlist$pathway_code <- rownames(pathlist)
......@@ -112,7 +112,7 @@ overlap_coefficient <- function(pathwayA, pathwayB, pathways = NULL, organism =
pathwayB <- pathlist[pathlist$pathlist == pathwayB, "pathway_code"]
}
pathinfo <- KEGGREST::keggGet(c(pathwayA, pathwayB))
pathinfo <- use_KEGGREST(KEGGREST::keggGet(c(pathwayA, pathwayB)))
A <- pathinfo[[1]]$COMPOUND
B <- pathinfo[[2]]$COMPOUND
}
......
......@@ -53,7 +53,7 @@ pathway_search <- function(metab, organism, min_size = 2) {
if (!is.character(organism) & !length(organism) == 1) {
stop("`organism` must be a character.")
}
kegg_org <- KEGGREST::keggList("organism")
kegg_org <- use_KEGGREST(KEGGREST::keggList("organism"))
kegg_org <- as.data.frame(kegg_org)
if (!(organism %in% kegg_org$organism)) {
......@@ -63,7 +63,7 @@ pathway_search <- function(metab, organism, min_size = 2) {
message("Starts searching for pathways...")
# search KEGG pathways
pathlist <- KEGGREST::keggList("pathway", organism)
pathlist <- use_KEGGREST(KEGGREST::keggList("pathway", organism))
pathlist <- as.data.frame(pathlist)
colnames(pathlist) <- "pathway_name"
pathlist <- rownames_to_column(pathlist, "pathway_code")
......@@ -74,7 +74,8 @@ pathway_search <- function(metab, organism, min_size = 2) {
fixed = TRUE)
comp <- sapply(1:nrow(pathlist), function(i) {
path <- KEGGREST::keggGet(paste0("path:", pathlist$pathway_code[i]))
path <- use_KEGGREST(KEGGREST::keggGet(paste0("path:",
pathlist$pathway_code[i])))
path <- as.data.frame(path[[1]]$COMPOUND)
})
names(comp) <- pathlist$pathway_code
......
......@@ -138,7 +138,7 @@ test_pathway <- function(quantif, design, pathways = "auto", fixed, random,
stop("Package 'KEGGREST' not available. Automatic pathway searching",
" cannot be performed.")
}
kegg_org <- KEGGREST::keggList("organism")
kegg_org <- use_KEGGREST(KEGGREST::keggList("organism"))
kegg_org <- as.data.frame(kegg_org)
kegg_org <- unique(kegg_org$organism)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment