aboutsummaryrefslogtreecommitdiff
path: root/R/chent.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-10-13 15:10:03 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-10-13 15:10:03 +0200
commit898d598bcbb022ac767e0105e868798130f2c74c (patch)
tree8a079442d27df08ed8ee7659f508f62e544f8b32 /R/chent.R
parent6937e41d317b953d8246203814500166dbe89470 (diff)
Adapt to changes in webchem
Unfortunately, tests only pass sometimes, it seems PubChem is not always responding
Diffstat (limited to 'R/chent.R')
-rw-r--r--R/chent.R10
1 files changed, 3 insertions, 7 deletions
diff --git a/R/chent.R b/R/chent.R
index 75b6098..b2c2e4a 100644
--- a/R/chent.R
+++ b/R/chent.R
@@ -110,15 +110,11 @@ chent <- R6Class("chent",
try_pubchem = function(query, from = 'name') {
message("PubChem:")
if (missing(query)) query <- self$identifier
- pubchem_result = webchem::get_cid(query, from = from)
+ pubchem_result = webchem::get_cid(query, from = from, match = "first")
- if (is.na(pubchem_result[[1]][1])) {
+ if (is.na(pubchem_result[[1, "cid"]])) {
message("Query ", query, " did not give results at PubChem")
} else {
- n_results = length(pubchem_result[[1]])
- if (n_results > 1) {
- warning("Found ", n_results, " entries in PubChem, using the first one.")
- }
self$get_pubchem(pubchem_result[[1, "cid"]])
}
},
@@ -511,7 +507,7 @@ pai <- R6Class("pai",
if (!missing(iso) & alanwood) {
message("alanwood.net:")
- aw_result = webchem::aw_query(identifier, type = "commonname")
+ aw_result = webchem::aw_query(identifier, from = "name")
# Use first element of list, as we passed a query of length one
if (is.na(aw_result[[1]][1])) {

Contact - Imprint