Read, preprocess, and featurize chemical data using RDKit.
The tidychem
package offers a lightweight R interface for accessing RDKit via the RDKit Python API.
Installation
First of all, install RDKit. Make sure it is discoverable by reticulate.
Then install tidychem
with:
remotes::install_github("nanxstats/tidychem")
Usage
reticulate::use_python("/usr/local/bin/python3")
library("tidychem")
"smi-multiple.smi" %>%
tidychem_example() %>%
read_smiles() %>%
fp_morgan()
Developers
If you have already installed Python and tidychem, and want to develop tidychem in RStudio, simply create a file .Rprofile
under the package directory and set the Python binary path (Homebrew Python 3 path example below):
Sys.setenv(RETICULATE_PYTHON = "/usr/local/bin/python3")
The next time you open the project, the correct Python path and library path should be already set. For more technical details, see reticulate Python version configuration.