R: Ape Making An Ultrametric, Rooted, Binary Tree Which Can Be Converted Into An R Dendrogram Object
1
2
Entering edit mode
13.3 years ago
Timtico ▴ 330

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

r phylogenetics • 21k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode
11.4 years ago
Joseph Hughes ★ 3.0k

Hi,

I have had similar issues with rooting using root but I got round it using by keeping the basal trichotomy but forcing the tree as rooted:

sptree$root.edge <- 0

I found this in the R help for root. I hope it helps.

ADD COMMENT

Login before adding your answer.

Traffic: 1998 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6