aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2024-08-05 19:03:21 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2024-08-05 19:03:21 +0200
commit77189d666eb39d2660245c2f008175dc4560f647 (patch)
treefbd07f059b5da70c813526047f16464f7e4d745f /R
parent1b58327278038a1111a88c521e6992c15e0b17ea (diff)
Fix a bug introduced by the last commitHEADmain
Diffstat (limited to 'R')
-rw-r--r--R/chent.R24
1 files changed, 15 insertions, 9 deletions
diff --git a/R/chent.R b/R/chent.R
index 6f77582..91fc41b 100644
--- a/R/chent.R
+++ b/R/chent.R
@@ -195,19 +195,25 @@ chent <- R6Class("chent",
self$inchikey <- self$pubchem$InChIKey
attr(self$inchikey, "source") <- "pubchem"
} else {
- if (length(self$inchikey) > 1) {
- message("InChIKey ", self$inchikey, " retreived from ",
- attr(self$inchikey, "source"),
- " has length > 1, using PubChem InChIKey")
+ if (is.na(self$inchikey)) {
+ warning("Overwriting uninitialized InChIKey")
self$inchikey <- self$pubchem$InChIKey
attr(self$inchikey, "source") <- "pubchem"
} else {
- if (self$pubchem$InChIKey != self$inchikey) {
- message("InChiKey ", self$pubchem$InChIKey, " from PubChem record does not match\n",
- "InChiKey ", self$inchikey, " retreived from ",
- attr(self$inchikey, "source"))
+ if (length(self$inchikey) > 1) {
+ message("InChIKey ", self$inchikey, " retreived from ",
+ attr(self$inchikey, "source"),
+ " has length > 1, using PubChem InChIKey")
+ self$inchikey <- self$pubchem$InChIKey
+ attr(self$inchikey, "source") <- "pubchem"
} else {
- attr(self$inchikey, "source") <- c(attr(self$inchikey, "source"), "pubchem")
+ if (self$pubchem$InChIKey != self$inchikey) {
+ message("InChiKey ", self$pubchem$InChIKey, " from PubChem record does not match\n",
+ "InChiKey ", self$inchikey, " retreived from ",
+ attr(self$inchikey, "source"))
+ } else {
+ attr(self$inchikey, "source") <- c(attr(self$inchikey, "source"), "pubchem")
+ }
}
}
}

Contact - Imprint