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)
#[1]
ifname <- "DataStructureProperty.sdf"
sdfset <- read.SDFset(ifname)
blockMatrix <- datablock2ma(datablocklist=datablock(sdfset))
View(blockMatrix)
#[2]====http.//openbabel.org.wiki/Category:Fingerprints
fpset<-fingerprintOB(sdfset,"FP2")
#fpset<-fingerprintOB(sdfset,"FP3")
#fpset<-fingerprintOB(sdfset,"FP4")
view(fpset)
fpsetBI<-as.matrix(fpset); dim(fpsetBI)
View(fpsetBI)
#[3]=== Hierarchical Clustering ===
moldata<-cbind(blockMatrix,fpsetBI)
View(moldata)
rr<-rownames(moldata)
bb<-blockMatrix[,3]
rownames(moldata)<-paste0(bb,"(",rr,")")
nf<-dim(moldata)[[2]]
distdata<-dist(moldata[,4:nf],method="euclidian"); distdata
hclustdata<-hclust(distdata,method="ward.D2")
plot(hclustdata,main="FP2")
#plot(hclustdata,main="FP3")
#plot(hclustdata,main="FP4")