Skip to content

Instantly share code, notes, and snippets.

@meren
Created August 24, 2013 00:12
Show Gist options
  • Save meren/6325174 to your computer and use it in GitHub Desktop.
Save meren/6325174 to your computer and use it in GitHub Desktop.
This should create an iTOL compatible newick tree under your home directory..
library('ape')
library('vegan')
library('ade4')
raw_data <- t(data.matrix(read.table('YOUR TAB DELIMITED TRANSCRIPTOMIC DATA MATRIX', header = TRUE, row.names = 1, sep="\t")))
drows<-vegdist(t(raw_data), method='euclidean', na.rm=TRUE)
hc <- hclust(drows, method='ward')
phy <- hclust2phylog(hc, add.tools = TRUE)
write.tree(as.phylo(phy), file="~/newick.tre")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment