Mercurial > repos > prog > lcmsmatching
comparison NcbiCcdsCompound.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 |
comparison
equal
deleted
inserted
replaced
0:e66bb061af06 | 1:253d531a0193 |
---|---|
25 | 25 |
26 # Parse HTML | 26 # Parse HTML |
27 xml <- htmlTreeParse(html, asText = TRUE, useInternalNodes = TRUE) | 27 xml <- htmlTreeParse(html, asText = TRUE, useInternalNodes = TRUE) |
28 | 28 |
29 if (length(getNodeSet(xml, "//*[starts-with(.,'No results found for CCDS ID ')]")) == 0) { | 29 if (length(getNodeSet(xml, "//*[starts-with(.,'No results found for CCDS ID ')]")) == 0) { |
30 compound$setField(RBIODB.ACCESSION, xpathSApply(xml, "//input[@id='DATA']", xmlGetAttr, "value")) | 30 compound$setField(BIODB.ACCESSION, xpathSApply(xml, "//input[@id='DATA']", xmlGetAttr, "value")) |
31 compound$setField(RBIODB.SEQUENCE, xpathSApply(xml, "//b[starts-with(.,'Nucleotide Sequence')]/../tt", xmlValue)) | 31 compound$setField(BIODB.SEQUENCE, xpathSApply(xml, "//b[starts-with(.,'Nucleotide Sequence')]/../tt", xmlValue)) |
32 } | 32 } |
33 | 33 |
34 compounds <- c(compounds, compound) | 34 compounds <- c(compounds, compound) |
35 } | 35 } |
36 | 36 |
37 # Replace elements with no accession id by NULL | 37 # Replace elements with no accession id by NULL |
38 compounds <- lapply(compounds, function(x) if (is.na(x$getField(RBIODB.ACCESSION))) NULL else x) | 38 compounds <- lapply(compounds, function(x) if (is.na(x$getField(BIODB.ACCESSION))) NULL else x) |
39 | 39 |
40 # If the input was a single element, then output a single object | 40 # If the input was a single element, then output a single object |
41 if (drop && length(contents) == 1) | 41 if (drop && length(contents) == 1) |
42 compounds <- compounds[[1]] | 42 compounds <- compounds[[1]] |
43 | 43 |