# NOT RUN {
#sample data
data(qspr.data)
idx <- sample(nrow(qspr.data), 5000)
smis <- paste(qspr.data[idx,1])
y <- qspr.data[idx,c(2,5)]
#learning a pattern of chemical strings
data(trainedSMI)
data(engram_5k) #same as run => engram <- ENgram$new(trainedSMI, order=10)
#learning QSPR model
data(qsprpred_EG_5k)
#same as run => qsprpred <- QSPRpred$new(smis=smis, y=as.matrix(y), v_fpnames="graph")
#set target range
targ.min <- c(200,1.5)
targ.max <- c(350,2.5)
qsprpred_EG_5k$set_target(targ.min,targ.max)
#getting chemical strings from the Inverse-QSPR model
smchem <- SmcChem$new(smis = rep("c1ccccc1O", 25), v_qsprpred=qsprpred_EG_5k,
v_engram=engram_5k,temp=3)
smchem$smcexec(niter=5, preorder=0, nview=4)
#if OpenBabel (>= 2.3.1) is installed, you can use reordering for better mixing as
#smchem$smcexec(niter=100, preorder=0.2, nview=4)
#see http://openbabel.org
#check
gensmis <- smchem$get_hiscores(nsmi=5, exsim=0.9)
pred <- qsprpred_EG_5k$qspr_predx(gensmis[,1])
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab