Entering edit mode
6.7 years ago
Pin.Bioinf
▴
340
Hello,
I do my enrichment from a list of genes using stringdb. package. It returns the pathways , the pvalue and the number of hits per pathway. How can I get which genes were mapped to each pathway? I could not find a way by looking at the stringdb manual.
This is my function:
library(STRINGdb)
##Open connection with database STRING and obtain a network as an igraph object with a threshold >400.
string_db <- STRINGdb$new( version="10", species=9606, score_threshold=400, input_directory="" )
string.network <- string_db$get_graph()
proteins <- string_db$get_proteins()
p <- dplyr::select(proteins, preferred_name)
proteins <- string_db$map(p, "preferred_name")
EnrichmentKegg<-function(list){
nodes.string <- (filter(proteins, preferred_name %in% list))$STRING_id
res<-string_db$get_enrichment( nodes.string, category = "KEGG", methodMT = "fdr", iea = TRUE )
if(nrow(res)>10){
tst<-as.data.frame(res[1:10,])
}else{
tst<-as.data.frame(res)
}
print(tst)
}