R/hmxToList.R

Defines functions .hmxPath

.hmxPath = function(prefix="http://www.hmdb.ca/metabolites/",
                   id="HMDB0000001", ...) {
  sub("__PRE__", prefix, sub("%%ID%%", id, "__PRE__%%ID%%.xml") )
}

hmxToList = function (prefix = "http://www.hmdb.ca/metabolites/", id = "HMDB0000001", 
    ...) 
{
    requireNamespace("XML")
    stopifnot(is.atomic(prefix), length(prefix)==1, is.atomic(id), length(id)==1)
    txt = readLines(.hmxPath(prefix=prefix, id=id, ...))
    prs = xmlTreeParse(txt, asText=TRUE)
    xmlToList(prs)
}

Try the hmdbQuery package in your browser

Any scripts or data that you put into this service are public.

hmdbQuery documentation built on Feb. 17, 2021, 2:01 a.m.