why the metabolomics file does not merge?
1
0
Entering edit mode
19 months 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)
R • 700 views
ADD COMMENT
2
Entering edit mode
19 months ago

After

mets = setNames(str_split(mets, ";", simplify = T)[,1], names(mets))

add the code

names(mets) <- paste0("cpd:", names(mets))

The names are missing "cpd:" so won't merge into the df you're building without them,

ADD COMMENT
0
Entering edit mode

rpolicastro how comes ???? I have been busy trying 100 things ! thanks

ADD REPLY
0
Entering edit mode

No problem!

keggLink("compound", "enzyme") returns them in the format cpd:C00001 and keggList("compound") returns them in the format C00001, so it's just a matter of hormonizing the naming conventions between what the two functions return.

ADD REPLY

Login before adding your answer.

Traffic: 2781 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6