Just forwarding this alternative to the list in case anyone is interested.
As Liam pointed out, branch lengths of 0 might not be exactly what you're
after, depending on the situation. This could also be done using
cophenetic() on a phylo object and subsetting accordingly...

---------- Forwarded message ----------
From: Roey Angel <an...@mpi-marburg.mpg.de>
Date: Wed, Jun 12, 2013 at 3:11 PM
Subject: Re: [R-sig-phylo] Listing all tips with 0 length terminal branches
To: Eliot Miller <em...@mail.umsl.edu>


 Works great, thanks.
I just wonder if it's really necessary to convert to an S4 object.

Cheers
Roey


On 06/12/2013 06:54 PM, Eliot Miller wrote:

 Is this what you want? This should return the tip labels of all taxa
connected to their most recent common ancestor by a branch length of zero.
You need to use the phylobase package and load a tree in in Newick format.

library(phylobase)

ape.phylo <- read.tree("apeTree.tre")

phylobase.phylo <- suppressWarnings(as(ape.phylo,"phylo4"))

allLengths <- data.frame(phylobase.phylo@edge,
branch.length=phylobase.phylo@edge.length)

justTips <- allLengths[allLengths$descendant >=1 & allLengths$descendant <=
length(ape.phylo$tip.label),]

zeroTerminals <- justTips[justTips$branch.length == 0, ]

phylobase.phylo@label[names(phylobase.phylo@label) %in%
zeroTerminals$descendant]

 If you wanted to output them in groups, you could do something like:

nodesOfInterest <- unique(zeroTerminals$ancestor)

descendants(phylobase.phylo, nodesOfInterest, type="children")

 Cheers,
Eliot


On Wed, Jun 12, 2013 at 7:52 AM, Roey Angel <an...@mpi-marburg.mpg.de>wrote:

> Hi
> Is there a way to detect and list all tips of a tree with 0 length in
> their terminal branches (essentially duplicated sequences)?
> Would also be great if it's possible to output them in groups so that
> it's clear which tips are identical to which.
>
> Thanks
> Roey
>
>         [[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/
>
>

        [[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/

Reply via email to