## ------------------------------------------------
## load data and retrieve two samples
## ------------------------------------------------
library(healthyFlowData)
data(hd)
sample1 = exprs(hd.flowSet[[1]])
sample2 = exprs(hd.flowSet[[2]])
## ------------------------------------------------
## cluster sample using kmeans algorithm
## ------------------------------------------------
clust1 = kmeans(sample1, centers=4, nstart=20)
clust2 = kmeans(sample2, centers=4, nstart=20)
cluster.labels1 = clust1$cluster
cluster.labels2 = clust2$cluster
## ------------------------------------------------
## Create ClusteredSample object
## and compute dissimilarity between two clustered samples
## using the mixed edge cover algorithm
## ------------------------------------------------
clustSample1 = ClusteredSample(labels=cluster.labels1, sample=sample1)
clustSample2 = ClusteredSample(labels=cluster.labels2, sample=sample2)
D = dist.sample(clustSample1, clustSample2, dist.type='Mahalanobis', unmatch.penalty=999999)
Run the code above in your browser using DataLab