aboutsummaryrefslogtreecommitdiff
path: root/R/chent.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/chent.R')
-rw-r--r--R/chent.R11
1 files changed, 8 insertions, 3 deletions
diff --git a/R/chent.R b/R/chent.R
index 4375305..aee95f0 100644
--- a/R/chent.R
+++ b/R/chent.R
@@ -118,9 +118,14 @@ chent <- R6Class("chent",
if (is.null(self$smiles)) {
message("RDKit would need a SMILES code")
} else {
+ available_smiles <- names(self$smiles)
+ smiles_preference <- c("user", "PubChem_Isomeric", "PubChem_Canonical")
+ smiles_preferred_i <- min(match(available_smiles, smiles_preference))
+ smiles_preferred <- smiles_preference[smiles_preferred_i]
+
message("Trying to get chemical information from RDKit using ",
- names(self$smiles)[1], " SMILES\n",
- self$smiles[1])
+ smiles_preferred, " SMILES\n",
+ self$smiles[smiles_preferred])
self$get_rdkit(template = template)
self$mw <- self$rdkit$mw
attr(self$mw, "source") <- "rdkit"
@@ -196,7 +201,7 @@ chent <- R6Class("chent",
#' Get chemical information from RDKit if available
#' @param template Optional template specified as a SMILES code
get_rdkit = function(template = NULL) {
- if(!rdkit_available) {
+ if (!rdkit_available) {
stop("RDKit is not available")
}
self$rdkit <- list()

Contact - Imprint