Dear Brian,

Awesome. Thanks for sharing the code Brian. I will give it a try. I see
what you all mean now more precisely with the question of what does it
really mean to have branch lengths on a consensus tree.

Thanks, Scott


On Wed, Nov 21, 2012 at 11:10 AM, Brian O'Meara <bome...@utk.edu> wrote:

>
> I have a function to create a consensus tree with branch lengths. You feed
> it a given topology (often a consensus topology, made with ape), then a
> list of trees, and tell it what you want the branch lengths to represent.
> It could be the proportion of input trees with that edge (good for
> summarizing bootstrap or Bayes proportions) or the mean, median, or sd of
> branch lengths for those trees that have that edge. Consensus branch
> lengths in units of proportion of matching trees has obvious utility. As
> Daniel says, the average branch lengths across a set of trees is more
> difficult to see a use case for, but you could imagine doing something like
> taking the ratogram output from r8s on a set of trees and summarizing the
> rate average and rate sd on a given, "best", tree as two sets of branch
> lengths on that tree.
>
> I've put the function source at
> https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/R/consensusBrlen.R?revision=110&root=omearalab.
>   You can source the file for the function (consensusBrlen() ) and other
> functions it needs. It also uses phylobase. Note that this is alpha-quality
> code -- it's been checked a bit, but verify it's doing what you want.
>
> Here's an example of how to use it
>
>  library(ape)
>
> library(phylobase)
>
> phy.a<-rcoal(15)
>
> phy.b<-phy.a
>
> phy.b$edge.length<-phy.b$edge.length+runif(length(phy.b$edge.length), 0,
> 0.1)
>
> phy.c<-rcoal(15)
>
> phy.list<-list(phy.a, phy.b, phy.c)
>
> phy.consensus<-consensusBrlen(phy.a, list(phy.a, phy.b, phy.c),
> type="mean_brlen")
>
>
> Best,
> Brian
>
>
> PS: Note that I am actively looking for grad students: info at
> http://www.brianomeara.info/lab . Guaranteed five years support, subject
> to decent performance.
>
> _______________________________________
> Brian O'Meara
> Assistant Professor
> Dept. of Ecology & Evolutionary Biology
> U. of Tennessee, Knoxville
> http://www.brianomeara.info
>
> Students wanted: Applications due Dec. 15, annually
> Postdoc collaborators wanted: Check NIMBioS' website
> Calendar: http://www.brianomeara.info/calendars/omeara
>
>
>
> On Wed, Nov 21, 2012 at 11:09 AM, Daniel Barker <d...@st-andrews.ac.uk>wrote:
>
>> Dear Scott,
>>
>> What should branch lengths on a consensus tree represent?
>>
>> They cannot be expected substitutions per residue. This would imply no
>> evolution at points where uncertain branching patterns have been reduced
>> to a multi-furcation - which is not what the multi-furcation is meant to
>> imply. (Rather: there was evolution, but we aren't very certain about the
>> branching pattern.)
>>
>> But, MrBayes does provide average lengths of some kind.
>>
>> Best wishes,
>>
>> Daniel
>>
>> On 21/11/2012 15:13, "Scott Chamberlain" <myrmecocys...@gmail.com> wrote:
>>
>> >When making a consensus tree using ape::consensus the branch lengths are
>> >lost. Is there a way to not lose the branch lengths? Or to add them
>> >somehow
>> >to the consensus tree after making it.
>> >
>> >library(ape)
>> >>
>>
>> >>cat("owls(((Strix_aluco:4.2,Asio_otus:4.1):4.1,Athene_noctua:7.3):6.3,Tyt
>> >>o_alba:13.5);",     file = "ex1.tre", sep = "\n")>
>>
>> >>cat("owls(((Strix_aluco:1.2,Asio_otus:4.5):3.1,Athene_noctua:7.3):6.3,Tyt
>> >>o_alba:13.5);",     file = "ex2.tre", sep = "\n")>
>>
>> >>cat("owls(((Strix_aluco:3.2,Asio_otus:4.7):8.1,Athene_noctua:7.3):6.3,Tyt
>> >>o_alba:13.5);",     file = "ex3.tre", sep = "\n")> tree1 <-
>> >>read.tree("ex1.tre")> tree2 <- read.tree("ex2.tre")> tree3 <-
>> >>read.tree("ex3.tre")> trees <- c(tree1, tree2, tree3)> trees_con <-
>> >>consensus(trees)> trees_con
>> >Phylogenetic tree with 4 tips and 3 internal nodes.
>> >Tip labels:[1] "Strix_aluco"   "Asio_otus"     "Athene_noctua"
>> "Tyto_alba"
>> >Rooted; no branch lengths.
>> >
>> >
>> >Thanks, Scott Chamberlain
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >_______________________________________________
>> >R-sig-phylo mailing list
>> >R-sig-phylo@r-project.org
>> >https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>> >
>>
>>
>> --
>> Daniel Barker
>> http://bio.st-andrews.ac.uk/staff/db60.htm
>> The University of St Andrews is a charity registered in Scotland : No
>> SC013532
>>
>> _______________________________________________
>> R-sig-phylo mailing list
>> R-sig-phylo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>
>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to