Building a tree for binary data
Hi all,
I have a binary data set below and want to build a tree. Could you tell me which program can do that? Thanks. Yongjie
>V26_16
010011101
>V26_17
010011101
>V40_4
000010101
>V40_5
111111111
>09_9_24
010010101
>09_31_28
000010101
>552
111010101
>556
111010101
>494
111010101
>40
000000101
• 4,122 views
•
link
1 answer
This question seems more programming related than bioinformatics one. You can compute Hamming distance and then build a tree using Ape package in R.
Here is some sample code to do this, just in case
#load packages
install.packages("stringdist", "ape")
require(stringdist); require(ape)
# sample data
labels <- c("V26_16", "V26_15", "V26_14", "V26_13", "V26_12")
strings <- c("10111", "11000", "10100", "10110", "11111")
# compute hamming distance
dm <- stringdistmatrix(strings, strings, method = "hamming")
# convert to distance object, add labels
colnames(dm) <- labels
rownames(dm) <- labels
d <- dist(dm)
# hierarchical clustering
hcl <- hclust(d)
# plot the tree
phylo <- as.phylo(hcl)
phylo$tip.label <- hcl$labels
plot(phylo)

• 0 views
•
link
Log in to answer this question.
Thanks, mikhail. I appreciate your help. I'm not very familiar with R, but I think I can follow those codes you gave. I was also told PAUP and NTSYS can assist me. Thank you again.