From 84a2cfa3d8926cdd1f5be3a9a449afe3c888a095 Mon Sep 17 00:00:00 2001 From: Ranke Johannes Date: Thu, 28 Nov 2024 12:38:58 +0100 Subject: Polish documentation and Makefile The Makefile was adjusted to the way used in other packages of mine. Note that, @inheritParams does not work for superclasses yet, see https://github.com/r-lib/roxygen2/issues/996, so some function parameters are documented twice. --- .Rbuildignore | 3 +- DESCRIPTION | 6 +- GNUmakefile | 63 +++----- NAMESPACE | 1 + NEWS.md | 6 + R/chent.R | 141 ++++++++---------- README.html | 446 ------------------------------------------------------- log/build.log | 8 + log/check.log | 73 +++++++++ log/test.log | 26 ++++ man/chent.Rd | 75 +++++++--- man/pai.Rd | 39 +++-- man/ppp.Rd | 42 ++---- man/print.ppp.Rd | 16 ++ test.log | 26 ---- 15 files changed, 313 insertions(+), 658 deletions(-) delete mode 100644 README.html create mode 100644 log/build.log create mode 100644 log/check.log create mode 100644 log/test.log create mode 100644 man/print.ppp.Rd delete mode 100644 test.log diff --git a/.Rbuildignore b/.Rbuildignore index 99eec76..b0d9a9b 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,7 +1,6 @@ ^chents_.*.tar.gz$ ^GNUmakefile$ -^README.html$ -^test.log$ +^log ^docs$ ^_pkgdown\.yml$ ^\.travis\.yml$ diff --git a/DESCRIPTION b/DESCRIPTION index 7408723..8b44bdc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: chents Type: Package Title: Chemical Entities as R Objects -Version: 0.3.6 -Date: 2024-08-05 +Version: 0.3.7 +Date: 2024-11-28 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "johannes.ranke@jrwb.de")) Description: Utilities for dealing with chemical entities and associated @@ -28,4 +28,4 @@ LazyData: yes Encoding: UTF-8 URL: https://pkgdown.jrwb.de/chents, https://github.com/jranke/chents Roxygen: list(markdown = TRUE, r6 = TRUE) -RoxygenNote: 7.3.1.9000 +RoxygenNote: 7.3.2.9000 diff --git a/GNUmakefile b/GNUmakefile index 8d2c094..60d12ca 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,74 +3,45 @@ PKGNAME := $(shell sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION) PKGVERS := $(shell sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION) TGZ := $(PKGNAME)_$(PKGVERS).tar.gz WINBIN := $(PKGNAME)_$(PKGVERS).zip -R_HOME ?= $(shell R RHOME) -DATE := $(shell date +%Y-%m-%d) +RBIN ?= $(shell dirname "`which R`") all: install pkgfiles = DESCRIPTION \ - README.html \ + .Rbuildignore \ + DESCRIPTION \ + NAMESPACE \ + NEWS.md \ + README.md \ R/* \ inst/examples/*.R \ _pkgdown.yml \ tests/testthat.R \ tests/testthat/* -roxygen: - @echo "Roxygenizing package..." - "$(R_HOME)/bin/Rscript" -e 'library(devtools); document()' - @echo "DONE." - -pd: roxygen - @echo "Building static documentation..." - "$(R_HOME)/bin/Rscript" -e 'pkgdown::build_site()' - @echo "DONE." +roxy: + $(RBIN)/Rscript -e "roxygen2::roxygenize(roclets = c('rd', 'collate', 'namespace'))" $(TGZ): $(pkgfiles) - @echo "Roxygenizing package..." - "$(R_HOME)/bin/Rscript" -e 'library(devtools); document()' - @echo "Building package..." - "$(R_HOME)/bin/R" CMD build . - @echo "DONE." - -README.html: README.md - "$(R_HOME)/bin/Rscript" -e "rmarkdown::render('README.md', output_format = 'html_document')" - -build: $(TGZ) + "$(RBIN)/R" CMD build . 2>&1 | tee log/build.log -$(WINBIN): build - @echo "Building windows binary package..." - "$(R_HOME)/bin/R" CMD INSTALL $(TGZ) --build - @echo "DONE." +pd: roxy + "$(RBIN)/Rscript" -e 'pkgdown::build_site()' -winbin: $(WINBIN) +build: roxy $(TGZ) test: build - @echo "Running testthat tests..." - "$(R_HOME)/bin/Rscript" -e 'library(devtools); devtools::test()' 2>&1 | tee test.log + "$(RBIN)/Rscript" -e 'library(devtools); devtools::test()' 2>&1 | tee test.log sed -i -e "s/\r.*\r//" test.log - @echo "DONE." quickcheck: build - @echo "Running check..." - _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(R_HOME)/bin/R" CMD check $(TGZ) --no-tests - @echo "DONE." + _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(RBIN)/R" CMD check $(TGZ) --no-tests -check: build - @echo "Running CRAN check..." - _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(R_HOME)/bin/R" CMD check --as-cran $(TGZ) --no-tests - @echo "DONE." +check: roxy build + _R_CHECK_CRAN_INCOMING_REMOTE_=false "$(RBIN)/R" CMD check --as-cran --no-tests $(TGZ) 2>&1 | tee log/check.log install: build - @echo "Installing package..." "$(R_HOME)/bin/R" CMD INSTALL --no-multiarch $(TGZ) - @echo "DONE." - -drat: build - "$(R_HOME)/bin/Rscript" -e "drat::insertPackage('$(TGZ)', commit = TRUE)" - -dratwin: winbin - "$(R_HOME)/bin/Rscript" -e "drat::insertPackage('$(WINBIN)', 'e:/git/drat/', commit = TRUE)" winbuilder: build date @@ -78,3 +49,5 @@ winbuilder: build curl -T $(TGZ) ftp://anonymous@win-builder.r-project.org/R-release/ @echo "Uploading to R-devel on win-builder" curl -T $(TGZ) ftp://anonymous@win-builder.r-project.org/R-devel/ + +.PHONEY: roxy pd test quickcheck check install winbuilder diff --git a/NAMESPACE b/NAMESPACE index 4529781..ca2ae56 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ S3method(plot,chent) S3method(print,chent) S3method(print,pai) +S3method(print,ppp) export(chent) export(draw_svg.chent) export(pai) diff --git a/NEWS.md b/NEWS.md index aaecfe7..f935343 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,10 @@ +## version 0.3.7 + +- R/chent.R: Do not attempt to load a chyaml file per default, as the format of such a file and the resulting chyaml list object is not documented and would need to be inferred from its use in the pfm package. + ## version 0.3.6 - R/chent.R: Set the fields `smiles`, `inchikey` and `mw` to NA if these fields are still NULL at the end of the initialization, with `source` attribute set to "user", assuming that the initialisation was carefully done and `pubchem` and `rdkit` were skipped because the structure is not well-defined. +Please refer to the ChangeLog for commit messages up to November 2021, where I changed the GNUmakefile not to include commit messages +in that file any more. diff --git a/R/chent.R b/R/chent.R index 91fc41b..2eadb3e 100644 --- a/R/chent.R +++ b/R/chent.R @@ -12,6 +12,33 @@ #' @importFrom grImport PostScriptTrace readPicture #' @importFrom yaml yaml.load_file #' @importFrom rsvg rsvg_ps +#' @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? +#' @param T Temperature +#' @param pH pH value +#' @param source An acronym specifying the source of the information +#' @param page The page from which the information was taken +#' @param soils Names of the soils +#' @param type The soil type +#' @param pH_orig The pH stated in the study +#' @param pH_medium The medium in which this pH was measured +#' @param pH_H2O The pH extrapolated to pure water +#' @param perc_OC The percentage of organic carbon in the soil +#' @param pages The pages from which the information was taken +#' @param remark A remark +#' @param file The file to write to +#' @param dir The directory to write the file to #' @examples #' oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE) #' print(oct) @@ -80,23 +107,10 @@ chent <- R6Class("chent", #' @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) { + chyaml = FALSE) { self$identifier <- identifier names(self$identifier) <- make.names(identifier) @@ -219,8 +233,8 @@ chent <- R6Class("chent", } }, + #' @description #' 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") @@ -302,10 +316,6 @@ chent <- R6Class("chent", #' 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 @@ -316,11 +326,6 @@ chent <- R6Class("chent", #' Add a water solubility #' @param cwsat The water solubility in mg/L - #' @param T Temperature - #' @param pH The pH value - #' @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_cwsat = function(cwsat, T = NA, pH = NA, source = NA, page = NA, remark = "") { @@ -334,9 +339,6 @@ chent <- R6Class("chent", #' Add a plant uptake factor #' @param PUF The plant uptake factor, a number between 0 and 1 - #' @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_PUF = function(PUF = 0, source = "focus_generic_gw_2014", page = 41, remark = "Conservative default value") @@ -352,7 +354,6 @@ chent <- R6Class("chent", #' 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")) { @@ -360,7 +361,7 @@ chent <- R6Class("chent", chent <- x } else { id <- make.names(x) - chent <- chent$new(x, smiles, pubchem = pubchem) + chent <- chent$new(x, smiles = smiles, pubchem = pubchem) } self$TPs[[id]] <- chent }, @@ -380,9 +381,6 @@ chent <- R6Class("chent", #' @param max_occurrence The maximum observed occurrence of the #' transformation product, expressed as a fraction of the amount that would #' result from stochiometric transformation - #' @param source An acronym specifying the source of the information - #' @param pages The page from which the information was taken - #' @param remark A remark add_transformation = function(study_type, TP_identifier, max_occurrence, remark = "", source = NA, pages = NA) { @@ -407,17 +405,11 @@ chent <- R6Class("chent", soil_degradation = NULL, #' Add a line in the internal dataframe holding modelling DT50 values - #' @param soils Names of the soils #' @param DT50_mod The modelling DT50 in the sense of regulatory pesticide #' fate modelling #' @param DT50_mod_ref The normalised modelling DT50 in the sense of #' regulatory pesticide fate modelling - #' @param type The soil type #' @param country The country (mainly for field studies) - #' @param pH_orig The pH stated in the study - #' @param pH_medium The medium in which this pH was measured - #' @param pH_H2O The pH extrapolated to pure water - #' @param perc_OC The percentage of organic carbon in the soil #' @param temperature The temperature during the study in degrees Celsius #' @param moisture The moisture during the study #' @param category Is it a laboratory ('lab') or field study ('field') @@ -425,9 +417,6 @@ chent <- R6Class("chent", #' the technical active ingredient #' @param model The degradation model used for deriving `DT50_mod` #' @param chi2 The relative error as defined in FOCUS kinetics - #' @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_soil_degradation = function(soils, DT50_mod, DT50_mod_ref, type = NA, country = NA, pH_orig = NA, pH_medium = NA, pH_H2O = NA, @@ -500,7 +489,8 @@ chent <- R6Class("chent", #' @param N The Freundlich exponent #' @param perc_clay The percentage of clay in the soil #' @param CEC The cation exchange capacity - add_soil_sorption = function(soils, Kf, Kfoc, N, + add_soil_sorption = function(soils, + Kf, Kfoc, N, type = NA, pH_orig = NA, pH_medium = NA, pH_H2O = NA, perc_OC = NA, perc_clay = NA, CEC = NA, @@ -525,10 +515,8 @@ chent <- R6Class("chent", } }, + #' @description #' Write a PDF image of the structure - #' @param file The file to write to - #' @param dir The directory to write the file to - #' @param template A template expressed as SMILES to use in RDKit pdf = function(file = paste0(self$identifier, ".pdf"), dir = "structures/pdf", template = NULL) { if (!dir.exists(dir)) { @@ -568,8 +556,8 @@ chent <- R6Class("chent", dev.off() }, + #' @description #' Write an EMF image of the structure using [emf][devEMF::emf] - #' @param file The file to write to emf = function(file = paste0(self$identifier, ".emf"), dir = "structures/emf") { @@ -650,12 +638,12 @@ plot.chent = function(x, ...) { #' @title An R6 class for pesticidal active ingredients and associated data #' -#' @description The class is initialised with an identifier which is generally -#' an ISO common name. Additional chemical information is retrieved from the -#' internet if available. +#' @description This class is derived from [chent]. It makes it easy +#' to create a [chent] from the ISO common name of a pesticide active +#' ingredient, and additionally stores the ISO name as well as +#' the complete result of querying the BCPC compendium using +#' [bcpc_query][webchem::bcpc_query]. #' -#' @docType class -#' @importFrom R6 R6Class #' @export #' @format An \code{\link{R6Class}} generator object #' @examples @@ -671,7 +659,6 @@ plot.chent = function(x, ...) { #' } #' #' } - pai <- R6Class("pai", inherit = chent, public = list( @@ -683,23 +670,27 @@ pai <- R6Class("pai", #' at bcpc = NULL, - #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @description This class is derived from [chent]. It makes it easy - #' to create a [chent] from the ISO common name of a pesticide active - #' ingredient, and additionally stores the ISO name as well as - #' the complete result of querying the BCPC compendium using - #' [bcpc_query][webchem::bcpc_query]. - #' #' @param iso The ISO common name to be used in the query of the #' BCPC compendium #' #' @param identifier Alternative identifier used for querying pubchem + #' @param smiles Optional user provided SMILES code + #' @param inchikey Optional user provided InChI Key + #' @param bcpc Should the BCPC compendium be queried? + #' @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 initialize = function(iso, identifier = iso, smiles = NULL, inchikey = NULL, bcpc = TRUE, pubchem = TRUE, pubchem_from = 'auto', rdkit = TRUE, template = NULL, - chyaml = TRUE) + chyaml = FALSE) { if (!is.null(inchikey)) { @@ -776,11 +767,8 @@ print.pai = function(x, ...) { #' @description Contains basic information about the active ingredients in the #' product #' -#' @docType class -#' @importFrom R6 R6Class #' @export #' @format An \code{\link{R6Class}} generator object. - ppp <- R6Class("ppp", public = list( @@ -803,12 +791,12 @@ ppp <- R6Class("ppp", density_units = "g/L", #' Creates a new instance of this [R6][R6::R6Class] class. - #' - #' @field ... Identifiers of the active ingredients - #' @field concentrations Concentrations of the active ingredients - #' @field concentration_units Defaults to g/L - #' @field density The density - #' @field density_units Defaults to g/L + #' @param name The name of the product + #' @param ... Identifiers of the active ingredients + #' @param concentrations Concentrations of the active ingredients + #' @param concentration_units Defaults to g/L + #' @param density The density + #' @param density_units Defaults to g/L initialize = function(name, ..., concentrations, concentration_units = "g/L", density = 1000, density_units = "g/L") { @@ -819,13 +807,16 @@ ppp <- R6Class("ppp", self$density_units <- density_units names(self$concentrations) <- names(self$ais) self$concentration_units <- concentration_units - }, - - #' Printing method - print = function() { - cat(" named", self$name, "\n") } ) ) +#' Printing method for ppp objects (plant protection products) +#' +#' @param x The chent object to be printed +#' @param ... Further arguments for compatibility with the S3 method +#' @export +print.ppp = function(x, ...) { + cat(" named", x$name, "\n") +} # vim: set ts=2 sw=2 expandtab: diff --git a/README.html b/README.html deleted file mode 100644 index ad3d08d..0000000 --- a/README.html +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - - - - - - - - -README - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
-

