Dear all,
I realize that this question might be very (too) specific but I hope someone can help me out here. I'm trying to build a phylogenetic treeusing ClustalW2 (protein), and convert this into an R dendrogram object. This dendrogram object I want to use to rearrange some heatmaps I have (expression / labdata).
I use the ape package to read in the treefile that clustal (EBI) outputs in Phylip format. after this i define the outgroup and try to get it ultrametric using a Sanderson molecular aging algorithm (chronopl in the ape package). I need the tree to be ultrametric, rooted and binary to be able to convert it into an R dendrogram using the as.hclust.phylo function. Here is some R code (I can provide you with the treefile upon request).
require("ape")
library("gplots")
rm(list=ls(all=TRUE))
### read in Phylip guidetree created in ClustalW2
setwd("/Users/Tim/Desktop/DatagatherTransporters/ape/")
sptree <- read.tree(file = "sptree3.phylip", text = NULL, tree.names = NULL, skip = 0,
comment.char = "#", keep.multi = FALSE)
#plot(sptree, cex = 0.5)
outgroup <- match(c("root1","root2"),sptree$tip.label)
sptree.rooted <- root(sptree,outgroup,node = NULL)
sptree.rooted.ultra <- chronopl(sptree.rooted, 0, age.min = 1, age.max = NULL,node = "root", S = 1, tol = 1e-8,CV = FALSE, eval.max = 500, iter.max = 500)
drop.tip(sptree.rooted.ultra,outgroup)
is.ultrametric(sptree.rooted.ultra)
is.binary.tree(sptree.rooted.ultra)
is.rooted(sptree.rooted.ultra)
> drop.tip(sptree.rooted.ultra,outgroup)
Phylogenetic tree with 126 tips and 125 internal nodes.
Tip labels:
An01g00340, An07g02420, An02g12160, An07g01230, An11g10600, An17g01560, ...
Rooted; includes branch lengths.
>
> is.ultrametric(sptree.rooted.ultra)
[1] TRUE
> is.binary.tree(sptree.rooted.ultra)
[1] TRUE
> is.rooted(sptree.rooted.ultra)
[1] FALSE
So, I've been fiddling with the code alot, and at one stage I was able to create a binary, ultrametric, rooted tree. But I'm unable to replicate it using a different treefile. I use an artifical outgroup (root1 and root2) that are two random sequences. They group nicely together.
I hope someone with abit more experience in this. What is the best approach?
All help is much appreciated,
Tim
Why the artificial outgroup? Maybe the error is in how you remove it? Also, what is the result of is.rooted(sptree.rooted) ? Maybe the root function failed for whatever reason - drop.tip should keep the rootedness if the tree is rooted.