#Save this as tr.awk
{
for (i=1; i<=NF; i++) a[NR,i]=$i
}
END {
for (i=1; i<=NF; i++) {
for (j=1; j<=NR; j++) {
printf "%s", a[j,i]
if (j<NR) printf "%s", OFS
}
printf "%s",ORS
}
}
#Run this on command-line to transpose ur file
awk -f tr.awk bbb.txt > bbbout.txt
#Plot in R
tetra <- read.csv("bbbout.txt", header=T, stringsAsFactors = F, sep = "\t", row.names = 1)
hc = hclust(dist(tetra))
plot (hc)