Mercurial > repos > prog > lcmsmatching
diff ChebiCompound.R @ 1:253d531a0193 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 36c9d8099c20a1ae848f1337c16564335dd8fb2b
author | prog |
---|---|
date | Sat, 03 Sep 2016 17:02:01 -0400 |
parents | e66bb061af06 |
children |
line wrap: on
line diff
--- a/ChebiCompound.R Tue Jul 12 12:02:37 2016 -0400 +++ b/ChebiCompound.R Sat Sep 03 17:02:01 2016 -0400 @@ -20,9 +20,9 @@ # Define xpath expressions xpath.expr <- character() -# xpath.expr[[RBIODB.ACCESSION]] <- "//b[starts-with(., 'CHEBI:')]" - xpath.expr[[RBIODB.INCHI]] <- "//td[starts-with(., 'InChI=')]" - xpath.expr[[RBIODB.INCHIKEY]] <- "//td[text()='InChIKey']/../td[2]" +# xpath.expr[[BIODB.ACCESSION]] <- "//b[starts-with(., 'CHEBI:')]" + xpath.expr[[BIODB.INCHI]] <- "//td[starts-with(., 'InChI=')]" + xpath.expr[[BIODB.INCHIKEY]] <- "//td[text()='InChIKey']/../td[2]" for (html in contents) { @@ -43,14 +43,14 @@ accession <- xpathSApply(xml, "//b[starts-with(., 'CHEBI:')]", xmlValue) if (length(accession) > 0) { accession <- sub('^CHEBI:([0-9]+)$', '\\1', accession, perl = TRUE) - compound$setField(RBIODB.ACCESSION, accession) + compound$setField(BIODB.ACCESSION, accession) } compounds <- c(compounds, compound) } # Replace elements with no accession id by NULL - compounds <- lapply(compounds, function(x) if (is.na(x$getField(RBIODB.ACCESSION))) NULL else x) + compounds <- lapply(compounds, function(x) if (is.na(x$getField(BIODB.ACCESSION))) NULL else x) # If the input was a single element, then output a single object if (drop && length(contents) == 1)