From d6c7e8f5a0d0d4b564addf5b447bed6b3ba03b5e Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 5 Mar 2026 11:47:12 +0100 Subject: Do not depend on RDKit in pai test This hopefully addresses test failures observed on R-Universe. Update coverage report. --- docs/coverage/coverage.html | 338 ++++++++++++++++++++++---------------------- 1 file changed, 169 insertions(+), 169 deletions(-) (limited to 'docs/coverage/coverage.html') diff --git a/docs/coverage/coverage.html b/docs/coverage/coverage.html index 1e9d0ad..5b3b3f1 100644 --- a/docs/coverage/coverage.html +++ b/docs/coverage/coverage.html @@ -3,16 +3,16 @@ - + - + - - + + @@ -95,7 +95,7 @@ table.table-condensed { font-size: 11px; }
-

chents coverage - 34.64%

+

chents coverage - 33.77%

-
- +
+
@@ -990,16 +990,16 @@ table.table-condensed {
      if (rdkit) {
- + 126 - 1x + !
        if (rdkit_available) {
- + 127 - 1x + !
          self$get_rdkit(template = template)
@@ -1692,28 +1692,28 @@ table.table-condensed { 226 - 2x + 1x
      available_smiles <- names(self$smiles)
227 - 2x + 1x
      smiles_preference <- c("user", "PubChem", "PubChem_Connectivity")
228 - 2x + 1x
      smiles_preferred_i <- min(match(available_smiles, smiles_preference))
229 - 2x + 1x
      smiles_preferred <- smiles_preference[smiles_preferred_i]
@@ -1727,56 +1727,56 @@ table.table-condensed { 231 - 2x + 1x
      message("Get chemical information from RDKit using ",
232 - 2x + 1x
              smiles_preferred, " SMILES\n",
233 - 2x + 1x
              self$smiles[smiles_preferred])
234 - 2x + 1x
      self$rdkit <- list()
235 - 2x + 1x
      self$mol <- rdkit_module$Chem$MolFromSmiles(self$smiles[1])
236 - 2x + 1x
      self$rdkit$mw <- rdkit_module$Chem$Descriptors$MolWt(self$mol)
237 - 2x + 1x
      if (!is.null(self$mw) && !is.na(self$mw)) {
238 - 2x + 1x
        if (round(self$rdkit$mw, 1) != round(self$mw, 1)) {
@@ -1839,14 +1839,14 @@ table.table-condensed { 247 - 2x + 1x
      rdkit_module$Chem$rdDepictor$Compute2DCoords(self$mol)
248 - 2x + 1x
      if (!is.null(template)) {
@@ -1881,56 +1881,56 @@ table.table-condensed { 253 - 2x + 1x
      d2d <- rdkit_module$Chem$Draw$rdMolDraw2D$MolDraw2DSVG(400L, 400L)
254 - 2x + 1x
      d2d$DrawMolecule(self$mol)
255 - 2x + 1x
      d2d$FinishDrawing()
256 - 2x + 1x
      self$svg <- d2d$GetDrawingText()
257 - 2x + 1x
      svgfile <- tempfile(fileext = ".svg")
258 - 2x + 1x
      psfile <- tempfile(fileext = ".ps")
259 - 2x + 1x
      writeLines(self$svg, svgfile)
260 - 2x + 1x
      rsvg::rsvg_ps(svgfile, psfile)
@@ -1951,21 +1951,21 @@ table.table-condensed { 263 - 2x + 1x
      ps_font_line <- grep("Tm$", readLines(psfile), value = TRUE)[1]
264 - 2x + 1x
      ps_font_size <- gsub(" .*$", "", ps_font_line)
265 - 2x + 1x
      self$Pict_font_size = as.numeric(ps_font_size)
@@ -1986,35 +1986,35 @@ table.table-condensed { 268 - 2x + 1x
      xmlfile <- tempfile(fileext = ".xml")
269 - 2x + 1x
      PostScriptTrace(psfile, outfilename = xmlfile)
270 - 2x + 1x
      unlink(paste0("capture", basename(psfile)))
271 - 2x + 1x
      self$Picture <- readPicture(xmlfile)
272 - 2x + 1x
      unlink(c(xmlfile, psfile, svgfile))
@@ -4690,126 +4690,126 @@ table.table-condensed { 654 -
#' # On Travis, we get a certificate validation error,
+
#' atr <- pai$new("atrazine")
655 -
#' # likely because the system (xenial) is so old,
+
#' print(atr)
656 -
#' # therefore don't run this example on Travis
+
#' if (!is.null(atr$Picture)) {
657 -
#' if (Sys.getenv("TRAVIS") == "") {
+
#'   plot(atr)
658 -
#'
+
#' }
659 -
#' atr <- pai$new("atrazine")
+
#' # We can also define pais that are not found on the BCPC site
660 -
#' print(atr)
+
#' decanol <- pai$new("1-Decanol")
661 -
#' if (!is.null(atr$Picture)) {
+
#' print(decanol)
662 -
#'   plot(atr)
+
pai <- R6Class("pai",
663 -
#' }
+
  inherit = chent,
664 -
#'
+
  public = list(
665 -
#' }
+

                     
                   
                   
                     666
                     
                     
-                      
pai <- R6Class("pai",
+
    #' @field iso ISO common name of the active ingredient according to ISO 1750
667 -
  inherit = chent,
+
    iso = NULL,
668 -
  public = list(
+

                     
                   
                   
                     669
                     
                     
-                      

+                      
    #' @field bcpc Information retrieved from the BCPC compendium available online
670 -
    #' @field iso ISO common name of the active ingredient according to ISO 1750
+
    #' at <pesticidecompendium.bcpc.org>
671 -
    iso = NULL,
+
    bcpc = NULL,
@@ -4822,603 +4822,603 @@ table.table-condensed { 673 - -
    #' @field bcpc Information retrieved from the BCPC compendium available online
- - - - 674 - - -
    #' at <pesticidecompendium.bcpc.org>
- - - - 675 - - -
    bcpc = NULL,
- - - - 676 - - -

-                    
-                  
-                  
-                    677
-                    
                     
                       
    #' @description
- 678 + 674
    #' Create a new pai object
- 679 + 675
    #' @param iso The ISO common name to be used in the query of the
- 680 + 676
    #' BCPC compendium
- 681 + 677
    #' @param identifier Alternative identifier used for querying pubchem
- 682 + 678
    #' @param smiles Optional user provided SMILES code
- 683 + 679
    #' @param inchikey Optional user provided InChI Key
- 684 + 680
    #' @param bcpc Should the BCPC compendium be queried?
- 685 + 681
    #' @param pubchem Should an attempt be made to retrieve chemical
- 686 + 682
    #' information from PubChem via the webchem package?
- 687 + 683
    #' @param pubchem_from Possibility to select the argument
- 688 + 684
    #' that is used to query pubchem
- 689 + 685
    #' @param rdkit Should an attempt be made to retrieve chemical
- 690 + 686
    #' information from a local rdkit installation via python
- 691 + 687
    #' and the reticulate package?
- 692 + 688
    #' @param template An optional SMILES code to be used as template for RDKit
- 693 + 689
    #' @param chyaml Should we look for a identifier.yaml file in the working
- 694 + 690
    initialize = function(iso, identifier = iso,
- 695 + 691
      smiles = NULL, inchikey = NULL, bcpc = TRUE,
- 696 + 692
      pubchem = TRUE, pubchem_from = 'auto',
- 697 + 693
      rdkit = TRUE, template = NULL,
- 698 + 694
      chyaml = FALSE)
- 699 + 695
    {
- 700 + 696

                     
                   
                   
-                    701
+                    697
                     1x
                     
                       
      if (!is.null(inchikey)) {
- 702 + 698 !
        self$inchikey = inchikey
- 703 + 699 !
        attr(self$inchikey, "source") <- "user"
- 704 + 700
      }
- 705 + 701

                     
                   
                   
-                    706
+                    702
                     1x
                     
                       
      if (!missing(iso) & bcpc) {
- 707 + 703 1x
        message("Querying BCPC for ", identifier, " ...")
- 708 + 704 1x
        bcpc_result = webchem::bcpc_query(identifier, from = "name")
- 709 + 705

                     
                   
                   
-                    710
+                    706
                     
                     
                       
        # Use first element of list, as we passed a query of length one
- 711 + 707 1x
        if (is.na(bcpc_result[[1]][1])) {
- 712 + 708 !
          message("Common name ", identifier, " is not known at the BCPC compendium, trying PubChem")
- 713 + 709
        } else {
- 714 + 710 1x
          self$bcpc = bcpc_result[[1]]
- 715 + 711 1x
          self$iso = self$bcpc$cname
- 716 + 712 1x
          attr(self$iso, "source") <- "bcpc"
- 717 + 713 1x
          attr(self$iso, "status") <- self$bcpc$status
- 718 + 714 1x
          bcpc_ik = self$bcpc$inchikey
- 719 + 715 1x
          if (length(bcpc_ik) == 1 && !is.na(bcpc_ik)) {
- 720 + 716 1x
            if (is.null(self$inchikey)) {
- 721 + 717 1x
              self$inchikey = substr(self$bcpc$inchikey, 1, 27)
- 722 + 718 1x
              attr(self$inchikey, "source") <- "bcpc"
- 723 + 719
            } else {
- 724 + 720 !
              if (bcpc_ik == self$inchikey) {
- 725 + 721 !
                attr(self$inchikey, "source") = c(attr(self$inchikey, "source"), "bcpc")
- 726 + 722
              } else {
- 727 + 723 !
                warning("InChIKey ", self$inchikey, " differs from ", bcpc_ik, " obtained from bcpc.org")
- 728 + 724
              }
- 729 + 725
            }
- 730 + 726
          }
- 731 + 727
        }
- 732 + 728
      }
- 733 + 729

                     
                   
                   
-                    734
+                    730
                     
                     
                       
      # Set pubchem_from if not specified
- 735 + 731 1x
      if (pubchem_from == 'auto') {
- 736 + 732 1x
        pubchem_from = 'name'
- 737 + 733 1x
        if (!is.null(self$inchikey)) {
- 738 + 734 1x
          pubchem_from = 'inchikey'
- 739 + 735
        }
- 740 + 736
      }
- 741 + 737

                     
                   
                   
-                    742
+                    738
                     1x
                     
                       
      super$initialize(identifier = identifier,
- 743 + 739 1x
        smiles = smiles, inchikey = self$inchikey,
- 744 + 740 1x
        pubchem = pubchem, pubchem_from = pubchem_from,
- 745 + 741 1x
        rdkit = rdkit, template = template, chyaml = chyaml)
- 746 + 742

                     
                   
                   
-                    747
+                    743
                     1x
                     
                       
      invisible(self)
- 748 + 744
    }
- 749 + 745
  )
- 750 + 746
)
- 751 + 747

                     
                   
                   
-                    752
+                    748
                     
                     
                       
#' Printing method for pai objects (pesticidal active ingredients)
- 753 + 749
#'
- 754 + 750
#' @param x The chent object to be printed
- 755 + 751
#' @param ... Further arguments for compatibility with the S3 method
- 756 + 752
#' @export
- 757 + 753
print.pai = function(x, ...) {
- 758 + 754 + ! + +
  if (is.null(x$iso)) {
+ + + + 755 ! -
  cat("<pai> with ISO common name $iso", x$iso, "\n")
+
    cat("<pai> without ISO common name\n")
+ + + + 756 + + +
  } else {
+ + + + 757 + ! + +
    cat("<pai> with ISO common name $iso", x$iso, "\n")
+ + + + 758 + + +
  }
-- cgit v1.2.3