knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(tinytools)
Two web tools are used for compound compound convert.
cts.fiehnlab is http://cts.fiehnlab.ucdavis.edu/service/convert. It support a lot of databases.
library(tinytools)
We can use the trans_id_database()
to get the databases that cts.fiehnlab.
database_name = trans_id_database(server = "cts.fiehnlab")
head(database_name$From$From)
head(database_name$To$From)
We can see that it support a lot of (> 200) databases.
We can try the most common convert, from KEGG to HMDB.
trans_ID( query = "C00001", from = "KEGG", to = "Human Metabolome Database", top = 1, server = "cts.fiehnlab" )
Now, trans_ID
doesn't support verctor query. So you can use the purrr::map()
to achive this.
c("C00001", "C00001", "C00001") %>% purrr::map( .f = function(x) { trans_ID( query = x, from = "KEGG", to = "Human Metabolome Database", top = 1, server = "cts.fiehnlab" ) } ) %>% do.call(rbind, .) %>% as.data.frame()
This is from https://www.chemspider.com/InChI.asmx.
We can use the trans_id_database()
to get the databases that chemspider
database_name2 = trans_id_database(server = "chemspider")
database_name2$From
database_name2$To
This is very useful if you want to get the inchikey, inchi or smiles for one compound. But this web only support "ChemSpider ID" (csid), so we need use cts.fiehnlab convert to csid first.
trans_ID( query = "C00001", from = "KEGG", to = "ChemSpider", top = 1, server = "cts.fiehnlab" )
trans_ID( query = "140526", from = "csid", to = "mol", top = 1, server = "chemspider" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.