Skip to content

Commit

Permalink
Update Website and Docs (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachcp authored Mar 3, 2024
1 parent 72eb945 commit 8cf4328
Show file tree
Hide file tree
Showing 22 changed files with 281 additions and 29 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version](https://www.r-pkg.org/badges/version/rcdk?color=green)](https://cran.r-
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)
[![R-CMD-check](https://github.com/zachcp/cdkr/workflows/R-CMD-check/badge.svg)](https://github.com/zachcp/cdkr/actions)

# rcdk: a chemistry library

Expand Down Expand Up @@ -36,25 +37,23 @@ install_github("https://github.com/CDK-R/cdkr", subdir="rcdk")
Information on building and devloping the CDKR package is available in
teh Otherwise if you prefer the command line

```
cd /tmp/
git clone git@github.com:CDK-R/rcdklibs.git
R CMD INSTALL rcdklibs
git clone git@github.com:CDK-R/cdkr.git
cd cdkr/rcdkjar
ant clean jar
cd ../
R CMD INSTALL rcdk
```
cd /tmp/
git clone git@github.com:CDK-R/rcdklibs.git
R CMD INSTALL rcdklibs
git clone git@github.com:CDK-R/cdkr.git
cd cdkr/rcdkjar
ant clean jar
cd ../
R CMD INSTALL rcdk

Before performing the install, you should have the following
dependencies installed:

- rJava
- fingerprint
- png
- RUnit
- Java JDK \>= 1.8
- rJava
- fingerprint
- png
- RUnit
- Java JDK \>= 1.8

For the png package, I have tested
[png-0.1-7](http://www.rforge.net/png/files/)
Expand Down Expand Up @@ -86,7 +85,7 @@ You can try the following:
# set the java version
R CMD javareconf # or ....
sudo R CMD javareconf

# re install fromfrom R
install.packages('rJava', type="source")

Expand Down
3 changes: 2 additions & 1 deletion rcdk/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^revdep$
^revdep$
README.Rmd
6 changes: 6 additions & 0 deletions rcdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
inst/doc
docs
revdep/
.RData
.Rhistory
.Rproj
*.Rmd
*.png
23 changes: 15 additions & 8 deletions rcdk/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Package: rcdk
Version: 3.8.1
Date: 2023-06-25
Version: 3.9.0
Date: 2024-03-02
Title: Interface to the 'CDK' Libraries
Authors@R: c(person('Rajarshi', 'Guha', role=c('aut',"cph"), email='rajarshi.guha@gmail.com'),
person('Zachary', 'Charlop-Powers', role=c('cre'), email='zach.charlop.powers@gmail.com'),
person('Emma', 'Schymanski', role=c('ctb'), email='schymane@gmail.com'))
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'),
comment = c(ORCID = "0000-0001-8816-4680")),
person('Emma', 'Schymanski', ,'schymane@gmail.com', role=c('ctb'),
comment = c(ORCID = "0000-0001-6868-8145")))
Depends:
rcdklibs (>= 2.8)
rcdklibs (>= 2.9)
Imports:
fingerprint,
rJava,
Expand All @@ -19,8 +23,10 @@ Suggests:
RUnit,
knitr,
rmarkdown,
devtools
devtools,
depict
License: LGPL
URL: https://github.com/CDK-R/cdkr
LazyLoad: yes
LazyData: true
SystemRequirements: Java (>= 8)
Expand All @@ -29,6 +35,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.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Encoding: UTF-8
Remotes: CDK-R/depict
4 changes: 4 additions & 0 deletions rcdk/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# rcdk 3.9.0

* Update rCDK to work with rcdklibs 2.9

# rcdk 3.8.0

* Change DESCRIPTION in accordance with CRAN rules about JDKs
Expand Down
2 changes: 1 addition & 1 deletion rcdk/R/atoms.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#' length \code{2}.
#'
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
#' @docType package
#' @aliases rcdk-package
NULL

## An example of getting all the coordinates for a molecule
Expand Down
36 changes: 36 additions & 0 deletions rcdk/README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/"
)
```

# rcdk <img src="man/figures/logo.png" align="right" alt="" width="120" />

<!-- badges: start -->
[![CRAN Status](https://www.r-pkg.org/badges/version/rcdk)](https://cran.r-project.org/package=rcdk){.rcdk-release}
[![R-CMD-check](https://github.com/CDK-R/rcdk/workflows/R-CMD-check/badge.svg)](https://github.com/CDK-R/cdkr/actions){.rcdk-devel}
[![Codecov test coverage](https://codecov.io/gh/r-lib/rcdk/branch/main/graph/badge.svg)](https://app.codecov.io/gh/CDK-R/cdkr?branch=main)
<!-- badges: end -->

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.


## Installation

::: .rcdk-release
```{r, eval = FALSE}
# Install released version from CRAN
install.packages("rcdk")
```
:::



2 changes: 1 addition & 1 deletion rcdk/man/Atoms.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added rcdk/man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions rcdk/man/rcdk-deprecated.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions rcdk/_pkgdown.yml → rcdk/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
url: https://cdk-r.github.io/cdkr/

home:
title: Interact with the Chemistry Development Kit


template:
bootstrap: 5
bslib:
primary: "#0054AD"
border-radius: 0.5rem
btn-border-radius: 0.25rem

development:
mode: auto


reference:
- title: rCDK Functions



- subtitle: rCDK Data and Docs
desc: >
Available Datasets or Documentation
Expand Down Expand Up @@ -115,4 +125,4 @@ reference:
contents:
- cdk.version
- cdkFormula-class
- rcdk-deprecated
- rcdk-deprecated
Binary file added rcdk/pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rcdk/pkgdown/favicon/favicon.ico
Binary file not shown.
174 changes: 174 additions & 0 deletions rcdk/vignettes/Features_29.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
title: "Features 2.9"
author: "Zachary Charlop-Powers"
date: "`r Sys.Date()`"
output:
rmarkdown::html_vignette:
toc: true
vignette: >
%\VignetteIndexEntry{Features 2.9}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---


# CDK 2.9 Release Notes Vignettes

[CDK 2.9 Release Notes](https://github.com/cdk/cdk/releases/tag/cdk-2.9)

[rJava](https://rforge.net/rJava/docs/reference/index.html)


## RXN Arrows

https://github.com/cdk/cdk/pull/927

```{r setup, message=FALSE}
library(rcdklibs)
library(depict)
# Java Imports
sp <- J('org.openscience.cdk.smiles.SmilesParser')
silentchemobject <- J("org.openscience.cdk.silent.SilentChemObjectBuilder")
smiles_parser <- new(sp, silentchemobject$getInstance())
ReactionManipulator <- J('org.openscience.cdk.tools.manipulator.ReactionManipulator')
IReaction <- J('org.openscience.cdk.interfaces.IReaction')
dg <- .jnew('org.openscience.cdk.depict.DepictionGenerator')
to_svg <- function(grd) {
svg_str <- grd$toSvgStr()
svg_list <- strsplit(svg_str, "\n")[[1]]
paste(svg_list[3:length(svg_list)], collapse="\n")
}
abbreviations <- .jnew('org.openscience.cdk.depict.Abbreviations')
abbreviations$add("[Al+3].[Cl-].[Cl-].[Cl-] AlCl3")
abbreviations$add("ClCCl DCM")
abbreviations$setContractToSingleLabel(TRUE)
```


```{r results='asis'}
rxn <- smiles_parser$parseReactionSmiles("[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][cH:13][cH:14][cH:15]1.[CH2:3]([CH2:4][C:5](=[O:6])Cl)[CH2:2][Cl:1]>[Al+3].[Cl-].[Cl-].[Cl-].C(Cl)Cl>[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][c:13]([cH:14][cH:15]1)[C:5](=[O:6])[CH2:4][CH2:3][CH2:2][Cl:1] |f:2.3.4.5| Friedel-Crafts acylation [3.10.1]")
# note `as.list`
for (mol in as.list(ReactionManipulator$getAllAtomContainers(rxn))) {
abbreviations$apply(mol)
}
rxn$setDirection(IReaction$Direction$NO_GO)
svg <- depiction() |> depict(rxn)
to_svg(svg)
```



```{r results='asis'}
rxn <- smiles_parser$parseReactionSmiles("[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][cH:13][cH:14][cH:15]1.[CH2:3]([CH2:4][C:5](=[O:6])Cl)[CH2:2][Cl:1]>[Al+3].[Cl-].[Cl-].[Cl-].C(Cl)Cl>[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][c:13]([cH:14][cH:15]1)[C:5](=[O:6])[CH2:4][CH2:3][CH2:2][Cl:1] |f:2.3.4.5| Friedel-Crafts acylation [3.10.1]")
for (mol in as.list(ReactionManipulator$getAllAtomContainers(rxn))) {
abbreviations$apply(mol)
}
rxn$setDirection(IReaction$Direction$RETRO_SYNTHETIC)
svg <- depiction() |> depict(rxn)
to_svg(svg)
```


```{r results='asis'}
rxn <- smiles_parser$parseReactionSmiles("[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][cH:13][cH:14][cH:15]1.[CH2:3]([CH2:4][C:5](=[O:6])Cl)[CH2:2][Cl:1]>[Al+3].[Cl-].[Cl-].[Cl-].C(Cl)Cl>[CH3:9][CH:8]([CH3:10])[c:7]1[cH:11][cH:12][c:13]([cH:14][cH:15]1)[C:5](=[O:6])[CH2:4][CH2:3][CH2:2][Cl:1] |f:2.3.4.5| Friedel-Crafts acylation [3.10.1]")
for (mol in as.list(ReactionManipulator$getAllAtomContainers(rxn))) {
abbreviations$apply(mol)
}
rxn$setDirection(IReaction$Direction$BIDIRECTIONAL)
svg <- depiction() |> depict(rxn)
to_svg(svg)
```

```{r results='asis'}
rxn <- smiles_parser$parseReactionSmiles("c1c(Cl)cccc1[N-][N+]#N>>c1c(Cl)cccc1N=[N+]=[N-]")
for (mol in as.list(ReactionManipulator$getAllAtomContainers(rxn))) {
abbreviations$apply(mol)
}
rxn$setDirection(IReaction$Direction$RESONANCE)
svg <- depiction() |> depict(rxn)
to_svg(svg)
```



## Multi-Step Smiles

```java
SmilesParser sp = new SmilesParser(SilentChemObjectBuilder.getInstance());
IReactionSet rset = sp.parseReactionSetSmiles("[Pb]>>[Ag]>>[Au] lead-to-silver-to-gold");
```

```{r results='asis'}
multi_smiles <- "ClC1=NC=2N(C(=C1)N(CC3=CC=CC=C3)CC4=CC=CC=C4)N=CC2C(OCC)=O>C1(=CC(=CC(=N1)C)N)N2C[C@H](CCC2)O.O1CCOCC1.CC1(C2=C(C(=CC=C2)P(C3=CC=CC=C3)C4=CC=CC=C4)OC5=C(C=CC=C15)P(C6=CC=CC=C6)C7=CC=CC=C7)C.C=1C=CC(=CC1)\\C=C\\C(=O)\\C=C\\C2=CC=CC=C2.C=1C=CC(=CC1)\\C=C\\C(=O)\\C=C\\C2=CC=CC=C2.C=1C=CC(=CC1)\\C=C\\C(=O)\\C=C\\C2=CC=CC=C2.[Pd].[Pd].[Cs]OC(=O)O[Cs]>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(OCC)=O)N6C[C@H](CCC6)O>CO.C1CCOC1.O.O[Li]>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(O)=O)N6C[C@H](CCC6)O>CN(C)C(=[N+](C)C)ON1C2=C(C=CC=N2)N=N1.F[P-](F)(F)(F)(F)F.[NH4+].[Cl-].CN(C)C=O.CCN(C(C)C)C(C)C>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N(CC4=CC=CC=C4)CC5=CC=CC=C5)N=CC3C(N)=O)N6C[C@H](CCC6)O>>C1(=CC(=CC(=N1)C)NC2=NC=3N(C(=C2)N)N=CC3C(N)=O)N4C[C@H](CCC4)O |f:4.5.6.7.8,16.17,18.19| US20190241576A1"
rxn_set <- smiles_parser$parseReactionSetSmiles(multi_smiles)
svg <- depiction() |> depict(rxn_set)
to_svg(svg)
```


## Features 2.8

### Maygen

<WIP>

```{r}
maygen_cls <- J('org.openscience.cdk.structgen.maygen.Maygen')
#smioutout_cls <- J('org.openscience.cdk.structgen.maygen.SmiOutputConsumer')
silentchemobject <- J("org.openscience.cdk.silent.SilentChemObjectBuilder")
smigen_cls <- J('org.openscience.cdk.smiles.SmilesGenerator')
smigen <- .jnew('org.openscience.cdk.smiles.SmilesGenerator')
#IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
#SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Default);
maygen <- new(maygen_cls, silentchemobject$getInstance())
maygen$setFormula("C3Cl2H4")
# smigen$create()
# consumer
# maygen$setConsumer(mol)
# maygen$run()
# StringWriter sw = new StringWriter();
# maygen.setConsumer(new SmiOutputConsumer(sw));
# StringWriter sw = new StringWriter();
# SdfOutputConsumer consumer = new SdfOutputConsumer(sw);
# consumer.setCoordinates(true);
# maygen.setConsumer(mol -> {
# try {
# System.out.println(smigen.create(mol));
# } catch (CDKException ignore) { }
# });
#
# int count = maygen.getCount(); // number of structures generated
```

Loading

0 comments on commit 8cf4328

Please sign in to comment.