#=======================================================
#=======================================================
rm(list=ls())
library(ChemmineR)
library(BioMedR)
dt <- data.frame(name=c(1:1604), smie =c(1:1604))
sdfset <- read.SDFset("drug_fda.sdf")
for (i in 1:1604) {
smiles <- sdf2smiles(sdfset[i])
smiles <- smiles@smilist
dt$smie[i] <- smiles
}
dt$smie <- as.character( dt$smie)
setwd("D:\\SCIwork\\F41\\IFI44")
mols = readMolFromSDF("drug_fda.sdf")
dat = extrDrugRuleOfFive(mols)
head(dat)
dat$name <- rownames(dat)
data_rule <- merge(dat, dt, by="name")
write.csv(data_rule, file = "data_rule.csv")
data_rule <- subset(data_rule, data_rule$LipinskiFailures == 0 )
#
# write.csv(data_rule, file = "data_rule1.csv")
drug <- read.csv("fda.csv", header = T)
names(drug)[2] <- 'smie'
data_rule <- merge(drug,data_rule, by="smie")
vs <- read.csv("virtualscreening.csv", header = T)
vs <- subset(vs, select = c("Ligand" , "Binding.Energy"))
names(vs)[1] <- 'zinc_id'
comdata <- merge(vs, data_rule, by="zinc_id")
write.csv(comdata, file = "comdata.csv")