Perform hierarchical clustering with given linkage, and apply horizontal cutting of tree into k clusters
doHclust(d, k, linkage)
list of clusters and labels
example_dta<-create_example_data_for_R()
X=as.matrix(example_dta$counts)
#Default ... values:
default.par <- list(q=0.25,Kmax.rec=5,B=100,ref.gen="PC",dist.method="euclidean",cl.method="hclust",linkage="average",cor.method="pearson",nstart=10)
#Check for user modifications:
fixed.par <- c(minDist=NULL,minSize=2,modifyList(default.par,list(cor.method='pearson',linkage='average')))
#Find stopping threshold if minDist is NULL
minDist <- get.threshold(X,q=fixed.par$q,fixed.par)
fixed.par$minDist <- minDist
cl.lab <- findPartition(X=X,Kmax=10,dX=NULL,fixed.par)
gap.res <- gap(X=X,Kmax=10,cl.lab=cl.lab,B=fixed.par$B,ref.gen=fixed.par$ref.gen,fixed.par=fixed.par)
hc.res <- doHclust(getDist(X,dist.method=fixed.par$dist.method,cor.method=fixed.par$cor.method),k=1,linkage=fixed.par$linkage)$cl #(k is irrelevant here, only specified because doHclust needs it)