From 79123acfdd9a9b905a5b177e2b7aa0d604e52267 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 19 Nov 2021 00:22:03 +0100 Subject: Add plot example, update static docs --- R/chent.R | 6 + docs/404.html | 145 +++++++++++++++ docs/authors.html | 43 +++-- docs/bootstrap-toc.css | 60 ++++++ docs/bootstrap-toc.js | 159 ++++++++++++++++ docs/index.html | 31 ++-- docs/pkgdown.css | 165 +++++++++++++++-- docs/pkgdown.js | 15 +- docs/pkgdown.yml | 7 +- docs/reference/Rplot001.png | Bin 0 -> 19923 bytes docs/reference/chent-1.png | Bin 34374 -> 46431 bytes docs/reference/chent.html | 368 +++++++++++++++++++++++++++++-------- docs/reference/draw_svg.chent.html | 70 ++++--- docs/reference/index.html | 57 ++++-- docs/reference/pai-1.png | Bin 0 -> 33683 bytes docs/reference/pai.html | 155 +++++++++++----- docs/reference/plot.chent-1.png | Bin 34374 -> 46149 bytes docs/reference/plot.chent.html | 86 +++++---- docs/reference/pp.html | 120 ++++++++---- docs/reference/print.chent.html | 63 ++++--- docs/reference/print.pai.html | 63 ++++--- man/plot.chent.Rd | 7 + 22 files changed, 1273 insertions(+), 347 deletions(-) create mode 100644 docs/404.html create mode 100644 docs/bootstrap-toc.css create mode 100644 docs/bootstrap-toc.js create mode 100644 docs/reference/Rplot001.png create mode 100644 docs/reference/pai-1.png diff --git a/R/chent.R b/R/chent.R index d988e97..6983561 100644 --- a/R/chent.R +++ b/R/chent.R @@ -471,6 +471,12 @@ draw_svg.chent = function(x, width = 300, height = 150, #' @param x The chent object to be plotted #' @param ... Further arguments passed to \code{\link{grid.picture}} #' @export +#' @examples +#' caffeine <- chent$new("caffeine") +#' print(caffeine) +#' if (!is.null(caffeine$Picture)) { +#' plot(caffeine) +#' } plot.chent = function(x, ...) { if (is.null(x$Picture)) stop("No Picture object in chent, was RDKit available during creation?") grid.picture(x$Picture) diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..7bd3245 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,145 @@ + + + + + + + + +Page not found (404) • chents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.6.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/authors.html b/docs/authors.html index 3274797..327fe56 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -8,21 +8,29 @@ Authors • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,12 @@ + + @@ -44,9 +54,10 @@ + - +
@@ -68,7 +79,7 @@ -
+
@@ -111,19 +122,23 @@
+ + + diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 0000000..5a85941 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 0000000..1cdd573 --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/index.html b/docs/index.html index c9bd988..5fadb0b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,23 +6,24 @@ Chemical Entities as R Objects • chents - - - + + + + + - - +
    @@ -91,11 +93,11 @@
    - +
    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.6.1.

    +
    + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index c03fb08..1273238 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -17,12 +17,14 @@ html, body { height: 100%; } +body { + position: relative; +} + body > .container { display: flex; height: 100%; flex-direction: column; - - padding-top: 60px; } body > .container .row { @@ -69,6 +71,10 @@ summary { margin-top: calc(-60px + 1em); } +dd { + margin-left: 3em; +} + /* Section anchors ---------------------------------*/ a.anchor { @@ -102,37 +108,135 @@ a.anchor { margin-top: -40px; } -/* Static header placement on mobile devices */ -@media (max-width: 767px) { - .navbar-fixed-top { - position: absolute; - } - .navbar { - padding: 0; - } +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; } +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} /* Sidebar --------------------------*/ -#sidebar { +#pkgdown-sidebar { margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; } -#sidebar h2 { + +#pkgdown-sidebar h2 { font-size: 1.5em; margin-top: 1em; } -#sidebar h2:first-child { +#pkgdown-sidebar h2:first-child { margin-top: 0; } -#sidebar .list-unstyled li { +#pkgdown-sidebar .list-unstyled li { margin-bottom: 0.5em; } +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + .orcid { - height: 16px; + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; vertical-align: middle; } @@ -140,14 +244,14 @@ a.anchor { .ref-index th {font-weight: normal;} -.ref-index td {vertical-align: top;} +.ref-index td {vertical-align: top; min-width: 100px} .ref-index .icon {width: 40px;} .ref-index .alias {width: 40%;} .ref-index-icons .alias {width: calc(40% - 40px);} .ref-index .title {width: 60%;} .ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top;} +.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} .ref-arguments .name {width: 20%;} .ref-arguments .desc {width: 80%;} @@ -222,6 +326,19 @@ a.sourceLine:hover { visibility: visible; } +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + /* mark.js ----------------------------*/ mark { @@ -234,3 +351,17 @@ mark { .html-widget { margin-bottom: 10px; } + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index eb7e83d..7e7048f 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -2,18 +2,11 @@ (function($) { $(function() { - $("#sidebar") - .stick_in_parent({offset_top: 40}) - .on('sticky_kit:bottom', function(e) { - $(this).parent().css('position', 'static'); - }) - .on('sticky_kit:unbottom', function(e) { - $(this).parent().css('position', 'relative'); - }); + $('.navbar-fixed-top').headroom(); - $('body').scrollspy({ - target: '#sidebar', - offset: 60 + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); }); $('[data-toggle="tooltip"]').tooltip(); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 1dc6ec1..e09cce3 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,6 @@ -pandoc: 2.2.1 -pkgdown: 1.3.0 +pandoc: 2.9.2.1 +pkgdown: 1.6.1 pkgdown_sha: ~ -articles: [] +articles: {} +last_built: 2021-11-18T23:21Z diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png new file mode 100644 index 0000000..377b927 Binary files /dev/null and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/chent-1.png b/docs/reference/chent-1.png index a1798d9..7229a66 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 3d0928c..941eabb 100644 --- a/docs/reference/chent.html +++ b/docs/reference/chent.html @@ -8,21 +8,29 @@ An R6 class for chemical entities with associated data — chent • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,12 +38,12 @@ - + - +python bindings are installed." /> + @@ -49,9 +57,10 @@ python bindings are installed and configured for use with PythonInR." /> + - +
    @@ -73,7 +82,7 @@ python bindings are installed and configured for use with PythonInR." /> -
    +
    @@ -107,49 +116,262 @@ python bindings are installed and configured for use with PythonInR." />
    -

    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 and configured for use with PythonInR.

    - +python bindings are installed.

    -
    chent
    - + +

    Format

    An R6Class generator object

    - -

    Fields

    +

    Public fields

    - -
    +

    identifier

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

    -
    inchikey

    InChI Key, with attribute 'source'

    -
    smiles

    SMILES code, with attribute 'source'

    -
    mw

    Molecular weight, with attribute 'source'

    -
    pubchem

    List of information retreived from PubChem

    -
    rdkit

    List of information obtained with RDKit, if installed and -configured for use with PythonInR

    -
    svg

    SVG code

    -
    Picture

    Graph as a picture object obtained using grImport

    -
    Pict_font_size

    Font size as extracted from the intermediate PostScript file

    -
    pdf_height

    Height of the MediaBox in the pdf after cropping

    -
    p0

    Vapour pressure in Pa

    -
    cwsat

    Water solubility in mg/L

    -
    chyaml

    List of information obtained from a YAML file

    -
    soil_degradation

    Dataframe of modelling DT50 values

    -
    soil_ff

    Dataframe of formation fractions

    -
    soil_sorption

    Dataframe of soil sorption data

    -
    PUF

    Plant uptake factor

    -
    + +
    inchikey

    InChI Key, with attribute 'source'

    + +
    smiles

    SMILES code, with attribute 'source'

    + +
    mw

    Molecular weight, with attribute 'source'

    + +
    pubchem

    List of information retreived from PubChem

    + +
    rdkit

    List of information obtained with RDKit

    + +
    mol

    <rdkit.Chem.rdchem.Mol> object

    + +
    svg

    SVG code

    + +
    Picture

    Graph as a picture object obtained using grImport

    + +
    Pict_font_size

    Font size as extracted from the intermediate PostScript file

    + +
    pdf_height

    Height of the MediaBox in the pdf after cropping

    + +
    p0

    Vapour pressure in Pa

    + +
    cwsat

    Water solubility in mg/L

    + +
    chyaml

    List of information obtained from a YAML file

    + +
    soil_degradation

    Dataframe of modelling DT50 values

    + +
    soil_ff

    Dataframe of formation fractions

    + +
    soil_sorption

    Dataframe of soil sorption data

    + +
    PUF

    Plant uptake factor

    + +

    +

    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:
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/cids/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IsomericSMILES,InChI,InChIKey,IUPACName,XLogP,TPSA,Complexity,Charge,HBondDonorCount,HBondAcceptorCount/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/synonyms/JSON
    #> -#> Initialize Python Version 2.7.13 (default, Sep 26 2018, 18:42:22) -#> [GCC 6.3.0 20170516]
    #> Trying to get chemical information from RDKit using User SMILES -#> CCCCCCCCO
    #> Did not find chyaml file ./1-octanol.yaml
    print(oct)
    #> <chent> +
    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: @@ -157,12 +379,16 @@ configured for use with PythonInR

    #> "CCCCCCCCO" "CCCCCCCCO" #> Molecular weight $mw: 130.2 #> PubChem synonyms (up to 10): -#> [1] "957" "1-octanol" "Octan-1-ol" "octanol" -#> [5] "111-87-5" "N-octanol" "Capryl alcohol" "Octyl alcohol" -#> [9] "caprylic alcohol" "n-Octyl alcohol"
    if (!is.null(oct$Picture)) { - plot(oct) -}
    caffeine <- chent$new("caffeine")
    #> PubChem:
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/cids/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IsomericSMILES,InChI,InChIKey,IUPACName,XLogP,TPSA,Complexity,Charge,HBondDonorCount,HBondAcceptorCount/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/synonyms/JSON
    #> 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> +#> [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: @@ -170,41 +396,39 @@ configured for use with PythonInR

    #> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" #> Molecular weight $mw: 194.2 #> PubChem synonyms (up to 10): -#> [1] "2519" "caffeine" -#> [3] "58-08-2" "Guaranine" -#> [5] "1,3,7-Trimethylxanthine" "Thein" -#> [7] "Cafeina" "Methyltheobromine" -#> [9] "Koffein" "Mateina"
    if (!is.null(caffeine$Picture)) { - plot(caffeine) -}
    +#> [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) +} +
    - + + + diff --git a/docs/reference/draw_svg.chent.html b/docs/reference/draw_svg.chent.html index 582aa0c..1805ff1 100644 --- a/docs/reference/draw_svg.chent.html +++ b/docs/reference/draw_svg.chent.html @@ -8,21 +8,29 @@ Draw SVG graph from a chent object using RDKit — draw_svg.chent • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    @@ -71,7 +80,7 @@ -
    +
    @@ -105,14 +114,17 @@
    -

    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")
    - +
    draw_svg.chent(
    +  x,
    +  width = 300,
    +  height = 150,
    +  filename = paste0(names(x$identifier), ".svg"),
    +  subdir = "svg"
    +)
    +

    Arguments

    @@ -137,31 +149,33 @@

    The path to which the file should be written

    - - - + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index f08563c..9de4a87 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -8,21 +8,29 @@ Function reference • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,12 @@ + + @@ -44,9 +54,10 @@ + - +
    @@ -68,7 +79,7 @@ -
    +
    @@ -114,6 +125,11 @@

    + + + + + @@ -161,27 +177,30 @@
    - + + + diff --git a/docs/reference/pai-1.png b/docs/reference/pai-1.png new file mode 100644 index 0000000..c235304 Binary files /dev/null and b/docs/reference/pai-1.png differ diff --git a/docs/reference/pai.html b/docs/reference/pai.html index e240e11..e5ecb99 100644 --- a/docs/reference/pai.html +++ b/docs/reference/pai.html @@ -8,21 +8,29 @@ An R6 class for pesticidal active ingredients and associated data — pai • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,11 +38,11 @@ - + - + @@ -48,9 +56,10 @@ Additional chemical information is retrieved from the internet if available." /> + - +
    @@ -72,7 +81,7 @@ Additional chemical information is retrieved from the internet if available." /> -
    +
    @@ -106,30 +115,92 @@ Additional chemical information is retrieved from the internet if available." />
    -

    The class is initialised with an identifier which is generally an ISO common name. Additional chemical information is retrieved from the internet if available.

    -
    -
    pai
    - + +

    Format

    An R6Class generator object

    - -

    Fields

    +

    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

    + +

    +

    Methods

    -
    -
    iso

    ISO common name according to ISO 1750 as retreived from www.alanwood.net/pesticides

    -
    alanwood

    List of information retreived from www.alanwood.net/pesticides

    -
    - +

    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

    -
    atr <- pai$new("atrazine")
    #> alanwood.net:
    #> Querying atrazine.html
    #> PubChem:
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/inchikey/cids/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IsomericSMILES,InChI,InChIKey,IUPACName,XLogP,TPSA,Complexity,Charge,HBondDonorCount,HBondAcceptorCount/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/synonyms/JSON
    #> 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
    print(atr)
    #> <pai> with ISO common name $iso atrazine +
    atr <- pai$new("atrazine") +
    #> 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
    print(atr) +
    #> <pai> with ISO common name $iso atrazine #> <chent> #> Identifier $identifier atrazine #> InChI Key $inchikey MXWJVTOOROXGIU-UHFFFAOYSA-N @@ -138,36 +209,36 @@ Additional chemical information is retrieved from the internet if available.

    #> "CCNC1=NC(=NC(=N1)Cl)NC(C)C" #> Molecular weight $mw: 215.7 #> PubChem synonyms (up to 10): -#> [1] "2256" "atrazine" "1912-24-9" "Gesaprim" "Chromozin" -#> [6] "Oleogesaprim" "Aktikon" "Argezin" "Atazinax" "Atranex"
    +#> [1] "atrazine" "1912-24-9" "Gesaprim" "Oleogesaprim" "Chromozin" +#> [6] "Aktikon" "Atrazin" "Argezin" "Atazinax" "Atranex"
    if (!is.null(atr$Picture)) { + plot(atr) +} +
    - + + + diff --git a/docs/reference/plot.chent-1.png b/docs/reference/plot.chent-1.png index a1798d9..330f0a5 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 fddd2e8..62bf38f 100644 --- a/docs/reference/plot.chent.html +++ b/docs/reference/plot.chent.html @@ -8,21 +8,29 @@ Plot method for chent objects — plot.chent • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    @@ -71,7 +80,7 @@ -
    +
    @@ -105,14 +114,12 @@
    -

    Plot method for chent objects

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

    Arguments

    @@ -125,11 +132,13 @@

    Further arguments passed to grid.picture

    - +

    Examples

    -
    caffeine <- chent$new("caffeine")
    #> PubChem:
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/cids/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IsomericSMILES,InChI,InChIKey,IUPACName,XLogP,TPSA,Complexity,Charge,HBondDonorCount,HBondAcceptorCount/JSON
    #> https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/synonyms/JSON
    #> 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> +
    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: @@ -137,38 +146,39 @@ #> "CN1C=NC2=C1C(=O)N(C(=O)N2C)C" #> Molecular weight $mw: 194.2 #> PubChem synonyms (up to 10): -#> [1] "2519" "caffeine" -#> [3] "58-08-2" "Guaranine" -#> [5] "1,3,7-Trimethylxanthine" "Thein" -#> [7] "Cafeina" "Methyltheobromine" -#> [9] "Koffein" "Mateina"
    if (!is.null(caffeine$Picture)) { - plot(caffeine) -}
    +#> [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) +} +
    - + + + diff --git a/docs/reference/pp.html b/docs/reference/pp.html index aa660cb..c4e4a01 100644 --- a/docs/reference/pp.html +++ b/docs/reference/pp.html @@ -8,21 +8,29 @@ R6 class for holding a product with at least one active ingredient — pp • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    @@ -71,7 +80,7 @@ -
    +
    @@ -105,54 +114,93 @@
    -

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

    -
    -
    pp
    - + +

    Format

    An R6Class generator object.

    - -

    Fields

    +

    Public fields

    - -
    +

    name

    The name of the product

    -
    ais

    A list of active ingredients

    -
    concentrations

    The concentration of the ais

    -
    concentration_units

    Defaults to g/L

    -
    + +
    ais

    A list of active ingredients

    + +
    concentrations

    The concentration of the ais

    + +
    concentration_units

    Defaults to g/L

    + +

    +

    Methods

    + +

    Public methods

    - - + + + + diff --git a/docs/reference/print.chent.html b/docs/reference/print.chent.html index 8f0dd0d..b188ed9 100644 --- a/docs/reference/print.chent.html +++ b/docs/reference/print.chent.html @@ -8,21 +8,29 @@ Printing method for chent objects — print.chent • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    @@ -71,7 +80,7 @@ -
    +
    @@ -105,14 +114,12 @@
    -

    Printing method for chent objects

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

    Arguments

    @@ -125,31 +132,33 @@

    Further arguments for compatibility with the S3 method

    - - - + + + + diff --git a/docs/reference/print.pai.html b/docs/reference/print.pai.html index add2687..284792f 100644 --- a/docs/reference/print.pai.html +++ b/docs/reference/print.pai.html @@ -8,21 +8,29 @@ Printing method for pai objects (pesticidal active ingredients) — print.pai • chents + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +38,10 @@ - + - + @@ -47,9 +55,10 @@ + - +
    @@ -71,7 +80,7 @@ -
    +
    @@ -105,14 +114,12 @@
    -

    Printing method for pai objects (pesticidal active ingredients)

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

    Arguments

    @@ -125,31 +132,33 @@

    Further arguments for compatibility with the S3 method

    - - - + + + + diff --git a/man/plot.chent.Rd b/man/plot.chent.Rd index e5a8770..f2850fa 100644 --- a/man/plot.chent.Rd +++ b/man/plot.chent.Rd @@ -14,3 +14,10 @@ \description{ Plot method for chent objects } +\examples{ +caffeine <- chent$new("caffeine") +print(caffeine) +if (!is.null(caffeine$Picture)) { + plot(caffeine) +} +} -- cgit v1.2.1