chents

-

buildbuildpassingpassing - - - - - - - - - - - - - - codecov - codecov - 10% - 10% - - - -

-

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

-
-

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.

-
-
- - - - -
- - - - - - - - - - - - - - - diff --git a/log/build.log b/log/build.log new file mode 100644 index 0000000..b6e3ba5 --- /dev/null +++ b/log/build.log @@ -0,0 +1,8 @@ +* checking for file ‘./DESCRIPTION’ ... OK +* preparing ‘chents’: +* checking DESCRIPTION meta-information ... OK +* checking for LF line-endings in source and make files and shell scripts +* checking for empty or unneeded directories +Omitted ‘LazyData’ from DESCRIPTION +* building ‘chents_0.3.7.tar.gz’ + diff --git a/log/check.log b/log/check.log new file mode 100644 index 0000000..95a06de --- /dev/null +++ b/log/check.log @@ -0,0 +1,73 @@ +* using log directory ‘/home/agsad.admin.ch/f80868656/projects/chents/chents.Rcheck’ +* using R version 4.4.1 (2024-06-14) +* using platform: x86_64-pc-linux-gnu +* R was compiled by + gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 + GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 +* running under: Ubuntu 22.04.5 LTS +* using session charset: UTF-8 +* using options ‘--no-tests --as-cran’ +* checking for file ‘chents/DESCRIPTION’ ... OK +* checking extension type ... Package +* this is package ‘chents’ version ‘0.3.7’ +* package encoding: UTF-8 +* checking CRAN incoming feasibility ... Note_to_CRAN_maintainers +Maintainer: ‘Johannes Ranke ’ +* checking package namespace information ... OK +* checking package dependencies ... OK +* checking if this is a source package ... OK +* checking if there is a namespace ... OK +* checking for executable files ... OK +* checking for hidden files and directories ... OK +* checking for portable file names ... OK +* checking for sufficient/correct file permissions ... OK +* checking serialization versions ... OK +* checking whether package ‘chents’ can be installed ... OK +* checking installed package size ... OK +* checking package directory ... OK +* checking for future file timestamps ... OK +* checking DESCRIPTION meta-information ... OK +* checking top-level files ... NOTE +Files ‘README.md’ or ‘NEWS.md’ cannot be checked without ‘pandoc’ being installed. +* checking for left-over files ... OK +* checking index information ... OK +* checking package subdirectories ... OK +* checking code files for non-ASCII characters ... OK +* checking R files for syntax errors ... OK +* checking whether the package can be loaded ... OK +* checking whether the package can be loaded with stated dependencies ... OK +* checking whether the package can be unloaded cleanly ... OK +* checking whether the namespace can be loaded with stated dependencies ... OK +* checking whether the namespace can be unloaded cleanly ... OK +* checking loading without being on the library search path ... OK +* checking whether startup messages can be suppressed ... OK +* checking use of S3 registration ... OK +* checking dependencies in R code ... OK +* checking S3 generic/method consistency ... OK +* checking replacement functions ... OK +* checking foreign function calls ... OK +* checking R code for possible problems ... OK +* checking Rd files ... OK +* checking Rd metadata ... OK +* checking Rd line widths ... OK +* checking Rd cross-references ... OK +* checking for missing documentation entries ... OK +* checking for code/documentation mismatches ... OK +* checking Rd \usage sections ... OK +* checking Rd contents ... OK +* checking for unstated dependencies in examples ... OK +* checking examples ... [8s/14s] OK +* checking for unstated dependencies in ‘tests’ ... OK +* checking tests ... SKIPPED +* checking PDF version of manual ... OK +* checking HTML version of manual ... NOTE +Skipping checking HTML validation: no command 'tidy' found +* checking for non-standard things in the check directory ... OK +* checking for detritus in the temp directory ... OK +* DONE + +Status: 2 NOTEs +See + ‘/home/agsad.admin.ch/f80868656/projects/chents/chents.Rcheck/00check.log’ +for details. + diff --git a/log/test.log b/log/test.log new file mode 100644 index 0000000..6c6325d --- /dev/null +++ b/log/test.log @@ -0,0 +1,26 @@ +Loading required package: usethis +ℹ Testing chents + +Attaching package: ‘testthat’ + +The following object is masked from ‘package:devtools’: + + test_file + +✔ | F W S OK | Context + +⠏ | 0 | chent +⠏ | 0 | Generation of chent objects +⠋ | 1 | Generation of chent objects +⠸ | 4 | Generation of chent objects +✔ | 7 | Generation of chent objects [4.9s] + +⠏ | 0 | pai +⠏ | 0 | Generation of pai objects +⠋ | 1 | Generation of pai objects +✔ | 8 | Generation of pai objects [6.8s] + +══ Results ═════════════════════════════════════════════════════════════════════ +Duration: 11.7 s + +[ FAIL 0 | WARN 0 | SKIP 0 | PASS 15 ] diff --git a/man/chent.Rd b/man/chent.Rd index 686d6c7..6edc226 100644 --- a/man/chent.Rd +++ b/man/chent.Rd @@ -105,6 +105,8 @@ Add soil sorption data} \if{latex}{\out{\hypertarget{method-chent-new}{}}} \subsection{Method \code{new()}}{ Creates a new instance of this \link[R6:R6Class]{R6} class. + +Try to get chemical information from PubChem \subsection{Usage}{ \if{html}{\out{
}}\preformatted{chent$new( identifier, @@ -114,7 +116,7 @@ Creates a new instance of this \link[R6:R6Class]{R6} class. pubchem_from = c("name", "smiles", "inchikey"), rdkit = TRUE, template = NULL, - chyaml = TRUE + chyaml = FALSE )}\if{html}{\out{
}} } @@ -140,8 +142,7 @@ 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} +directory?} } \if{html}{\out{}} } @@ -176,8 +177,7 @@ Get chemical information from PubChem for a known PubChem CID} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{pubchem_cid}}{CID -Get chemical information from RDKit if available} +\item{\code{pubchem_cid}}{CID} } \if{html}{\out{
}} } @@ -186,6 +186,8 @@ Get chemical information from RDKit if available} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-chent-get_rdkit}{}}} \subsection{Method \code{get_rdkit()}}{ +Get chemical information from RDKit if available +Obtain information from a YAML file \subsection{Usage}{ \if{html}{\out{
}}\preformatted{chent$get_rdkit(template = NULL)}\if{html}{\out{
}} } @@ -193,8 +195,7 @@ Get chemical information from RDKit if available} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{template}}{Optional template specified as a SMILES code -Obtain information from a YAML file} +\item{\code{template}}{An optional SMILES code to be used as template for RDKit} } \if{html}{\out{
}} } @@ -234,7 +235,8 @@ Add a vapour pressure} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{p0}}{The vapour pressure in Pa} +\item{\code{p0}}{The vapour pressure in Pa +Add a water solubility} \item{\code{T}}{Temperature} @@ -242,8 +244,7 @@ Add a vapour pressure} \item{\code{page}}{The page from which the information was taken} -\item{\code{remark}}{A remark -Add a water solubility} +\item{\code{remark}}{A remark} } \if{html}{\out{
}} } @@ -259,18 +260,18 @@ Add a water solubility} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{cwsat}}{The water solubility in mg/L} +\item{\code{cwsat}}{The water solubility in mg/L +Add a plant uptake factor} \item{\code{T}}{Temperature} -\item{\code{pH}}{The pH value} +\item{\code{pH}}{pH value} \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 plant uptake factor} +\item{\code{remark}}{A remark} } \if{html}{\out{
}} } @@ -315,7 +316,7 @@ Add a plant uptake factor} \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{smiles}}{Optional user provided SMILES code} \item{\code{pubchem}}{Should chemical information be obtained from PubChem?} } @@ -353,7 +354,7 @@ result from stochiometric transformation} \item{\code{source}}{An acronym specifying the source of the information} -\item{\code{pages}}{The page from which the information was taken} +\item{\code{pages}}{The pages from which the information was taken} } \if{html}{\out{}} } @@ -446,6 +447,12 @@ the technical active ingredient} \item{\code{soils}}{The soil name(s) in which the transformation was observed} \item{\code{ff}}{The formation fraction(s)} + +\item{\code{remark}}{A remark} + +\item{\code{source}}{An acronym specifying the source of the information} + +\item{\code{page}}{The page from which the information was taken} } \if{html}{\out{}} } @@ -476,6 +483,8 @@ the technical active ingredient} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ +\item{\code{soils}}{Names of the soils} + \item{\code{Kf}}{The sorption constant in L/kg, either linear (then \code{N} is 1) or according to Freundlich} @@ -483,10 +492,25 @@ or according to Freundlich} \item{\code{N}}{The Freundlich exponent} +\item{\code{type}}{The soil type} + +\item{\code{pH_orig}}{The pH stated in the study} + +\item{\code{pH_medium}}{The medium in which this pH was measured} + +\item{\code{pH_H2O}}{The pH extrapolated to pure water} + +\item{\code{perc_OC}}{The percentage of organic carbon in the soil} + \item{\code{perc_clay}}{The percentage of clay in the soil} -\item{\code{CEC}}{The cation exchange capacity -Write a PDF image of the structure} +\item{\code{CEC}}{The cation exchange capacity} + +\item{\code{remark}}{A remark} + +\item{\code{source}}{An acronym specifying the source of the information} + +\item{\code{page}}{The page from which the information was taken} } \if{html}{\out{
}} } @@ -495,6 +519,8 @@ Write a PDF image of the structure} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-chent-pdf}{}}} \subsection{Method \code{pdf()}}{ +Write a PDF image of the structure +Write a PNG image of the structure \subsection{Usage}{ \if{html}{\out{
}}\preformatted{chent$pdf( file = paste0(self$identifier, ".pdf"), @@ -510,8 +536,7 @@ Write a PDF image of the structure} \item{\code{dir}}{The directory to write the file to} -\item{\code{template}}{A template expressed as SMILES to use in RDKit -Write a PNG image of the structure} +\item{\code{template}}{An optional SMILES code to be used as template for RDKit} } \if{html}{\out{
}} } @@ -531,8 +556,11 @@ Write a PNG image of the structure} \subsection{Arguments}{ \if{html}{\out{
}} \describe{ -\item{\code{antialias}}{Passed to \link[grDevices:png]{png} -Write an EMF image of the structure using \link[devEMF:emf]{emf}} +\item{\code{file}}{The file to write to} + +\item{\code{dir}}{The directory to write the file to} + +\item{\code{antialias}}{Passed to \link[grDevices:png]{png}} } \if{html}{\out{
}} } @@ -541,6 +569,7 @@ Write an EMF image of the structure using \link[devEMF:emf]{emf}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-chent-emf}{}}} \subsection{Method \code{emf()}}{ +Write an EMF image of the structure using \link[devEMF:emf]{emf} \subsection{Usage}{ \if{html}{\out{
}}\preformatted{chent$emf(file = paste0(self$identifier, ".emf"), dir = "structures/emf")}\if{html}{\out{
}} } @@ -549,6 +578,8 @@ Write an EMF image of the structure using \link[devEMF:emf]{emf}} \if{html}{\out{
}} \describe{ \item{\code{file}}{The file to write to} + +\item{\code{dir}}{The directory to write the file to} } \if{html}{\out{
}} } diff --git a/man/pai.Rd b/man/pai.Rd index 259caae..ef44296 100644 --- a/man/pai.Rd +++ b/man/pai.Rd @@ -1,6 +1,5 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/chent.R -\docType{class} \name{pai} \alias{pai} \title{An R6 class for pesticidal active ingredients and associated data} @@ -8,9 +7,11 @@ An \code{\link{R6Class}} generator object } \description{ -The class is initialised with an identifier which is generally -an ISO common name. Additional chemical information is retrieved from the -internet if available. +This class is derived from \link{chent}. It makes it easy +to create a \link{chent} from the ISO common name of a pesticide active +ingredient, and additionally stores the ISO name as well as +the complete result of querying the BCPC compendium using +\link[webchem:bcpc_query]{bcpc_query}. } \examples{ # On Travis, we get a certificate validation error, @@ -35,8 +36,7 @@ if (!is.null(atr$Picture)) { \item{\code{iso}}{ISO common name of the active ingredient according to ISO 1750} \item{\code{bcpc}}{Information retrieved from the BCPC compendium available online -at -Creates a new instance of this \link[R6:R6Class]{R6} class.} +at } } \if{html}{\out{}} } @@ -72,11 +72,6 @@ Creates a new instance of this \link[R6:R6Class]{R6} class.} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-pai-new}{}}} \subsection{Method \code{new()}}{ -This class is derived from \link{chent}. It makes it easy -to create a \link{chent} from the ISO common name of a pesticide active -ingredient, and additionally stores the ISO name as well as -the complete result of querying the BCPC compendium using -\link[webchem:bcpc_query]{bcpc_query}. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{pai$new( iso, @@ -88,7 +83,7 @@ the complete result of querying the BCPC compendium using pubchem_from = "auto", rdkit = TRUE, template = NULL, - chyaml = TRUE + chyaml = FALSE )}\if{html}{\out{
}} } @@ -99,6 +94,26 @@ the complete result of querying the BCPC compendium using BCPC compendium} \item{\code{identifier}}{Alternative identifier used for querying pubchem} + +\item{\code{smiles}}{Optional user provided SMILES code} + +\item{\code{inchikey}}{Optional user provided InChI Key} + +\item{\code{bcpc}}{Should the BCPC compendium be queried?} + +\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} } \if{html}{\out{}} } diff --git a/man/ppp.Rd b/man/ppp.Rd index c0d35f1..3575d31 100644 --- a/man/ppp.Rd +++ b/man/ppp.Rd @@ -1,6 +1,5 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/chent.R -\docType{class} \name{ppp} \alias{ppp} \title{R6 class for a plant protection product with at least one active ingredient} @@ -26,24 +25,6 @@ product \item{\code{density_units}}{Defaults to g/L Creates a new instance of this \link[R6:R6Class]{R6} class.} - -\item{\code{...}}{Identifiers of the active ingredients} - -\item{\code{concentrations}}{Concentrations of the active ingredients} - -\item{\code{concentration_units}}{Defaults to g/L} - -\item{\code{density}}{The density} - -\item{\code{density_units}}{Defaults to g/L -Printing method} -} -\if{html}{\out{}} -} -\section{Active bindings}{ -\if{html}{\out{
}} -\describe{ -\item{\code{...}}{Identifiers of the active ingredients} } \if{html}{\out{
}} } @@ -51,7 +32,6 @@ Printing method} \subsection{Public methods}{ \itemize{ \item \href{#method-ppp-new}{\code{ppp$new()}} -\item \href{#method-ppp-print}{\code{ppp$print()}} \item \href{#method-ppp-clone}{\code{ppp$clone()}} } } @@ -70,15 +50,23 @@ Printing method} )}\if{html}{\out{}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{name}}{The name of the product} + +\item{\code{...}}{Identifiers of the active ingredients} + +\item{\code{concentrations}}{Concentrations of the active ingredients} + +\item{\code{concentration_units}}{Defaults to g/L} + +\item{\code{density}}{The density} + +\item{\code{density_units}}{Defaults to g/L} } -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ppp-print}{}}} -\subsection{Method \code{print()}}{ -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{ppp$print()}\if{html}{\out{
}} +\if{html}{\out{
}} } - } \if{html}{\out{
}} \if{html}{\out{}} diff --git a/man/print.ppp.Rd b/man/print.ppp.Rd new file mode 100644 index 0000000..553769b --- /dev/null +++ b/man/print.ppp.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/chent.R +\name{print.ppp} +\alias{print.ppp} +\title{Printing method for ppp objects (plant protection products)} +\usage{ +\method{print}{ppp}(x, ...) +} +\arguments{ +\item{x}{The chent object to be printed} + +\item{...}{Further arguments for compatibility with the S3 method} +} +\description{ +Printing method for ppp objects (plant protection products) +} diff --git a/test.log b/test.log deleted file mode 100644 index 6c6325d..0000000 --- a/test.log +++ /dev/null @@ -1,26 +0,0 @@ -Loading required package: usethis -ℹ Testing chents - -Attaching package: ‘testthat’ - -The following object is masked from ‘package:devtools’: - - test_file - -✔ | F W S OK | Context - -⠏ | 0 | chent -⠏ | 0 | Generation of chent objects -⠋ | 1 | Generation of chent objects -⠸ | 4 | Generation of chent objects -✔ | 7 | Generation of chent objects [4.9s] - -⠏ | 0 | pai -⠏ | 0 | Generation of pai objects -⠋ | 1 | Generation of pai objects -✔ | 8 | Generation of pai objects [6.8s] - -══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 11.7 s - -[ FAIL 0 | WARN 0 | SKIP 0 | PASS 15 ] -- cgit v1.2.3