Re: KEGG searching
Reply #1 –
Hi Ashley,
I've been working on doing a cool little function for this for some time however there is a package called KEGGSOAP downloadable from bioconductor http://http://www.bioconductor.org/packages/2.4/bioc/html/KEGGSOAP.html.
If you load up KEGGSOAP and use the following code it should work (required internet connection):
library(KEGGSOAP)
search.compounds.by.mass(89.0932, 0.1)
## [1] "cpd:C00041" "cpd:C00099" "cpd:C00133" "cpd:C00213" "cpd:C01401" "cpd:C01444" "cpd:C01537" "cpd:C02116"
## [9] "cpd:C06383" "cpd:C11488"
bget("-f m cpd:C00041") ## gives the mol file for plotting the molecule with RCDK ([url]http://cran.r-project.org/web/packages/rcdk/index.html[/url])
molD<-bget("cpd:C00041") ## this will give you the full listing
molName<-strsplit(strsplit(molD, "n")[[1]][2], "\s+", perl=T)[[1]][2]
molName
##[1] "L-Alanine;"
This can be a very messy way but it gets the job done. If you're going to put this into a for loop be careful of the multiple results returned. I'm pretty sure that the results are returned in order for the original mass. Also remember KEGG searches neutral masses!!
The method that I working on in xcms will hopefully get a better name and have a choice between the different results. I'll spend some time and get the function working and into the next release of xcms. I'll update here when I do.
Paul
EDIT:
Just reread your Q and thought you might also want this
http://http://www.genome.jp/ligand-bin/result?db=compound&pid=130909468912976&show=weight,structure&q=89%20-%2090
This search is done from the http://http://www.genome.jp/kegg/ligand.html page about half way down it says "Search COMPOUND" then use the drop down box to get "Exact mass"