Hi all,

I would like to prune several taxa with short distances between each other from 
a tree by setting a specific threshold and keep one of these taxa, but in the 
end I got all these taxa out... 

Following is a simple example I used, but ended in a wrong tree, not I expected.
# the original phylogeny
tree.ori<-cat("(A:6,(B:4,(C:1,D:1,(E:0.5,F:0.5):0.5):3):2);",file="tree.ori.tre")
tree.ori1<-read.tree("tree.ori.tre")
plot(tree.ori1) # the original phylogeny

# I want to make a final phylogeny by pruning the taxa of short distance, here 
shorter than 3. This will result in tree like this:
tree.fin<-cat("(A:6,(B:4,C:4):2);",file="tree.fin.tre")
tree.fin1<-read.tree("tree.fin.tre")
plot(tree.fin1) # the expected final phylogeny, C can be replaced by D, E or F.
tree.fin1.dist<-cophenetic(tree.fin1)
tree.fin1.dist # and a distance metrix like this (C, D, E or F present)

# following are what I did on the original tree:
tree.ori1.dist<-cophenetic(tree.ori1)
tree.ori1.dist # the original distance metrix, with 6 taxa
threshold<-3 # set the minimal distance between taxa as 3
diag(tree.ori1.dist) <- threshold + 1
ind <- apply(tree.ori1.dist, 1, min) > 3
diag(tree.ori1.dist) <- 0
tree.ori1.dist1 <- tree.ori1.dist[ind,ind]
tree.ori1.dist1 # however, the brench of C,D,E,F was removed...

Is there any function in R which allows to do this? 

Thank you very much!

All the best
Ting-Wen
--
Ting-Wen Chen
J.F. Blumenbach Institute of Zoology and Anthropology
Georg August University Goettingen
Berliner Str. 28
D-37073 Goettingen, Germany
Tel: +49-55139-10943  

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to