ONSModels-R

ONS Models in R
An easy to use zip file and simple instructions for using our models to calculate predicted properties for organic compounds. Currently the version calculates Abraham solvent coefficients (assuming c=0) using Model002
 * ONSModels-R Version 1.0.**

Instructions
1. The Open Source Statistics Program R - download R After installing R, you will need to install two packages: rcdk and [|randomForest] You can install the packages using R itself through the menu (I usually choose a USA mirror). If you prefer you may install the packages using local zip files or in the case of rcdk via GitHub.
 * Installation Instructions.**

2. and unzip it in the C:\ directory That is, once unzipped, all you models and script files should be in the C:\ONSModels-R directory. If you would like to put the directory in a different place you will need to update the setwd command inside the ONSModels-R.R file.

Once you have completed step 2, the script is ready to run.

1. Open R and source the script ONSModels-R.R
 * Usage Instructions**

2. Enter a SMILES or a list of SMILES separated by commas (no spaces). Here I calculate the Abraham solvent coefficients for 4-methylpent-3-en-2-one.

Code
The following code is released under a CC0 license. code setwd("C:/ONSModels-R") library(rcdk) library(randomForest) SMILESFUN <- function {
 * 1) change to the new directory
 * 1) load the necessary libraries
 * 1) Get user to input SMILEs

message("Enter SMILES separated by commas") x <- readLines(n = 1) return(x) }

smiles <- unlist(strsplit(SMILESFUN,",")) mols <- parse.smiles(smiles)
 * 1) get SMILES

e.rf <- readRDS("erfmodel") s.rf <- readRDS("srfmodel") a.rf <- readRDS("arfmodel") b.rf <- readRDS("brfmodel") v.rf <- readRDS("vrfmodel")
 * 1) load the model for the 'e' coefficient
 * 1) load the model for the 's' coefficient
 * 1) load the model for the 'a' coefficient
 * 1) load the model for the 'b' coefficient
 * 1) load the model for the 'v' coefficient

descNames <- unique(unlist(sapply(get.desc.categories, get.desc.names))) allDescs <- eval.desc(mols,descNames)
 * 1) get descriptors

e.predict <- signif(predict(e.rf,allDescs),digits=3) s.predict <- signif(predict(s.rf,allDescs),digits=3) a.predict <- signif(predict(a.rf,allDescs),digits=3) b.predict <- signif(predict(b.rf,allDescs),digits=3) v.predict <- signif(predict(v.rf,allDescs),digits=3)
 * 1) make predictions

results <- data.frame(e.predict,s.predict,a.predict,b.predict,v.predict) colnames(results) <- c("e","s","a","b","v")
 * 1) format the predictions for outputting

print(results) code
 * 1) print results to console