I am using smile codes for the FDA approved drugs available in chEMBL 22 database. I am using the package rcdk and I am using this code:
library(rcdk)
dat1<-read.csv("chembl_22_drug_export.txt",sep="\t",header=T)
smi <-lapply(as.character(dat1$CANONICAL_SMILES),parse.smiles)
cmp.fp<-vector("list",nrow(dat1))
## generate fingerprints
for (i in 1:nrow(dat1)){
cmp.fp[i]<-lapply(smi[[i]][1],get.fingerprint,type="maccs")
}
##Convert fingerprints to matrix form
fpmac<-fp.to.matrix(cmp.fp)
cmp.finger<-as.data.frame(fpmac)
But when I do
smi <- lapply(as.character(chembl_22_drug_export$CANONICAL_SMILES), parse.smiles)
I get the following error
Error in .jnew("org/openscience/cdk/smiles/SmilesParser", dcob) :
Java Exception <no description because toString() failed>.jnew("org/openscience/cdk/smiles/SmilesParser", dcob)<S4 object of class "jobjRef">
Kindly guide me how do I resolve this error?
The error is spewed when rcdk package is not installed. Error occurs because of fault loading due to rJava package requirement. rcdk package required jdk of 7 or more. echo JAVA_HOME and update the locale along with language as well. The environment variable should be updated. Close R and restart the R console after you update the java environment. Remember: rcdk package requires supporting library as fingerprints and rJava as well.