Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ knitr::opts_chunk$set(
)
```

[![Build Status](https://api.travis-ci.org/CDK-R/cdkr.svg?branch=master)](https://travis-ci.org/CDK-R/cdkr)

[![CRAN Version](https://www.r-pkg.org/badges/version/rcdk?color=green)](https://cran.r-project.org/package=rcdk)
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/grand-total/rcdk?color=green)](https://cran.r-project.org/package=rcdk)
[![CRAN Downloads Monthyl](http://cranlogs.r-pkg.org/badges/last-month/rcdk?color=green)](https://cran.r-project.org/package=rcdk)
Expand Down
3 changes: 3 additions & 0 deletions rcdk/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^pkgdown$
^revdep$
README.Rmd
vignettes/Features_29.Rmd
^doc$
^Meta$
4 changes: 3 additions & 1 deletion rcdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ revdep/
.Rhistory
.Rproj
*.Rmd
*.png
*.png
/doc/
/Meta/
19 changes: 10 additions & 9 deletions rcdk/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Package: rcdk
Version: 3.9.0
Date: 2024-03-02
Version: 3.8.2
Date: 2025-09-10
Title: Interface to the 'CDK' Libraries
Authors@R: c(
person('Rajarshi', 'Guha', ,'rajarshi.guha@gmail.com', role=c('aut',"cph"),
comment = c(ORCID = "0000-0001-7403-8819")),
person('Zachary', 'Charlop-Powers', ,'zach.charlop.powers@gmail.com',role=c('cre'),
person('Zachary', 'Charlop-Powers', ,'zach.charlop.powers@gmail.com',role=c('cre'),
comment = c(ORCID = "0000-0001-8816-4680")),
person('Emma', 'Schymanski', ,'schymane@gmail.com', role=c('ctb'),
comment = c(ORCID = "0000-0001-6868-8145")))
person('Emma', 'Schymanski', ,'schymane@gmail.com', role=c('ctb'),
comment = c(ORCID = "0000-0001-6868-8145")),
person('Egon', 'Willighagen', ,'egon.willighagen@maastrichtuniversity.nl', role=c('ctb'),
comment = c(ORCID = "0000-0001-7542-0286")))
Depends:
rcdklibs (>= 2.9)
Imports:
Expand All @@ -23,8 +25,7 @@ Suggests:
RUnit,
knitr,
rmarkdown,
devtools,
depict
devtools
License: LGPL
URL: https://github.com/CDK-R/cdkr
LazyLoad: yes
Expand All @@ -35,7 +36,7 @@ Description: Allows the user to access functionality in the
'CDK', a Java framework for chemoinformatics. This allows the user to load
molecules, evaluate fingerprints, calculate molecular descriptors and so on.
In addition, the 'CDK' API allows the user to view structures in 2D.
RoxygenNote: 7.3.1
RoxygenNote: 7.3.3
VignetteBuilder: knitr
Encoding: UTF-8
Remotes: CDK-R/depict

4 changes: 2 additions & 2 deletions rcdk/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rcdk 3.9.0
# rcdk 3.8.2

* Update rCDK to work with rcdklibs 2.9
* Update rCDK to work with rcdklibs 2.11

# rcdk 3.8.0

Expand Down
11 changes: 5 additions & 6 deletions rcdk/R/deprecated_functions.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
################################################################################
#' Deprecated functions in the rcdk package.
#'
#'
#' These functions are provided for compatibility with older version of
#' the phyloseq package. They may eventually be completely
#' removed.
#'
#'
#' @usage deprecated_rcdk_function(x, value, ...)
#' @rdname rcdk-deprecated
#' @name rcdk-deprecated
#' @param x For assignment operators, the object that will undergo a replacement
#' (object inside parenthesis).
#' @param value For assignment operators, the value to replace with
#' @param value For assignment operators, the value to replace with
#' (the right side of the assignment).
#' @param ... For functions other than assignment operators,
#' @param ... For functions other than assignment operators,
#' parameters to be passed to the modern version of the function (see table).
#' @docType package
#' @export do.typing
#' @aliases deprecated_rcdk_function do.typing
#' @details
Expand All @@ -24,4 +23,4 @@
#'
deprecated_rcdk_function <- function(x, value, ...){return(NULL)}
do.typing <- function(...){.Deprecated("set.atom.types", package="rcdk");return(set.atom.types(...))}
################################################################################
################################################################################
64 changes: 31 additions & 33 deletions rcdk/R/fingerprint.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Generate molecular fingerprints
#'
#'
#' `get.fingerprint` returns a `fingerprint` object representing molecular fingerprint of
#' the input molecule.
#'
#'
#' @param molecule A \code{jobjRef} object to an \code{IAtomContaine}
#' @param type The type of fingerprint. Possible values are:
#' \itemize{
Expand All @@ -18,52 +18,50 @@
#' \item pubchem - 881 bit fingerprints defined by PubChem
#' \item kr - 4860 bit fingerprint defined by Klekota and Roth
#' \item shortestpath - A fingerprint based on the shortest paths between pairs of atoms and takes into account ring systems, charges etc.
#' \item signature - A feature,count type of fingerprint, similar in nature to circular fingerprints, but based on the signature
#' \item signature - A feature,count type of fingerprint, similar in nature to circular fingerprints, but based on the signature
#' descriptor
#' \item circular - An implementation of the ECFP6 (default) fingerprint. Other circular types can be chosen by modifying the \code{circular.type} parameter.
#' \item substructure - Fingerprint based on list of SMARTS pattern. By default a set of functional groups is tested.
#' }
#' @param fp.mode The style of fingerprint. Specifying "`bit`" will return a binary fingerprint,
#' "`raw`" returns the the original representation (usually sequence of integers) and
#' "`raw`" returns the the original representation (usually sequence of integers) and
#' "`count`" returns the fingerprint as a sequence of counts.
#' @param depth The search depth. This argument is ignored for the
#' `pubchem`, `maccs`, `kr` and `estate` fingerprints
#' @param size The final length of the fingerprint.
#' This argument is ignored for the `pubchem`, `maccs`, `kr`, `signature`, `circular` and
#' @param size The final length of the fingerprint.
#' This argument is ignored for the `pubchem`, `maccs`, `kr`, `signature`, `circular` and
#' `estate` fingerprints
#' @param substructure.pattern List of characters containing the SMARTS pattern to match. If the an empty list is provided (default) than the functional groups substructures (default in CDK) are used.
#' @param circular.type Name of the circular fingerprint type that should be computed given as string. Possible values are: 'ECFP0', 'ECFP2', 'ECFP4', 'ECFP6' (default), 'FCFP0', 'FCFP2', 'FCFP4' and 'FCFP6'.
#' @param verbose Verbose output if \code{TRUE}
#' @return an S4 object of class \code{\link{fingerprint-class}} or \code{\link{featvec-class}},
#' @return an S4 object of class \code{\link[fingerprint]{fingerprint-class}} or \code{\link[fingerprint]{featvec-class}},
#' which can be manipulated with the fingerprint package.
#' @export
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
#' @examples
#' @examples
#' ## get some molecules
#' sp <- get.smiles.parser()
#' smiles <- c('CCC', 'CCN', 'CCN(C)(C)', 'c1ccccc1Cc1ccccc1','C1CCC1CC(CN(C)(C))CC(=O)CC')
#' smiles <- c('CCC', 'CCN')
#' mols <- parse.smiles(smiles)
#'
#' ## get a single fingerprint using the standard
#' ## (hashed, path based) fingerprinter
#' fp <- get.fingerprint(mols[[1]])
#'
#' ## get MACCS keys for all the molecules
#'
#' ## get a single fingerprint using MACCS (fast)
#' fp <- get.fingerprint(mols[[1]], type='maccs')
#'
#' ## get MACCS keys for both molecules
#' fps <- lapply(mols, get.fingerprint, type='maccs')
#'
#'
#' ## get Signature fingerprint
#' ## feature, count fingerprinter
#' fps <- lapply(mols, get.fingerprint, type='signature', fp.mode='raw')
#' ## get Substructure fingerprint for functional group fragments
#' fps <- lapply(mols, get.fingerprint, type='substructure')
#'
#'
#' ## get Substructure count fingerprint for user defined fragments
#' mol1 <- parse.smiles("c1ccccc1CCC")[[1]]
#' smarts <- c("c1ccccc1", "[CX4H3][#6]", "[CX2]#[CX2]")
#' fps <- get.fingerprint(mol1, type='substructure', fp.mode='count',
#' substructure.pattern=smarts)
#'
#' ## get ECFP0 count fingerprints
#'
#' ## get ECFP0 count fingerprints
#' mol2 <- parse.smiles("C1=CC=CC(=C1)CCCC2=CC=CC=C2")[[1]]
#' fps <- get.fingerprint(mol2, type='circular', fp.mode='count', circular.type='ECFP0')
get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=6, size=1024, substructure.pattern=character(), circular.type = "ECFP6", verbose=FALSE) {
Expand All @@ -75,17 +73,17 @@ get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=

mode(size) <- 'integer'
mode(depth) <- 'integer'

# Determine integer ID for the circular fingerprint given its desired type.
# This allows us to use also ECFP4, ...
# This allows us to use also ECFP4, ...
if (type == 'circular') {
circular.type.id <- switch(circular.type,
circular.type.id <- switch(circular.type,
ECFP0 = 1, ECFP2 = 2, ECFP4 = 3, ECFP6 = 4,
FCFP0 = 5, FCFP2 = 6, FCFP4 = 7, FCFP6 = 8,
NULL)

if (is.null(circular.type.id)) stop(paste('Invalid circular fingerprint type: ', circular.type))

mode(circular.type.id) <- 'integer'
}

Expand All @@ -103,8 +101,8 @@ get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=
shortestpath = .jnew('org/openscience/cdk/fingerprint/ShortestPathFingerprinter', size),
signature = .jnew('org/openscience/cdk/fingerprint/SignatureFingerprinter', depth),
circular = .jnew('org/openscience/cdk/fingerprint/CircularFingerprinter', circular.type.id),
substructure =
if (length(substructure.pattern) == 0)
substructure =
if (length(substructure.pattern) == 0)
# Loads the default group substructures
{ .jnew('org/openscience/cdk/fingerprint/SubstructureFingerprinter') }
else
Expand All @@ -125,11 +123,11 @@ get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=
} else if (fp.mode == 'count') {
jfp <- .jcall(fingerprinter,
"Lorg/openscience/cdk/fingerprint/ICountFingerprint;",
"getCountFingerprint", molecule, check=FALSE)
"getCountFingerprint", molecule, check=FALSE)
}

e <- .jgetEx()
if (.jcheck(silent=TRUE)) {
if (.jcheck(silent=TRUE)) {
if (verbose) print(e)
return(NULL)
}
Expand All @@ -139,15 +137,15 @@ get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=

if (fp.mode == 'bit') {
bitset <- .jcall(jfp, "Ljava/util/BitSet;", "asBitSet")

if (type == 'maccs') nbit <- 166
else if (type == 'estate') nbit <- 79
else if (type == 'pubchem') nbit <- 881
else if (type == 'kr') nbit <- 4860
else if (type == 'substructure') nbit <- .jcall(fingerprinter, "I", "getSize")
else if (type == 'circular') nbit <- .jcall(fingerprinter, "I", "getSize")
else nbit <- size

bitset <- .jcall(bitset, "S", "toString")
s <- gsub('[{}]','', bitset)
s <- strsplit(s, split=',')[[1]]
Expand All @@ -166,7 +164,7 @@ get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=
tempkey <- .jsimplify(tempkey)
}
keys[[i]] <- tempkey

}

values <- list()
Expand Down
6 changes: 3 additions & 3 deletions rcdk/R/formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ generate.formula <- function(mass,
#' @param tol The tolerance
#' @return A \code{jobjRef} corresponding to an instance of \code{IsotopePatternSimilarity}
#' @seealso \code{\link{compare.isotope.pattern}}
#' @references \url{http://cdk.github.io/cdk/1.5/docs/api/org/openscience/cdk/formula/IsotopePatternSimilarity.html}
#' @references \url{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/formula/IsotopePatternSimilarity.html}
#' @author Miguel Rojas Cherto
get.isotope.pattern.similarity <- function(tol = NULL) {
ips <- .jnew("org/openscience/cdk/formula/IsotopePatternSimilarity")
Expand All @@ -544,7 +544,7 @@ get.isotope.pattern.similarity <- function(tol = NULL) {
#'
#' @param minAbundance The minimum abundance
#' @return A \code{jobjRef} corresponding to an instance of \code{IsotopePatternGenerator}
#' @references \url{http://cdk.github.io/cdk/1.5/docs/api/org/openscience/cdk/formula/IsotopePatternGenerator.html}
#' @references \url{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/formula/IsotopePatternGenerator.html}
#' @author Miguel Rojas Cherto
get.isotope.pattern.generator <- function(minAbundance = NULL) {
if (is.null(minAbundance))
Expand All @@ -564,7 +564,7 @@ get.isotope.pattern.generator <- function(minAbundance = NULL) {
#' @return A numeric value between 0 and 1 indicating the similarity between the two patterns
#' @seealso \code{\link{get.isotope.pattern.similarity}}
#' @export
#' @references \url{http://cdk.github.io/cdk/2.3/docs/api/org/openscience/cdk/formula/IsotopePatternSimilarity.html}
#' @references \url{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/formula/IsotopePatternSimilarity.html}
#' @author Miguel Rojas Cherto
compare.isotope.pattern <- function(iso1, iso2, ips = NULL) {
cls <- unique(c(class(iso1), class(iso2)))
Expand Down
4 changes: 2 additions & 2 deletions rcdk/R/rcdk.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#' a builder object when directly working with the CDK API via
#' `rJava`.
#'
#' This method returns an instance of the \href{https://cdk.github.io/cdk/2.5/docs/api/org/openscience/cdk/silent/SilentChemObjectBuilder.html}{SilentChemObjectBuilder}.
#' This method returns an instance of the \href{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/silent/SilentChemObjectBuilder.html}{SilentChemObjectBuilder}.
#' Note that this is a static object that is created at package load time,
#' and the same instance is returned whenever this function is called.
#'
#' @return An instance of \href{https://cdk.github.io/cdk/2.5/docs/api/org/openscience/cdk/silent/SilentChemObjectBuilder.html}{SilentChemObjectBuilder}
#' @return An instance of \href{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/silent/SilentChemObjectBuilder.html}{SilentChemObjectBuilder}
#' @export
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
get.chem.object.builder <- function() {
Expand Down
12 changes: 6 additions & 6 deletions rcdk/R/smiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#'
#' The CDK supports a variety of customizations for SMILES generation including
#' the use of lower case symbols for aromatic compounds to the use of the ChemAxon
#' \href{http://butane.chem.uiuc.edu/jsmoore/marvin/help/formats/cxsmiles-doc.html}{CxSmiles}
#' \href{https://docs.chemaxon.com/display/docs/formats_chemaxon-extended-smiles-and-smarts-cxsmiles-and-cxsmarts.md}{CxSmiles}
#' format. Each 'flavor' is represented by an integer and multiple
#' customizations are bitwise OR'ed. This method accepts the names of one or
#' more customizations and returns the bitwise OR of them.
#' See \href{https://cdk.github.io/cdk/2.3/docs/api/index.html?org/openscience/cdk/smiles/SmiFlavor.html}{CDK documentation}
#' See \href{https://cdk.github.io/cdk/2.10/docs/api/index.html?org/openscience/cdk/smiles/SmiFlavor.html}{CDK documentation}
#' for the list of flavors and what they mean.
#'
#' @param flavors A character vector of flavors. The default is \code{Generic}
Expand Down Expand Up @@ -42,7 +42,7 @@
#' @md
#' @return A numeric representing the bitwise `OR`` of the specified flavors
#' @seealso \code{\link{get.smiles}}
#' @references \href{https://cdk.github.io/cdk/2.3/docs/api/index.html?org/openscience/cdk/smiles/SmiFlavor.html}{CDK documentation}
#' @references \href{https://cdk.github.io/cdk/2.10/docs/api/index.html?org/openscience/cdk/smiles/SmiFlavor.html}{CDK documentation}
#' @examples
#' m <- parse.smiles('C1C=CCC1N(C)c1ccccc1')[[1]]
#' get.smiles(m)
Expand Down Expand Up @@ -96,7 +96,7 @@ smiles.flavors <- function(flavors = c('Generic')) {
#' The function will generate a SMILES representation of an
#' `IAtomContainer` object. The default parameters of the CDK SMILES
#' generator are used. This can mean that for large ring systems the
#' method may fail. See CDK \href{http://cdk.github.io/cdk/2.2/docs/api/org/openscience/cdk/smiles/SmilesGenerator.html}{Javadocs}
#' method may fail. See CDK \href{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/smiles/SmilesGenerator.html}{Javadocs}
#' for more information
#' @param molecule The molecule to query. Should be a `jobjRef` representing an `IAtomContainer`
#' @param flavor The type of SMILES to generate. See \code{\link{smiles.flavors}}. Default is `Generic`
Expand All @@ -106,7 +106,7 @@ smiles.flavors <- function(flavors = c('Generic')) {
#' @seealso \code{\link{parse.smiles}}, \code{\link{smiles.flavors}}
#' @export
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
#' @references \href{http://cdk.github.io/cdk/2.2/docs/api/org/openscience/cdk/smiles/SmilesGenerator.html}{SmilesGenerator}
#' @references \href{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/smiles/SmilesGenerator.html}{SmilesGenerator}
#' @examples
#' m <- parse.smiles('C1C=CCC1N(C)c1ccccc1')[[1]]
#' get.smiles(m)
Expand All @@ -127,7 +127,7 @@ get.smiles <- function(molecule, flavor = smiles.flavors(c('Generic')), smigen =
#' to instantiate a new parser for each call
#'
#' @return A `jobjRef` object corresponding to the CDK
#' \href{http://cdk.github.io/cdk/2.2/docs/api/org/openscience/cdk/smiles/SmilesParser.html}{SmilesParser} class
#' \href{https://cdk.github.io/cdk/2.10/docs/api/org/openscience/cdk/smiles/SmilesParser.html}{SmilesParser} class
#' @seealso \code{\link{get.smiles}}, \code{\link{parse.smiles}}
#' @export
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
Expand Down
16 changes: 13 additions & 3 deletions rcdk/cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## General Comments

- submission of rcdk 3.8.1
- fix to the SystemRequirements Field
- update CITATION file
- 3rd resubmission. Fixed the final URL issue. More long test avoidance on CRAN/linux
- 2nd resubmission. The URL issue seems to be related to CACHE; I've slimmed the Unit tests to fit in time.
- resubmission with a number of small URL fixes
- submission of rcdk 3.8.2
- add Egon
- update links to fingerprint
- fix a few lints and tests


── R CMD check results ─────────────────────────────── rcdk 3.8.2 ────
Duration: 25.5s

0 errors ✔ | 0 warnings ✔ | 0 notes ✔
Loading
Loading