Neither do I imagine what is Fernando going to do with this, but I think
this is what he wants to do:
F - rtree(10) # suppose this is Fernando's tree
F$edge.length
[1] 0.26509875 0.87023285 0.99953710 0.22727375 0.72152984 0.66757869
[7] 0.19363565 0.79213697 0.58417425 0.90608903 0.09822511 0.62101620
[13] 0.96507543 0.75824378 0.04740603 0.90538387 0.59199804 0.24499763
F$edge.length - x$edge.length/min(x$edge.lengt)
F$edge.length
[1] 5.592089 18.357006 21.084596 4.794195 15.220211 14.082146 4.084620
[8] 16.709623 12.322783 19.113369 2.071996 13.099940 20.357650 15.994668
[15] 1.00 19.098494 12.487820 5.168069
Hope it helps!
Leandro Jones
2012/8/28 Liam J. Revell liam.rev...@umb.edu
Hi Fernando.
I'm not entirely sure what you're going for, but let me try to be of some
help.
The tree is stored in memory as what is called a list - basically, a set
of objects that can be of different types. The branch lengths of the tree
are stored in the list element edge.length. So, for a phylo object with
the variable name tree, you can access the branch lengths of the tree using
tree$edge.length. (If your tree does not have branch lengths, this will be
NULL.)
Consequently, you can assign any arbitrary values to the branch lengths of
the tree by assigning values to tree$edge.length. For instance, to set all
branch lengths to 1.0, you would just do:
tree$edge.length-rep(1,nrow(**tree$edge))
The order of tree$edge.length corresponds to the row order of tree$edge,
so if you want to see which branches in tree$edge.length correspond to
which branches on the tree, you can do something like the following (here,
I use a simple random tree for illustration):
set.seed(1)
tree-rtree(10); tree$edge.length-rep(1,nrow(**tree$edge))
X-tree$edge
X[X[,2]%in%1:length(tree$tip),**2]-
tree$tip[X[X[,2]%in%1:length(**tree$tip),2]]
names(tree$edge.length)-**paste(X[,1],X[,2],sep=,)
plot(tree); nodelabels()
tree$edge.length
Now if, for instance, I want to make the branch length leading from node
13 to tip taxon t6 to (for instance) 3.0, I could just do:
tree$edge.length[13,t6]-3
plot(tree); nodelabels()
Of course, if we have some simple criterion on which we want to change our
branch lengths, we can do that to. For instance, if we wanted to set all
branch lengths with length 1 to 1.0 and all branch lengths with length 1
to 2.0, we could do it as follows:
tree$edge.length-runif(n=**nrow(tree$edge),min=0,max=2)
tree$edge.length
tree$edge.length[tree$edge.**length1]-1
tree$edge.length[tree$edge.**length1]-2
tree$edge.length
plot(tree)
I hope this is of some help.
All the best, Liam
Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web:
http://faculty.umb.edu/liam.**revell/http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://phytools.blogspot.com
On 8/28/2012 4:15 PM, Fernando Sobral wrote:
Hi,
I am trying to alter the branch lengths of a phylogeny so that the smaller
branch has size igual 1 and the larger branch is the proportional sum of
the smaller branchs. For example, if the larger branch is equivalent to
ten
smaller branchs, it should have size igual to 10. I already tryed use some
functions like compute.brlen(), compute.brtime() and rescaleTree(), but
did
not work.
Any help would be greatly appreciated.
Thanks,
Fernando L. Sobral
[[alternative HTML version deleted]]
__**_
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo
__**_
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/**listinfo/r-sig-phylohttps://stat.ethz.ch/mailman/listinfo/r-sig-phylo
--
Dr. Leandro R. Jones, Ph.D.
Director General de Coordinación Institucional
Secretaría de Ciencia, Tecnología e Innovación Productiva
Gobierno de la Provincia del Chubut
--
Dr. Leandro R. Jones, Ph.D.
Director General de Coordinación Institucional
Secretaría de Ciencia, Tecnología e Innovación Productiva
Gobierno de la Provincia del Chubut
[[alternative HTML version deleted]]
___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo