Entering edit mode
                    2.5 years ago
        Bioinfo
        
    
        ▴
    
    20
    hello guys,
I am trying to get the metabolomics list but it seems like it does not merge , it returns an empty list. where and what and I am doing wrong?
    library(KEGGREST) 
    library(org.Hs.eg.db) 
    library(annotate)
    ## Get enzyme-gene annotations 
res1 = keggLink("enzyme", "hsa")
tmpDF1 = data.frame(ec = res1, gene = names(res1))
    ## Get compound-enzyme annotations 
res2 = keggLink("compound", "enzyme")
tmpDF2 = data.frame(cpd = res2, ec = names(res2))
    ## Merge 
df = merge(tmpDF1, tmpDF2, by="ec")
    ## Convert KEGG gene IDs to Entrez Gene IDs 
convs = keggConv("hsa", "ncbi-geneid") 
names(convs) = as.character(gsub("ncbi-geneid:", "", names(convs))) 
df$ncbi_id = names(convs)[match(df$gene, as.character(convs))] 
df$ncbi_name = getSYMBOL(df$ncbi_id, "org.Hs.eg.db")
    ## Convert compound IDs to compound (metabolite) names 
mets = keggList("compound") 
mets = setNames(str_split(mets, ";", simplify = T)[,1], names(mets)) 
df$cpd_name = as.character(mets)[match(df$cpd, names(mets))]
    ## Make a list of metabolite gene sets. Each metabolite gene set is composed of enzymes/genes involved in their metabolism metabolites.gs
    = lapply(1:length(unique(df$cpd_name)), function(x) df$ncbi_name[which(df$cpd_name == unique(df$cpd_name)[x])]) names(metabolites.gs) = unique(df$cpd_name)
rpolicastro how comes ???? I have been busy trying 100 things ! thanks
No problem!
keggLink("compound", "enzyme")returns them in the formatcpd:C00001andkeggList("compound")returns them in the formatC00001, so it's just a matter of hormonizing the naming conventions between what the two functions return.