Mercurial > hg > plosone_underreview
diff scripts_R/radial_dendro.R @ 76:d17833be50ca branch-tests
merged
author | Maria Panteli <m.x.panteli@gmail.com> |
---|---|
date | Fri, 22 Sep 2017 16:30:36 +0100 |
parents | cc028157502a |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts_R/radial_dendro.R Fri Sep 22 16:30:36 2017 +0100 @@ -0,0 +1,14 @@ +library(ape) +library(cluster) + +df = read.csv("data/cluster_freq.csv") +data = df[,2:dim(df)[2]] +rownames(data) <- df$labels +distMahal = as.dist(apply(data, 1, function(i) mahalanobis(data, i, cov = cov(data),tol=1e-18))) +hc=hclust(distMahal, method="average") +mypal = c("#000000", "#9B0000", "#9B0000", "#9B0000", "#9B0000") +clus5 = cutree(hc, 5) +pdf('data/hierarchical_cluster_R.pdf') +par(mar=c(1,1,1,1)) +plot(as.phylo(hc),type="fan",tip.color=mypal[clus5], cex=.5, label.offset=.5) +dev.off()