Just to clarify for future users who stumble on Liam's solution for
Lilian, the second block of code attaches the new tips to
non-ultrametric trees at the same distance as the current tips at
maximum distance from the root.

If this is a time-scaled phylogeny and the tree's root depth is equal
to its age, these new tips then are at time=0, i.e. they are now
extant tip taxa.  If no tips actually extend to the present (i.e. the
root depth isn't equal to the age of the root, as often occurs if the
phylogeny is entirely composed of extinct taxa), or the tips are
actually older then the present day, then further modification is
necessary of the new branch length.

(Also, if the tree isn't time-scaled but branches are instead scaled
to some other measure, this may be undesirable because there may be no
special meaning to being maximally far from the root, especially if
its actually an unrooted tree.)

If you're tree has a $root.time element indicating the root's age
because it was time-scaled with packages strap or paleotree (or
because you manually gave it a $root.time), then you can do, where
tipAge is the tip's age before-present in the same time-units as the
branches are scaled:

newLength<-tree$root.time-tipAge-nodeheight(tree,node)
tree1<-bind.tip(tree,"tip.label",where=node,edge.length=newLength)

Cheers,
-Dave

On Sat, Jul 4, 2015 at 12:50 PM, Lilian Sayuri Ouchi de Melo
<sayuriou...@gmail.com> wrote:
> Hello Liam,
>
> Thank you very much for help me! My tree is not ultrametric and your second
> suggestion works perfectly!
>
> All the best and have a good time in Brazil!
>
> Em sáb, 4 de jul de 2015 às 12:31, Liam J. Revell <liam.rev...@umb.edu>
> escreveu:
>
>> Hi Lilian.
>>
>> If your tree is ultrametric, which you can check using:
>>
>> is.ultrametric(tree)
>>
>> then when you attach a tip to a node or edge using bind.tip the length
>> of the terminal edge leading to that tip will automatically be specified
>> so that the tree remains ultrametric.
>>
>> If this is not the case you could try the following, in which "node" is
>> the node number you want to attach the tip to:
>>
>> depth<-max(nodeHeights(tree))-nodeheight(tree,node)
>> tree<-bind.tip(tree,"tip.label",where=node,edge.length=depth)
>>
>> Let us know if this works.
>>
>> All the best, Lia
>>
>> Liam J. Revell, Assistant Professor of Biology
>> University of Massachusetts Boston
>> web: http://faculty.umb.edu/liam.revell/
>> email: liam.rev...@umb.edu
>> blog: http://blog.phytools.org
>>
>> On 7/3/2015 5:33 PM, Lilian Sayuri Ouchi de Melo wrote:
>> > Dear all,
>> >
>> > I have a time calibrated phylogeny and I need to insert some species on
>> it.
>> > When I added those species with bind.tip function (phytools) the new
>> > phylogenetic tree doesn't have the calibration time. I tried to solve
>> this
>> > problem in other packages such as APE and other programs like Mesquite
>> and
>> > online platforms, but I did not get the solution.
>> >
>> > Is there any method that enable the insertion of additional species in a
>> > time calibrated phylogeny without losing branch length information?
>> >
>> > Thank you all in advance
>> >
>>
> --
> Lilian Sayuri Ouchi de Melo
> (PhD student of São Paulo State University)
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> 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/



-- 
David W. Bapst, PhD
Adjunct Asst. Professor, Geology and Geol. Eng.
South Dakota School of Mines and Technology
501 E. St. Joseph
Rapid City, SD 57701

http://webpages.sdsmt.edu/~dbapst/
http://cran.r-project.org/web/packages/paleotree/index.html

_______________________________________________
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