R/read_pathway.R

read_pathway <-
function (fullpath) {

# load XML library
library(XML)

# read XML file
a <- xmlTreeParse(fullpath)
b <- xmlRoot(a)

# metabolite set list
ID <- NaN
metabolite_set <- NaN
for (i in 1:length(b)){

# // ID
s <- b[[i]]
u <- xmlToList(s)
v <- u[names(u)=="compound"]
id <- as.character(unlist(v))

ID[i] <- list(id)
metabolite_set[i] <- as.character(xmlAttrs(b[[i]]))
}

names(ID) <- metabolite_set
return(ID)
}

Try the mseapca package in your browser

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

mseapca documentation built on May 1, 2019, 7:31 p.m.