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 <- "DataChemicalStructure.sdf"
sdfset <- read.SDFset(ifname)
#[1]--- Data matrix
blockMatrix<-datablock2ma(datablocklist=datablock(sdfset))
#[2]==== Molecular Proparties ==========
c01<-atomcountMA(sdfset)
c02<-MW(sdfset)
c03<-bonds(sdfset,type="addNH")   #total count of NH for each compound
c04<-exactMassOB(sdfset)
c05<-groups(sdfset,groups="fctgroup",type="countMA")
dmatPropOB<-propOB(sdfset) 
names(dmatPropOB)
c06<-dmatPropOB[,c(6:13)]
#[3]--------------
cname01<-colnames(c01)
cname05<-colnames(c05)
cname06<-colnames(c06)
cname07<-colnames(blockMatrix)
#[4]-----------------
mergeddata<-data.frame(blockMatrix,c01,c02,c03,c04,c05,c06)
colnames(mergeddata)<-c(cname07,cname01,"Mw","addNH","EMass",cname05,cname06)
write.csv(mergeddata,file="MolPropData01.csv",row.names=TRUE)