This repo is for the creation of an HTMLWidget for visualizing moleules based on the ChemDoodle WebComponent library, the HTMLWidgets package, and the Chemistry Development Kit via rCDK. Warning: development in flux and liable to break until version 1.0!
And the development version from GitHub with:
# install.packages("devtools")
# devtools::install_github("zachcp/chemdoodle")
library(chemdoodle)
chemdoodle_viewer("C1CCCCC1", width = 100, height = 100)
chemdoodle_transform("C1CCCCC1", width = 100, height = 100)
chemdoodle_slideshow(c("C1CCCCC1", "CNCNCNC1CCCCC1", "CN1C=NC2=C1C(=O)N(C(=O)N2C)C",
"CC1=C(C=C(C2=C1C(=C)OC2=O)OC)OC"), 200,200, bondscale=15)
The ChemDoodle Sketcher needs extra work for functionality. You can use
drawMolecule()
to create a seketcher and the molecule is captured as
ChemDoodle JSON which can be converted to a CDK Atom and be passed
around, converter or whatever. Currently round-tripping (putting the
molecule back) doesn’t work because there are some issues around
properly scaling the compound.
#experimetal/new features
# gets a molecule from the chemdoodle sketcher
moljson <- drawMolecule()
# processed the Molecule JSON to a CDK AtomContainer - this can be saved,
# written to Smiles etc.
mol <- processChemDoodleJson(moljson)
# convert to SMILES
smi <- toSmiles(mol)
# convert to InChi
inchi <- toInChi(mol)
# try sending a molecule to the sketcher (needs work)
drawMolecule(mol=mol)
# you can also try a minimal shiny example
shiny::runApp(appDir = "examples/minimalshinyapp/")