diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-10-13 15:10:03 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-10-13 15:10:03 +0200 |
commit | 898d598bcbb022ac767e0105e868798130f2c74c (patch) | |
tree | 8a079442d27df08ed8ee7659f508f62e544f8b32 /R | |
parent | 6937e41d317b953d8246203814500166dbe89470 (diff) |
Adapt to changes in webchem
Unfortunately, tests only pass sometimes, it seems PubChem is not always
responding
Diffstat (limited to 'R')
-rw-r--r-- | R/chent.R | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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])) { |