options(repos="https://ftp.yz.yamagata-u.ac.jp/pub/cran/")
if(!require("BiocManager",quietly=T)){install.packages("BiocManager")}
x <- c("ChemmineR","ChemmineOB");for(i in x){
  if(!require(i,character.only=T)){
    BiocManager::install(i);library(i,character.only=T)}};rm(x,i)
ifname <- "DataChemicalProperty.csv"
data <- read.csv(ifname,stringsAsFactors=FALSE)
mols <- paste0("mol/",data$KNApSAcK_CID,".mol"); mols
sdfset <- read.SDFset(mols[1])
#view(sdfset)
for(xx in 2:length(mols)){
  tmp <- read.SDFset(mols[xx])
  sdfset <- c(sdfset,tmp)
}
sdfid(sdfset)
unique_ids <- makeUnique(sdfid(sdfset)); unique_ids
cid(sdfset) <- unique_ids 
props <- data[,c("Name","KNApSAcK_CID","StartingMaterial")]
datablock(sdfset) <- props
write.SDF(sdfset,file="DataStructureProperty.sdf")
view(sdfset)