From 816de01ce642c1c3d633ffb1cbcf960036d27114 Mon Sep 17 00:00:00 2001 From: Ranke Johannes Date: Fri, 10 Nov 2023 18:40:34 +0100 Subject: Make an RStudio project and improve the docs --- .Rbuildignore | 2 + .gitignore | 1 + DESCRIPTION | 10 +- GNUmakefile | 2 - R/chent.R | 201 ++++++--- chents.Rproj | 19 + docs/404.html | 117 ++---- docs/authors.html | 139 +++---- docs/index.html | 73 ++-- docs/pkgdown.css | 83 ++-- docs/pkgdown.js | 4 +- docs/pkgdown.yml | 6 +- docs/reference/Rplot001.png | Bin 19923 -> 20712 bytes docs/reference/chent-1.png | Bin 46431 -> 46730 bytes docs/reference/chent.html | 807 +++++++++++++++++++++---------------- docs/reference/draw_svg.chent.html | 173 +++----- docs/reference/index.html | 160 ++------ docs/reference/pai-1.png | Bin 33683 -> 34388 bytes docs/reference/pai.html | 315 ++++++--------- docs/reference/plot.chent-1.png | Bin 46149 -> 46142 bytes docs/reference/plot.chent.html | 190 +++------ docs/reference/pp.html | 208 ++++------ docs/reference/print.chent.html | 137 ++----- docs/reference/print.pai.html | 137 ++----- docs/sitemap.xml | 36 ++ man/chent.Rd | 145 ++++++- man/pai.Rd | 3 - 27 files changed, 1364 insertions(+), 1604 deletions(-) create mode 100644 chents.Rproj create mode 100644 docs/sitemap.xml diff --git a/.Rbuildignore b/.Rbuildignore index e972bda..99eec76 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,5 @@ ^docs$ ^_pkgdown\.yml$ ^\.travis\.yml$ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/.gitignore b/.gitignore index 6865f3b..c1b5016 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ chents_*.tar.gz chents.Rcheck +.Rproj.user diff --git a/DESCRIPTION b/DESCRIPTION index 815a9c0..e75912b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,15 +2,14 @@ Package: chents Type: Package Title: Chemical Entities as R Objects Version: 0.3.1 -Date: 2023-06-08 +Date: 2023-11-10 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), - email = "jranke@uni-bremen.de")) + email = "johannes.ranke@jrwb.de")) Description: Utilities for dealing with chemical entities and associated data as R objects. If Python and RDKit (> 2015.03) are installed and configured for use with 'reticulate', some basic chemoinformatics functions like the calculation of molecular weight and plotting of chemical - structures in R graphics are available. For plotting, you need - grConvert (https://sjp.co.nz/projects/grconvert) which is not on CRAN. + structures in R graphics are available. Imports: webchem, R6, @@ -28,4 +27,5 @@ LazyLoad: yes LazyData: yes Encoding: UTF-8 URL: https://github.com/jranke/chents -RoxygenNote: 7.2.1 +Roxygen: list(markdown = TRUE, r6 = TRUE) +RoxygenNote: 7.2.3 diff --git a/GNUmakefile b/GNUmakefile index c9975a9..8d2c094 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -27,11 +27,9 @@ pd: roxygen @echo "DONE." $(TGZ): $(pkgfiles) - sed -i -e "s/Date:.*/Date: $(DATE)/" DESCRIPTION @echo "Roxygenizing package..." "$(R_HOME)/bin/Rscript" -e 'library(devtools); document()' @echo "Building package..." - git log --no-merges -M --date=iso > ChangeLog "$(R_HOME)/bin/R" CMD build . @echo "DONE." diff --git a/R/chent.R b/R/chent.R index c89efec..dc9be6f 100644 --- a/R/chent.R +++ b/R/chent.R @@ -1,25 +1,8 @@ -# Copyright (C) 2016-2021 Johannes Ranke -# Contact: jranke@uni-bremen.de -# This file is part of the R package chents - -# This program is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. - -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. - -# You should have received a copy of the GNU General Public License along with -# this program. If not, see - -#' An R6 class for chemical entities with associated data +#' @title An R6 class for chemical entities with associated data #' -#' The class is initialised with an identifier. Chemical information is retrieved from -#' the internet. Additionally, it can be generated using RDKit if RDKit and its -#' python bindings are installed. +#' @description The class is initialised with an identifier. Chemical +#' information is retrieved from the internet. Additionally, it can be +#' generated using RDKit if RDKit and its python bindings are installed. #' #' @export #' @format An \code{\link{R6Class}} generator object @@ -28,27 +11,8 @@ #' @importFrom grImport PostScriptTrace readPicture #' @importFrom yaml yaml.load_file #' @importFrom rsvg rsvg_ps -#' @field identifier The identifier that was used to initiate the object, with attribute 'source' -#' @field inchikey InChI Key, with attribute 'source' -#' @field smiles SMILES code, with attribute 'source' -#' @field mw Molecular weight, with attribute 'source' -#' @field pubchem List of information retreived from PubChem -#' @field rdkit List of information obtained with RDKit -#' @field mol object -#' @field svg SVG code -#' @field Picture Graph as a \code{\link{picture}} object obtained using grImport -#' @field Pict_font_size Font size as extracted from the intermediate PostScript file -#' @field pdf_height Height of the MediaBox in the pdf after cropping -#' @field p0 Vapour pressure in Pa -#' @field cwsat Water solubility in mg/L -#' @field chyaml List of information obtained from a YAML file -#' @field soil_degradation Dataframe of modelling DT50 values -#' @field soil_ff Dataframe of formation fractions -#' @field soil_sorption Dataframe of soil sorption data -#' @field PUF Plant uptake factor -#' @keywords data #' @examples -#' oct <- chent$new("1-octanol", smiles = "CCCCCCCCO") +#' oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE) #' print(oct) #' if (!is.null(oct$Picture)) { #' plot(oct) @@ -59,30 +23,80 @@ #' if (!is.null(caffeine$Picture)) { #' plot(caffeine) #' } - chent <- R6Class("chent", - public <- list( + public = list( + #' @field identifier (`character(1)`)\cr + #' The identifier that was used to initiate the object, with attribute 'source' identifier = NULL, + + #' @field inchikey (`character(1)`)\cr + #' InChI Key, with attribute 'source' inchikey = NULL, + + #' @field smiles (`character()`)\cr + #' SMILES code(s), with attribute 'source' smiles = NULL, + + #' @field mw (`numeric(1)`)\cr + #' Molecular weight, with attribute 'source' mw = NULL, + + #' @field pubchem (`list()`)\cr + #' List of information retrieved from PubChem pubchem = NULL, + + #' @field rdkit + #' List of information obtained with RDKit rdkit = NULL, + + #' @field mol object mol = NULL, + + #' @field svg SVG code svg = NULL, + + #' @field Picture Graph as a \code{\link{picture}} object obtained using grImport Picture = NULL, + + #' @field Pict_font_size Font size as extracted from the intermediate PostScript file Pict_font_size = NULL, + + #' @field pdf_height Height of the MediaBox in the pdf after cropping pdf_height = NULL, + + #' @field p0 Vapour pressure in Pa p0 = NULL, + + #' @field cwsat Water solubility in mg/L cwsat = NULL, + + #' @field PUF Plant uptake factor PUF = NULL, + + #' @field chyaml List of information obtained from a YAML file chyaml = NULL, - initialize = function(identifier, smiles = NULL, smiles_source = 'user', - inchikey = NULL, inchikey_source = 'user', - pubchem = TRUE, pubchem_from = c('name', 'smiles', 'inchikey'), - rdkit = TRUE, template = NULL, - chyaml = TRUE) { - + + #' @description + #' Creates a new instance of this [R6][R6::R6Class] class. + #' + #' @param identifier Identifier to be stored in the object + #' @param smiles Optional user provided SMILES code + #' @param inchikey Optional user provided InChI Key + #' @param pubchem Should an attempt be made to retrieve chemical + #' information from PubChem via the webchem package? + #' @param pubchem_from Possibility to select the argument + #' that is used to query pubchem + #' @param rdkit Should an attempt be made to retrieve chemical + #' information from a local rdkit installation via python + #' and the reticulate package? + #' @param template An optional SMILES code to be used as template for RDKit + #' @param chyaml Should we look for a identifier.yaml file in the working + #' directory? + initialize = function(identifier, smiles = NULL, inchikey = NULL, + pubchem = TRUE, pubchem_from = c('name', 'smiles', 'inchikey'), + rdkit = TRUE, template = NULL, + chyaml = TRUE) { + self$identifier <- identifier names(self$identifier) <- make.names(identifier) pubchem_from = match.arg(pubchem_from) @@ -120,6 +134,10 @@ chent <- R6Class("chent", } invisible(self) }, + + #' Try to get chemical information from PubChem + #' @param query Query string to be passed to [get_cid][webchem::get_cid] + #' @param from Passed to [get_cid][webchem::get_cid] try_pubchem = function(query, from = 'name') { message("PubChem:") if (missing(query)) query <- self$identifier @@ -131,6 +149,9 @@ chent <- R6Class("chent", self$get_pubchem(pubchem_result[[1, "cid"]]) } }, + + #' Get chemical information from PubChem for a known PubChem CID + #' @param pubchem_cid CID get_pubchem = function(pubchem_cid) { self$pubchem = as.list(webchem::pc_prop(pubchem_cid, from = "cid", properties = c("MolecularFormula", "MolecularWeight", @@ -170,6 +191,9 @@ 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) { stop("RDKit is not available") @@ -212,11 +236,18 @@ chent <- R6Class("chent", self$Picture <- readPicture(xmlfile) unlink(c(xmlfile, psfile, svgfile)) }, + + #' Obtain information from a YAML file + #' @param repo Should the file be looked for in the current working + #' directory, a local git repository under `~/git/chyaml`, or from + #' the web (not implemented). get_chyaml = function(repo = c("wd", "local", "web"), - chyaml = paste0(URLencode(self$identifier), ".yaml")) { + chyaml = paste0(URLencode(self$identifier), ".yaml")) + { repo = match.arg(repo) - paths = c(wd = ".", - local = file.path("~", "git/chyaml")) + paths = c( + wd = ".", + local = file.path("~", "git/chyaml")) chyaml_handlers = list( expr = function(x) NULL, # To avoid security risks from reading chyaml files @@ -240,6 +271,13 @@ chent <- R6Class("chent", message("web repositories not implemented") } }, + + #' Add a vapour pressure + #' @param p0 The vapour pressure in Pa + #' @param T Temperature + #' @param source An acronym specifying the source of the information + #' @param page The page from which the information was taken + #' @param remark A remark add_p0 = function(p0, T = NA, source = NA, page = NA, remark = "") { self$p0 <- p0 attr(self$p0, "T") <- T @@ -247,6 +285,9 @@ chent <- R6Class("chent", attr(self$p0, "page") <- page attr(self$p0, "remark") <- remark }, + + #' Add a water solubility + #' @param p0 The water solubility in mg/L add_cwsat = function(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "") { self$cwsat <- cwsat attr(self$cwsat, "T") <- T @@ -255,13 +296,23 @@ chent <- R6Class("chent", attr(self$cwsat, "page") <- page attr(self$cwsat, "remark") <- remark }, + + #' Add a plant uptake factor + #' @param PUF The plant uptake factor, a number between 0 and 1 add_PUF = function(PUF = 0, source = "focus_generic_gw_2014", page = 41, remark = "Conservative default value") { self$PUF <- PUF attr(self$PUF, "source") <- source attr(self$PUF, "page") <- page attr(self$PUF, "remark") <- remark }, + + #' @field TPs List of transformation products as chent objects TPs = list(), + + #' Add a transformation product to the internal list + #' @param x A [chent] object, or an identifier to generate a [chent] object + #' @param smiles A SMILES code for defining a [chent] object + #' @param pubchem Should chemical information be obtained from PubChem? add_TP = function(x, smiles = NULL, pubchem = FALSE) { if (inherits(x, "chent")) { id <- names(x$identifier) @@ -272,14 +323,19 @@ chent <- R6Class("chent", } self$TPs[[id]] <- chent }, + + #' @field transformations Data frame of observed transformations transformations = data.frame(study_type = character(0), TP_identifier = character(0), max_occurrence = numeric(0), source = character(0), pages = character(0), stringsAsFactors = FALSE), + + #' Add a line in the internal dataframe holding observed transformations add_transformation = function(study_type, TP_identifier, max_occurrence, - remark = "", source = NA, pages = NA) { + remark = "", source = NA, pages = NA) + { TP_name = make.names(TP_identifier) if (!inherits(self$TPs[[TP_name]], "chent")) { stop(paste("Please add the TP", TP_identifier, "first using chent$add_TP()")) @@ -296,15 +352,20 @@ chent <- R6Class("chent", pages = pages, stringsAsFactors = FALSE)) }, + + #' @field soil_degradation Dataframe of modelling DT50 values soil_degradation = NULL, + + #' Add a line in the internal dataframe holding modelling DT50 values add_soil_degradation = function(soils, DT50_mod, DT50_mod_ref, - type = NA, country = NA, - pH_orig = NA, pH_medium = NA, pH_H2O = NA, - perc_OC = NA, - temperature = NA, moisture = NA, - category = "lab", formulation = NA, - model = NA, chi2 = NA, - remark = "", source, page = NA) { + type = NA, country = NA, + pH_orig = NA, pH_medium = NA, pH_H2O = NA, + perc_OC = NA, + temperature = NA, moisture = NA, + category = "lab", formulation = NA, + model = NA, chi2 = NA, + remark = "", source, page = NA) + { new_soil_degradation = data.frame( soil = soils, DT50_mod = DT50_mod, @@ -331,9 +392,13 @@ chent <- R6Class("chent", self$soil_degradation <- rbind(self$soil_degradation, new_soil_degradation) } }, + + #' @field soil_ff Dataframe of formation fractions soil_ff = NULL, + add_soil_ff = function(target, soils, ff = 1, remark = "", source, page = NA) { new_soil_ff = data.frame( + target = target, target = target, soil = soils, ff = ff, @@ -347,7 +412,10 @@ chent <- R6Class("chent", self$soil_ff <- rbind(self$soil_ff, new_soil_ff) } }, + + #' @field soil_sorption Dataframe of soil sorption data soil_sorption = NULL, + add_soil_sorption = function(soils, Kf, Kfoc, N, type = NA, pH_orig = NA, pH_medium = NA, @@ -372,8 +440,9 @@ chent <- R6Class("chent", self$soil_sorption <- rbind(self$soil_sorption, new_soil_sorption) } }, - pdf = function(file = paste0(self$identifier, ".pdf"), dir = "structures/pdf", - template = NULL) { + + pdf = function(file = paste0(self$identifier, ".pdf"), + dir = "structures/pdf", template = NULL) { if (!dir.exists(dir)) { message("Directory '", dir, "' does not exist") message("Trying to create directory '", dir, "'") @@ -493,7 +562,6 @@ plot.chent = function(x, ...) { #' @format An \code{\link{R6Class}} generator object #' @field iso ISO common name according to ISO 1750 as retreived from pesticidecompendium.bcpc.org #' @field bcpc List of information retrieved from pesticidecompendium.bcpc.org -#' @keywords data #' @examples #' # On Travis, we get a certificate validation error, #' # likely because the system (xenial) is so old, @@ -507,15 +575,14 @@ plot.chent = function(x, ...) { #' } #' #' } - pai <- R6Class("pai", inherit = chent, public <- list( iso = NULL, bcpc = NULL, initialize = function(iso, identifier = iso, - smiles = NULL, smiles_source = 'user', - inchikey = NULL, inchikey_source = 'user', + smiles = NULL, + inchikey = NULL, bcpc = TRUE, pubchem = TRUE, pubchem_from = 'auto', rdkit = TRUE, template = NULL, @@ -564,7 +631,7 @@ pai <- R6Class("pai", } super$initialize(identifier = identifier, - smiles = smiles, smiles_source = smiles_source, + smiles = smiles, inchikey = self$inchikey, pubchem = pubchem, pubchem_from = pubchem_from, rdkit = rdkit, template = template, chyaml = chyaml) diff --git a/chents.Rproj b/chents.Rproj new file mode 100644 index 0000000..8de5cfd --- /dev/null +++ b/chents.Rproj @@ -0,0 +1,19 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/docs/404.html b/docs/404.html index 7bd3245..eb79a5d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - -
-
- + +
+ + + - - -
+
+
-
- +
+ + - - diff --git a/docs/authors.html b/docs/authors.html index 327fe56..0c3b654 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • chents - + + - - - - -
-
-
- -
+
- @@ -123,22 +76,20 @@ -
- +
- - + + diff --git a/docs/index.html b/docs/index.html index c4ad646..f241bb6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,14 +16,15 @@ data as R objects. If Python and RDKit (> 2015.03) are installed and configured for use with reticulate, some basic chemoinformatics functions like the calculation of molecular weight and plotting of chemical - structures in R graphics are available. For plotting, you need - grConvert (https://sjp.co.nz/projects/grconvert) which is not on CRAN."> + structures in R graphics are available."> + +
-
- - +
+ +

Build Status codecov

The R package chents provides some utilities for working with chemical entities in R.

-
-

-Features

+
+

Features +

  • Some chemical information is retrieved from the PubChem website using the webchem package
  • If Python and RDKit (> 2015.03) are installed and configured for use with ‘reticulate’, some basic chemoinformatics functions some additional chemical information is computed and a 2D graph can be plotted
  • Additional information can be read from a local .yaml file
-
-

-Examples

-

Some examples are available from the reference on jrwb.de.

+
+

Examples +

+

Some examples are available from the reference on jrwb.de.

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.7.

@@ -139,5 +140,7 @@ + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index 1273238..80ea5b8 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -56,8 +56,10 @@ img.icon { float: right; } -img { +/* Ensure in-page images don't run outside their container */ +.contents img { max-width: 100%; + height: auto; } /* Fix bug in bootstrap (only seen in firefox) */ @@ -78,11 +80,10 @@ dd { /* Section anchors ---------------------------------*/ a.anchor { - margin-left: -30px; - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; + display: none; + margin-left: 5px; + width: 20px; + height: 20px; background-image: url(./link.svg); background-repeat: no-repeat; @@ -90,17 +91,15 @@ a.anchor { background-position: center center; } -.hasAnchor:hover a.anchor { - visibility: visible; -} - -@media (max-width: 767px) { - .hasAnchor:hover a.anchor { - visibility: hidden; - } +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-block; } - /* Fixes for fixed navbar --------------------------*/ .contents h1, .contents h2, .contents h3, .contents h4 { @@ -264,31 +263,26 @@ table { /* Syntax highlighting ---------------------------------------------------- */ -pre { - word-wrap: normal; - word-break: normal; - border: 1px solid #eee; -} - -pre, code { +pre, code, pre code { background-color: #f8f8f8; color: #333; } +pre, pre code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; +} -pre code { - overflow: auto; - word-wrap: normal; - white-space: pre; +pre { + border: 1px solid #eee; } -pre .img { +pre .img, pre .r-plt { margin: 5px 0; } -pre .img img { +pre .img img, pre .r-plt img { background-color: #fff; - display: block; - height: auto; } code a, pre a { @@ -305,9 +299,8 @@ a.sourceLine:hover { .kw {color: #264D66;} /* keyword */ .co {color: #888888;} /* comment */ -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: #6A0366; font-weight: bolder;} +.error {font-weight: bolder;} +.warning {font-weight: bolder;} /* Clipboard --------------------------*/ @@ -365,3 +358,27 @@ mark { content: ""; } } + +/* Section anchors --------------------------------- + Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 +*/ + +div.csl-bib-body { } +div.csl-entry { + clear: both; +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 7e7048f..6f0eee4 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -80,7 +80,7 @@ $(document).ready(function() { var copyButton = ""; - $(".examples, div.sourceCode").addClass("hasCopyButton"); + $("div.sourceCode").addClass("hasCopyButton"); // Insert copy buttons: $(copyButton).prependTo(".hasCopyButton"); @@ -91,7 +91,7 @@ // Initialize clipboard: var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { - return trigger.parentNode.textContent; + return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); } }); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 098ab97..dd7c4f0 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,6 +1,6 @@ -pandoc: 2.9.2.1 -pkgdown: 1.6.1 +pandoc: 3.1.1 +pkgdown: 2.0.7 pkgdown_sha: ~ articles: {} -last_built: 2021-11-26T15:14Z +last_built: 2023-11-10T17:41Z diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png index 377b927..d92e93f 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/chent-1.png b/docs/reference/chent-1.png index 7229a66..acab3e6 100644 Binary files a/docs/reference/chent-1.png and b/docs/reference/chent-1.png differ diff --git a/docs/reference/chent.html b/docs/reference/chent.html index 941eabb..a6b8dde 100644 --- a/docs/reference/chent.html +++ b/docs/reference/chent.html @@ -1,69 +1,14 @@ - - - - - - - -An R6 class for chemical entities with associated data — chent • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -An R6 class for chemical entities with associated data — chent • chents - - - - + + -
-
- -
- -
+
-

The class is initialised with an identifier. Chemical information is retrieved from -the internet. Additionally, it can be generated using RDKit if RDKit and its -python bindings are installed.

+

The class is initialised with an identifier. Chemical +information is retrieved from the internet. Additionally, it can be +generated using RDKit if RDKit and its python bindings are installed.

+
+

Format

+

An R6Class generator object

+
+
+

Public fields

+

identifier
+

(character(1))
+The identifier that was used to initiate the object, with attribute 'source'

-

Format

-

An R6Class generator object

-

Public fields

+
inchikey
+

(character(1))
+InChI Key, with attribute 'source'

+ + +
smiles
+

(character())
+SMILES code(s), with attribute 'source'

+ + +
mw
+

(numeric(1))
+Molecular weight, with attribute 'source'

+ + +
pubchem
+

(list())
+List of information retrieved from PubChem

+ -

-
identifier

The identifier that was used to initiate the object, with attribute 'source'

+
rdkit
+

List of information obtained with RDKit

-
inchikey

InChI Key, with attribute 'source'

-
smiles

SMILES code, with attribute 'source'

+
mol
+

<rdkit.Chem.rdchem.Mol> object

-
mw

Molecular weight, with attribute 'source'

-
pubchem

List of information retreived from PubChem

+
svg
+

SVG code

-
rdkit

List of information obtained with RDKit

-
mol

<rdkit.Chem.rdchem.Mol> object

+
Picture
+

Graph as a picture object obtained using grImport

-
svg

SVG code

-
Picture

Graph as a picture object obtained using grImport

+
Pict_font_size
+

Font size as extracted from the intermediate PostScript file

-
Pict_font_size

Font size as extracted from the intermediate PostScript file

-
pdf_height

Height of the MediaBox in the pdf after cropping

+
pdf_height
+

Height of the MediaBox in the pdf after cropping

-
p0

Vapour pressure in Pa

-
cwsat

Water solubility in mg/L

+
p0
+

Vapour pressure in Pa

-
chyaml

List of information obtained from a YAML file

-
soil_degradation

Dataframe of modelling DT50 values

+
cwsat
+

Water solubility in mg/L

-
soil_ff

Dataframe of formation fractions

-
soil_sorption

Dataframe of soil sorption data

+
PUF
+

Plant uptake factor

-
PUF

Plant uptake factor

-

-

Methods

+
chyaml
+

List of information obtained from a YAML file

+ +
TPs
+

List of transformation products as chent objects

+ + +
transformations
+

Data frame of observed transformations

+ + +
soil_degradation
+

Dataframe of modelling DT50 values

+ + +
soil_ff
+

Dataframe of formation fractions

+ + +
soil_sorption
+

Dataframe of soil sorption data

+ + +

+
+
+

Methods

-

Public methods

- - -


-

Method new()

- -

Usage

-

chent$new(
-  identifier,
-  smiles = NULL,
-  smiles_source = "user",
-  inchikey = NULL,
-  inchikey_source = "user",
-  pubchem = TRUE,
-  pubchem_from = c("name", "smiles", "inchikey"),
-  rdkit = TRUE,
-  template = NULL,
-  chyaml = TRUE
-)

- -


-

Method try_pubchem()

- -

Usage

-

chent$try_pubchem(query, from = "name")

- -


-

Method get_pubchem()

- -

Usage

-

chent$get_pubchem(pubchem_cid)

- -


-

Method get_rdkit()

- -

Usage

-

chent$get_rdkit(template = NULL)

- -


-

Method get_chyaml()

- -

Usage

-

chent$get_chyaml(
-  repo = c("wd", "local", "web"),
-  chyaml = paste0(URLencode(self$identifier), ".yaml")
-)

- -


-

Method add_p0()

- -

Usage

-

chent$add_p0(p0, T = NA, source = NA, page = NA, remark = "")

- -


-

Method add_cwsat()

- -

Usage

-

chent$add_cwsat(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "")

- -


-

Method add_PUF()

- -

Usage

-

chent$add_PUF(
-  PUF = 0,
-  source = "focus_generic_gw_2014",
-  page = 41,
-  remark = "Conservative default value"
-)

- -


-

Method add_TP()

- -

Usage

-

chent$add_TP(x, smiles = NULL, pubchem = FALSE)

- -


-

Method add_transformation()

- -

Usage

-

chent$add_transformation(
-  study_type,
-  TP_identifier,
-  max_occurrence,
-  remark = "",
-  source = NA,
-  pages = NA
-)

- -


-

Method add_soil_degradation()

- -

Usage

-

chent$add_soil_degradation(
-  soils,
-  DT50_mod,
-  DT50_mod_ref,
-  type = NA,
-  country = NA,
-  pH_orig = NA,
-  pH_medium = NA,
-  pH_H2O = NA,
-  perc_OC = NA,
-  temperature = NA,
-  moisture = NA,
-  category = "lab",
-  formulation = NA,
-  model = NA,
-  chi2 = NA,
-  remark = "",
-  source,
-  page = NA
-)

- -


-

Method add_soil_ff()

- -

Usage

-

chent$add_soil_ff(target, soils, ff = 1, remark = "", source, page = NA)

- -


-

Method add_soil_sorption()

- -

Usage

-

chent$add_soil_sorption(
-  soils,
-  Kf,
-  Kfoc,
-  N,
-  type = NA,
-  pH_orig = NA,
-  pH_medium = NA,
-  pH_H2O = NA,
-  perc_OC = NA,
-  perc_clay = NA,
-  CEC = NA,
-  remark = "",
-  source,
-  page = NA
-)

- -


-

Method pdf()

- -

Usage

-

chent$pdf(
-  file = paste0(self$identifier, ".pdf"),
-  dir = "structures/pdf",
-  template = NULL
-)

- -


-

Method png()

- -

Usage

-

chent$png(
-  file = paste0(self$identifier, ".png"),
-  dir = "structures/png",
-  antialias = "gray"
-)

- -


-

Method emf()

- -

Usage

-

chent$emf(file = paste0(self$identifier, ".emf"), dir = "structures/emf")

- -


-

Method clone()

-

The objects of this class are cloneable with this method.

Usage

-

chent$clone(deep = FALSE)

- -

Arguments

-

-
deep

Whether to make a deep clone.

- -

- - - -

Examples

-
oct <- chent$new("1-octanol", smiles = "CCCCCCCCO") -
#> PubChem:
#> Trying to get chemical information from RDKit using user SMILES -#> CCCCCCCCO
#> Did not find chyaml file ./1-octanol.yaml
print(oct) -
#> <chent> -#> Identifier $identifier 1-octanol -#> InChI Key $inchikey KBPLFHHGFOOTCA-UHFFFAOYSA-N -#> SMILES string $smiles: -#> user PubChem_Canonical -#> "CCCCCCCCO" "CCCCCCCCO" -#> Molecular weight $mw: 130.2 -#> PubChem synonyms (up to 10): -#> [1] "1-octanol" "Octan-1-ol" "octanol" "111-87-5" -#> [5] "N-octanol" "Octyl alcohol" "Capryl alcohol" "caprylic alcohol" -#> [9] "n-Octyl alcohol" "Heptyl carbinol"
if (!is.null(oct$Picture)) { - plot(oct) -} -
-caffeine <- chent$new("caffeine") -
#> PubChem:
#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES -#> CN1C=NC2=C1C(=O)N(C(=O)N2C)C
#> Did not find chyaml file ./caffeine.yaml
print(caffeine) -
#> <chent> -#> Identifier $identifier caffeine -#> InChI Key $inchikey RYYVLZVUVIJVGH-UHFFFAOYSA-N -#> SMILES string $smiles: -#> PubChem_Canonical -#> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" -#> Molecular weight $mw: 194.2 -#> PubChem synonyms (up to 10): -#> [1] "caffeine" "58-08-2" -#> [3] "1,3,7-Trimethylxanthine" "Guaranine" -#> [5] "Thein" "Methyltheobromine" -#> [7] "Cafeina" "Theine" -#> [9] "Koffein" "Mateina"
if (!is.null(caffeine$Picture)) { - plot(caffeine) -} -
+


+

Method new()

+

Creates a new instance of this R6 class.

+

Usage

+

chent$new(
+  identifier,
+  smiles = NULL,
+  inchikey = NULL,
+  pubchem = TRUE,
+  pubchem_from = c("name", "smiles", "inchikey"),
+  rdkit = TRUE,
+  template = NULL,
+  chyaml = TRUE
+)

+
+ +
+

Arguments

+

identifier
+

Identifier to be stored in the object

+ + +
smiles
+

Optional user provided SMILES code

+ + +
inchikey
+

Optional user provided InChI Key

+ + +
pubchem
+

Should an attempt be made to retrieve chemical +information from PubChem via the webchem package?

+ + +
pubchem_from
+

Possibility to select the argument +that is used to query pubchem

+ + +
rdkit
+

Should an attempt be made to retrieve chemical +information from a local rdkit installation via python +and the reticulate package?

+ + +
template
+

An optional SMILES code to be used as template for RDKit

+ + +
chyaml
+

Should we look for a identifier.yaml file in the working +directory? +Try to get chemical information from PubChem

+ + +

+
+ +


+

Method try_pubchem()

+ +
+

Usage

+

chent$try_pubchem(query, from = "name")

+
+ +
+

Arguments

+

query
+

Query string to be passed to get_cid

+ + +
from
+

Passed to get_cid +Get chemical information from PubChem for a known PubChem CID

+ + +

+
+ +


+

Method get_pubchem()

+ +
+

Usage

+

chent$get_pubchem(pubchem_cid)

+
+ +
+

Arguments

+

pubchem_cid
+

CID

+ + +

+
+ +


+

Method get_rdkit()

+ +
+

Usage

+

chent$get_rdkit(template = NULL)

+
+ + +


+

Method get_chyaml()

+ +
+

Usage

+

chent$get_chyaml(
+  repo = c("wd", "local", "web"),
+  chyaml = paste0(URLencode(self$identifier), ".yaml")
+)

+
+ + +


+

Method add_p0()

+ +
+

Usage

+

chent$add_p0(p0, T = NA, source = NA, page = NA, remark = "")

+
+ + +


+

Method add_cwsat()

+ +
+

Usage

+

chent$add_cwsat(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "")

+
+ + +


+

Method add_PUF()

+ +
+

Usage

+

chent$add_PUF(
+  PUF = 0,
+  source = "focus_generic_gw_2014",
+  page = 41,
+  remark = "Conservative default value"
+)

+
+ + +


+

Method add_TP()

+ +
+

Usage

+

chent$add_TP(x, smiles = NULL, pubchem = FALSE)

+
+ + +


+

Method add_transformation()

+ +
+

Usage

+

chent$add_transformation(
+  study_type,
+  TP_identifier,
+  max_occurrence,
+  remark = "",
+  source = NA,
+  pages = NA
+)

+
+ + +


+

Method add_soil_degradation()

+ +
+

Usage

+

chent$add_soil_degradation(
+  soils,
+  DT50_mod,
+  DT50_mod_ref,
+  type = NA,
+  country = NA,
+  pH_orig = NA,
+  pH_medium = NA,
+  pH_H2O = NA,
+  perc_OC = NA,
+  temperature = NA,
+  moisture = NA,
+  category = "lab",
+  formulation = NA,
+  model = NA,
+  chi2 = NA,
+  remark = "",
+  source,
+  page = NA
+)

+
+ + +


+

Method add_soil_ff()

+ +
+

Usage

+

chent$add_soil_ff(target, soils, ff = 1, remark = "", source, page = NA)

+
+ + +


+

Method add_soil_sorption()

+ +
+

Usage

+

chent$add_soil_sorption(
+  soils,
+  Kf,
+  Kfoc,
+  N,
+  type = NA,
+  pH_orig = NA,
+  pH_medium = NA,
+  pH_H2O = NA,
+  perc_OC = NA,
+  perc_clay = NA,
+  CEC = NA,
+  remark = "",
+  source,
+  page = NA
+)

+
+ + +


+

Method pdf()

+ +
+

Usage

+

chent$pdf(
+  file = paste0(self$identifier, ".pdf"),
+  dir = "structures/pdf",
+  template = NULL
+)

+
+ + +


+

Method png()

+ +
+

Usage

+

chent$png(
+  file = paste0(self$identifier, ".png"),
+  dir = "structures/png",
+  antialias = "gray"
+)

+
+ + +


+

Method emf()

+ +
+

Usage

+

chent$emf(file = paste0(self$identifier, ".emf"), dir = "structures/emf")

+
+ + +


+

Method clone()

+

The objects of this class are cloneable with this method.

+

Usage

+

chent$clone(deep = FALSE)

+
+ +
+

Arguments

+

deep
+

Whether to make a deep clone.

+ + +

+
+ +
+ +
+ +
+

Examples

+
oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE)
+#> Trying to get chemical information from RDKit using user SMILES
+#> CCCCCCCCO
+#> Did not find chyaml file ./1-octanol.yaml
+print(oct)
+#> <chent>
+#> Identifier $identifier 1-octanol 
+#> InChI Key $inchikey 
+#> SMILES string $smiles:
+#>        user 
+#> "CCCCCCCCO" 
+#> Molecular weight $mw: 130.2 
+if (!is.null(oct$Picture)) {
+  plot(oct)
+}
+
+caffeine <- chent$new("caffeine")
+#> PubChem:
+#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES
+#> CN1C=NC2=C1C(=O)N(C(=O)N2C)C
+#> Did not find chyaml file ./caffeine.yaml
+print(caffeine)
+#> <chent>
+#> Identifier $identifier caffeine 
+#> InChI Key $inchikey RYYVLZVUVIJVGH-UHFFFAOYSA-N 
+#> SMILES string $smiles:
+#>              PubChem_Canonical 
+#> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" 
+#> Molecular weight $mw: 194.2 
+#> PubChem synonyms (up to 10):
+#>  [1] "caffeine"                "58-08-2"                
+#>  [3] "Guaranine"               "1,3,7-Trimethylxanthine"
+#>  [5] "Methyltheobromine"       "Theine"                 
+#>  [7] "Thein"                   "Cafeina"                
+#>  [9] "Koffein"                 "Mateina"                
+if (!is.null(caffeine$Picture)) {
+  plot(caffeine)
+}
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/draw_svg.chent.html b/docs/reference/draw_svg.chent.html index 1805ff1..cae8c0b 100644 --- a/docs/reference/draw_svg.chent.html +++ b/docs/reference/draw_svg.chent.html @@ -1,67 +1,12 @@ - - - - - - - -Draw SVG graph from a chent object using RDKit — draw_svg.chent • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Draw SVG graph from a chent object using RDKit — draw_svg.chent • chents - + + - - - -
-
- -
- -
+
@@ -117,65 +49,60 @@

Draw SVG graph from a chent object using RDKit

-
draw_svg.chent(
-  x,
-  width = 300,
-  height = 150,
-  filename = paste0(names(x$identifier), ".svg"),
-  subdir = "svg"
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
x

The chent object to be plotted

width

The desired width in pixels

height

The desired height in pixels

filename

The filename

subdir

The path to which the file should be written

+
+
draw_svg.chent(
+  x,
+  width = 300,
+  height = 150,
+  filename = paste0(names(x$identifier), ".svg"),
+  subdir = "svg"
+)
+
+ +
+

Arguments

+
x
+

The chent object to be plotted

+ +
width
+

The desired width in pixels

+ + +
height
+

The desired height in pixels

+ + +
filename
+

The filename

+ + +
subdir
+

The path to which the file should be written

+ +
+
-
- +
- - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 9de4a87..d9eb797 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • chents - - + + - - -
-
- -
- -
+
- - - - - - - - - - -
-

R6 Class definitions and methods

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+

R6 Class definitions and methods

+

chent

An R6 class for chemical entities with associated data

+

draw_svg.chent()

Draw SVG graph from a chent object using RDKit

+

plot(<chent>)

Plot method for chent objects

+

print(<chent>)

Printing method for chent objects

+

pai

An R6 class for pesticidal active ingredients and associated data

+

print(<pai>)

Printing method for pai objects (pesticidal active ingredients)

+

pp

R6 class for holding a product with at least one active ingredient

- +
+
-
- +
- - + + diff --git a/docs/reference/pai-1.png b/docs/reference/pai-1.png index c235304..802fd50 100644 Binary files a/docs/reference/pai-1.png and b/docs/reference/pai-1.png differ diff --git a/docs/reference/pai.html b/docs/reference/pai.html index 0bb3399..636007f 100644 --- a/docs/reference/pai.html +++ b/docs/reference/pai.html @@ -1,68 +1,13 @@ - - - - - - - -An R6 class for pesticidal active ingredients and associated data — pai • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -An R6 class for pesticidal active ingredients and associated data — pai • chents - - - - + + -
-
- -
- -
+
@@ -120,132 +52,143 @@ Additional chemical information is retrieved from the internet if available.

+
+

Format

+

An R6Class generator object

+
+
+

Super class

+

chents::chent -> pai

+
+
+

Public fields

+

iso
+

ISO common name according to ISO 1750 as retreived from pesticidecompendium.bcpc.org

+ + +
bcpc
+

List of information retrieved from pesticidecompendium.bcpc.org

-

Format

-

An R6Class generator object

-

Super class

+

+
+
+

Methods

+ +
+

Public methods

+ +

Inherited methods


+

Method new()

+ +
+

Usage

+

pai$new(
+  iso,
+  identifier = iso,
+  smiles = NULL,
+  inchikey = NULL,
+  bcpc = TRUE,
+  pubchem = TRUE,
+  pubchem_from = "auto",
+  rdkit = TRUE,
+  template = NULL,
+  chyaml = TRUE
+)

+
-

chents::chent -> pai

-

Public fields

-

-
iso

ISO common name according to ISO 1750 as retreived from pesticidecompendium.bcpc.org

+


+

Method clone()

+

The objects of this class are cloneable with this method.

+

Usage

+

pai$clone(deep = FALSE)

+
-
bcpc

List of information retrieved from pesticidecompendium.bcpc.org

+
+

Arguments

+

deep
+

Whether to make a deep clone.

-

-

Methods

- -

Public methods

- - -

Inherited methods - -
- -
-

Method new()

- -

Usage

-

pai$new(
-  iso,
-  identifier = iso,
-  smiles = NULL,
-  smiles_source = "user",
-  inchikey = NULL,
-  inchikey_source = "user",
-  bcpc = TRUE,
-  pubchem = TRUE,
-  pubchem_from = "auto",
-  rdkit = TRUE,
-  template = NULL,
-  chyaml = TRUE
-)

- -


-

Method clone()

-

The objects of this class are cloneable with this method.

Usage

-

pai$clone(deep = FALSE)

- -

Arguments

-

-
deep

Whether to make a deep clone.

- -

- - - -

Examples

-
# On Travis, we get a certificate validation error, -# likely because the system (xenial) is so old, -# therefore don't run this example on Travis -if (Sys.getenv("TRAVIS") == "") { - -atr <- pai$new("atrazine") -print(atr) -if (!is.null(atr$Picture)) { - plot(atr) -} - -} -
#> BCPC:
#> PubChem:
#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES -#> CCNC1=NC(=NC(=N1)Cl)NC(C)C
#> Did not find chyaml file ./atrazine.yaml
#> <pai> with ISO common name $iso atrazine -#> <chent> -#> Identifier $identifier atrazine -#> InChI Key $inchikey MXWJVTOOROXGIU-UHFFFAOYSA-N -#> SMILES string $smiles: -#> PubChem_Canonical -#> "CCNC1=NC(=NC(=N1)Cl)NC(C)C" -#> Molecular weight $mw: 215.7 -#> PubChem synonyms (up to 10): -#> [1] "atrazine" "1912-24-9" "Gesaprim" "Oleogesaprim" "Chromozin" -#> [6] "Aktikon" "Atrazin" "Argezin" "Atazinax" "Atranex"
+

+
+ +
+ +
+ +
+

Examples

+
# On Travis, we get a certificate validation error,
+# likely because the system (xenial) is so old,
+# therefore don't run this example on Travis
+if (Sys.getenv("TRAVIS") == "") {
+
+atr <- pai$new("atrazine")
+print(atr)
+if (!is.null(atr$Picture)) {
+  plot(atr)
+}
+
+}
+#> BCPC:
+#> PubChem:
+#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES
+#> CCNC1=NC(=NC(=N1)Cl)NC(C)C
+#> Did not find chyaml file ./atrazine.yaml
+
+#> <pai> with ISO common name $iso atrazine 
+#> <chent>
+#> Identifier $identifier atrazine 
+#> InChI Key $inchikey MXWJVTOOROXGIU-UHFFFAOYSA-N 
+#> SMILES string $smiles:
+#>            PubChem_Canonical 
+#> "CCNC1=NC(=NC(=N1)Cl)NC(C)C" 
+#> Molecular weight $mw: 215.7 
+#> PubChem synonyms (up to 10):
+#>  [1] "atrazine"     "1912-24-9"    "Gesaprim"     "Oleogesaprim" "Aktikon"     
+#>  [6] "Atranex"      "Chromozin"    "Atazinax"     "Atrasine"     "Gesoprim"    
+
+
+
-
- +
- - + + diff --git a/docs/reference/plot.chent-1.png b/docs/reference/plot.chent-1.png index 330f0a5..1e8885d 100644 Binary files a/docs/reference/plot.chent-1.png and b/docs/reference/plot.chent-1.png differ diff --git a/docs/reference/plot.chent.html b/docs/reference/plot.chent.html index 62bf38f..470ce79 100644 --- a/docs/reference/plot.chent.html +++ b/docs/reference/plot.chent.html @@ -1,67 +1,12 @@ - - - - - - - -Plot method for chent objects — plot.chent • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot method for chent objects — plot.chent • chents - + + - - - -
-
- -
- -
+
@@ -117,68 +49,70 @@

Plot method for chent objects

-
# S3 method for chent
-plot(x, ...)
- -

Arguments

- - - - - - - - - - -
x

The chent object to be plotted

...

Further arguments passed to grid.picture

- - -

Examples

-
caffeine <- chent$new("caffeine") -
#> PubChem:
#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES -#> CN1C=NC2=C1C(=O)N(C(=O)N2C)C
#> Did not find chyaml file ./caffeine.yaml
print(caffeine) -
#> <chent> -#> Identifier $identifier caffeine -#> InChI Key $inchikey RYYVLZVUVIJVGH-UHFFFAOYSA-N -#> SMILES string $smiles: -#> PubChem_Canonical -#> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" -#> Molecular weight $mw: 194.2 -#> PubChem synonyms (up to 10): -#> [1] "caffeine" "58-08-2" -#> [3] "1,3,7-Trimethylxanthine" "Guaranine" -#> [5] "Thein" "Methyltheobromine" -#> [7] "Cafeina" "Theine" -#> [9] "Koffein" "Mateina"
if (!is.null(caffeine$Picture)) { - plot(caffeine) -} -
+
+
# S3 method for chent
+plot(x, ...)
+
+ +
+

Arguments

+
x
+

The chent object to be plotted

+ + +
...
+

Further arguments passed to grid.picture

+ +
+ +
+

Examples

+
caffeine <- chent$new("caffeine")
+#> PubChem:
+#> Trying to get chemical information from RDKit using PubChem_Canonical SMILES
+#> CN1C=NC2=C1C(=O)N(C(=O)N2C)C
+#> Did not find chyaml file ./caffeine.yaml
+print(caffeine)
+#> <chent>
+#> Identifier $identifier caffeine 
+#> InChI Key $inchikey RYYVLZVUVIJVGH-UHFFFAOYSA-N 
+#> SMILES string $smiles:
+#>              PubChem_Canonical 
+#> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" 
+#> Molecular weight $mw: 194.2 
+#> PubChem synonyms (up to 10):
+#>  [1] "caffeine"                "58-08-2"                
+#>  [3] "Guaranine"               "1,3,7-Trimethylxanthine"
+#>  [5] "Methyltheobromine"       "Theine"                 
+#>  [7] "Thein"                   "Cafeina"                
+#>  [9] "Koffein"                 "Mateina"                
+if (!is.null(caffeine$Picture)) {
+  plot(caffeine)
+}
+
+
+
+
-
- +
- - + + diff --git a/docs/reference/pp.html b/docs/reference/pp.html index c4e4a01..2607035 100644 --- a/docs/reference/pp.html +++ b/docs/reference/pp.html @@ -1,67 +1,12 @@ - - - - - - - -R6 class for holding a product with at least one active ingredient — pp • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -R6 class for holding a product with at least one active ingredient — pp • chents - - - - + + -
-
- -
- -
+
@@ -118,89 +50,105 @@
+
+

Format

+

An R6Class generator object.

+
+
+

Public fields

+

name
+

The name of the product

-

Format

-

An R6Class generator object.

-

Public fields

+
ais
+

A list of active ingredients

-

-
name

The name of the product

-
ais

A list of active ingredients

+
concentrations
+

The concentration of the ais

-
concentrations

The concentration of the ais

-
concentration_units

Defaults to g/L

+
concentration_units
+

Defaults to g/L

-

-

Methods

+

+
+
+

Methods

-

Public methods

+
+

Public methods

+ +


+

Method new()

+ +
+

Usage

+

pp$new(
+  name,
+  ...,
+  concentrations,
+  concentration_units = "g/L",
+  density = 1000,
+  density_units = "g/L"
+)

+
- -


-

Method new()

-

Usage

-

pp$new(
-  name,
-  ...,
-  concentrations,
-  concentration_units = "g/L",
-  density = 1000,
-  density_units = "g/L"
-)

+


+

Method print()

-


-

Method print()

+
+

Usage

+

pp$print()

+
-

Usage

-

pp$print()

-


-

Method clone()

-

The objects of this class are cloneable with this method.

Usage

-

pp$clone(deep = FALSE)

+


+

Method clone()

+

The objects of this class are cloneable with this method.

+

Usage

+

pp$clone(deep = FALSE)

+
+ +
+

Arguments

+

deep
+

Whether to make a deep clone.

-

Arguments

-

-
deep

Whether to make a deep clone.

-

+

+
+
+
+
-
- +
- - + + diff --git a/docs/reference/print.chent.html b/docs/reference/print.chent.html index b188ed9..08497dd 100644 --- a/docs/reference/print.chent.html +++ b/docs/reference/print.chent.html @@ -1,67 +1,12 @@ - - - - - - - -Printing method for chent objects — print.chent • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Printing method for chent objects — print.chent • chents - + + - - - -
-
- -
- -
+
@@ -117,48 +49,43 @@

Printing method for chent objects

-
# S3 method for chent
-print(x, ...)
+
+
# S3 method for chent
+print(x, ...)
+
+ +
+

Arguments

+
x
+

The chent object to be printed

+ -

Arguments

- - - - - - - - - - -
x

The chent object to be printed

...

Further arguments for compatibility with the S3 method

+
...
+

Further arguments for compatibility with the S3 method

+
+
-
- +
- - + + diff --git a/docs/reference/print.pai.html b/docs/reference/print.pai.html index 284792f..3faa5f7 100644 --- a/docs/reference/print.pai.html +++ b/docs/reference/print.pai.html @@ -1,67 +1,12 @@ - - - - - - - -Printing method for pai objects (pesticidal active ingredients) — print.pai • chents - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Printing method for pai objects (pesticidal active ingredients) — print.pai • chents - + + - - - -
-
- -
- -
+
@@ -117,48 +49,43 @@

Printing method for pai objects (pesticidal active ingredients)

-
# S3 method for pai
-print(x, ...)
+
+
# S3 method for pai
+print(x, ...)
+
+ +
+

Arguments

+
x
+

The chent object to be printed

+ -

Arguments

- - - - - - - - - - -
x

The chent object to be printed

...

Further arguments for compatibility with the S3 method

+
...
+

Further arguments for compatibility with the S3 method

+
+
-
- +
- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..986ccf3 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,36 @@ + + + + /404.html + + + /authors.html + + + /index.html + + + /reference/chent.html + + + /reference/draw_svg.chent.html + + + /reference/index.html + + + /reference/pai.html + + + /reference/plot.chent.html + + + /reference/pp.html + + + /reference/print.chent.html + + + /reference/print.pai.html + + diff --git a/man/chent.Rd b/man/chent.Rd index 15fbc54..e069938 100644 --- a/man/chent.Rd +++ b/man/chent.Rd @@ -7,12 +7,12 @@ An \code{\link{R6Class}} generator object } \description{ -The class is initialised with an identifier. Chemical information is retrieved from -the internet. Additionally, it can be generated using RDKit if RDKit and its -python bindings are installed. +The class is initialised with an identifier. Chemical +information is retrieved from the internet. Additionally, it can be +generated using RDKit if RDKit and its python bindings are installed. } \examples{ -oct <- chent$new("1-octanol", smiles = "CCCCCCCCO") +oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE) print(oct) if (!is.null(oct$Picture)) { plot(oct) @@ -24,19 +24,23 @@ if (!is.null(caffeine$Picture)) { plot(caffeine) } } -\keyword{data} \section{Public fields}{ \if{html}{\out{
}} \describe{ -\item{\code{identifier}}{The identifier that was used to initiate the object, with attribute 'source'} +\item{\code{identifier}}{(\code{character(1)})\cr +The identifier that was used to initiate the object, with attribute 'source'} -\item{\code{inchikey}}{InChI Key, with attribute 'source'} +\item{\code{inchikey}}{(\code{character(1)})\cr +InChI Key, with attribute 'source'} -\item{\code{smiles}}{SMILES code, with attribute 'source'} +\item{\code{smiles}}{(\code{character()})\cr +SMILES code(s), with attribute 'source'} -\item{\code{mw}}{Molecular weight, with attribute 'source'} +\item{\code{mw}}{(\code{numeric(1)})\cr +Molecular weight, with attribute 'source'} -\item{\code{pubchem}}{List of information retreived from PubChem} +\item{\code{pubchem}}{(\code{list()})\cr +List of information retrieved from PubChem} \item{\code{rdkit}}{List of information obtained with RDKit} @@ -54,15 +58,22 @@ if (!is.null(caffeine$Picture)) { \item{\code{cwsat}}{Water solubility in mg/L} +\item{\code{PUF}}{Plant uptake factor} + \item{\code{chyaml}}{List of information obtained from a YAML file} -\item{\code{soil_degradation}}{Dataframe of modelling DT50 values} +\item{\code{TPs}}{List of transformation products as chent objects +Add a transformation product to the internal list} + +\item{\code{transformations}}{Data frame of observed transformations +Add a line in the internal dataframe holding observed transformations} + +\item{\code{soil_degradation}}{Dataframe of modelling DT50 values +Add a line in the internal dataframe holding modelling DT50 values} \item{\code{soil_ff}}{Dataframe of formation fractions} \item{\code{soil_sorption}}{Dataframe of soil sorption data} - -\item{\code{PUF}}{Plant uptake factor} } \if{html}{\out{
}} } @@ -92,13 +103,12 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-chent-new}{}}} \subsection{Method \code{new()}}{ +Creates a new instance of this \link[R6:R6Class]{R6} class. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{chent$new( identifier, smiles = NULL, - smiles_source = "user", inchikey = NULL, - inchikey_source = "user", pubchem = TRUE, pubchem_from = c("name", "smiles", "inchikey"), rdkit = TRUE, @@ -107,6 +117,33 @@ if (!is.null(caffeine$Picture)) { )}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{identifier}}{Identifier to be stored in the object} + +\item{\code{smiles}}{Optional user provided SMILES code} + +\item{\code{inchikey}}{Optional user provided InChI Key} + +\item{\code{pubchem}}{Should an attempt be made to retrieve chemical +information from PubChem via the webchem package?} + +\item{\code{pubchem_from}}{Possibility to select the argument +that is used to query pubchem} + +\item{\code{rdkit}}{Should an attempt be made to retrieve chemical +information from a local rdkit installation via python +and the reticulate package?} + +\item{\code{template}}{An optional SMILES code to be used as template for RDKit} + +\item{\code{chyaml}}{Should we look for a identifier.yaml file in the working +directory? +Try to get chemical information from PubChem} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -116,6 +153,16 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$try_pubchem(query, from = "name")}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{query}}{Query string to be passed to \link[webchem:get_cid]{get_cid}} + +\item{\code{from}}{Passed to \link[webchem:get_cid]{get_cid} +Get chemical information from PubChem for a known PubChem CID} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -125,6 +172,14 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$get_pubchem(pubchem_cid)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{pubchem_cid}}{CID +Get chemical information from RDKit if available} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -134,6 +189,14 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$get_rdkit(template = NULL)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{template}}{Optional template specified as a SMILES code +Obtain information from a YAML file} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -146,6 +209,16 @@ if (!is.null(caffeine$Picture)) { )}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{repo}}{Should the file be looked for in the current working +directory, a local git repository under \verb{~/git/chyaml}, or from +the web (not implemented). +Add a vapour pressure} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -155,6 +228,22 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$add_p0(p0, T = NA, source = NA, page = NA, remark = "")}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{p0}}{The vapour pressure in Pa} + +\item{\code{T}}{Temperature} + +\item{\code{source}}{An acronym specifying the source of the information} + +\item{\code{page}}{The page from which the information was taken} + +\item{\code{remark}}{A remark +Add a water solubility} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -164,6 +253,14 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$add_cwsat(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "")}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{p0}}{The water solubility in mg/L +Add a plant uptake factor} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -178,6 +275,13 @@ if (!is.null(caffeine$Picture)) { )}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{PUF}}{The plant uptake factor, a number between 0 and 1} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} @@ -187,6 +291,17 @@ if (!is.null(caffeine$Picture)) { \if{html}{\out{
}}\preformatted{chent$add_TP(x, smiles = NULL, pubchem = FALSE)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{x}}{A \link{chent} object, or an identifier to generate a \link{chent} object} + +\item{\code{smiles}}{A SMILES code for defining a \link{chent} object} + +\item{\code{pubchem}}{Should chemical information be obtained from PubChem?} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} diff --git a/man/pai.Rd b/man/pai.Rd index 088f5b9..d966a9e 100644 --- a/man/pai.Rd +++ b/man/pai.Rd @@ -25,7 +25,6 @@ if (!is.null(atr$Picture)) { } } -\keyword{data} \section{Super class}{ \code{\link[chents:chent]{chents::chent}} -> \code{pai} } @@ -75,9 +74,7 @@ if (!is.null(atr$Picture)) { iso, identifier = iso, smiles = NULL, - smiles_source = "user", inchikey = NULL, - inchikey_source = "user", bcpc = TRUE, pubchem = TRUE, pubchem_from = "auto", -- cgit v1.2.1