HI Max,

Not entirely sure if this is what you want but i did come across a script to 
extract direct sister pairs (tips) in a tree

>From the dryad supplement of  Grossenbacher D, Briscoe Runquist R, Goldberg 
>EE, Brandvain Y (2015) Geographic range size is predicted by plant mating 
>system. Ecology Letters 18(7): 706-713.

https://doi.org/10.5061/dryad.hv117/6 <https://doi.org/10.5061/dryad.hv117/6>

The script grabs sister pairs across a sample of tree and gives their distance 
- i.e. pairs of tips that are monophyletic

here is the code I have from that script (might be worth getting it from the 
source script again)

#####
# Get all sisters
GetSisters = function(TREE){
  tips = TREE$edge[TREE$edge[,2]<=length(TREE$tip.label),]
  sis.nodes = tips[duplicated(tips[,1]),1]
  tmp=data.frame(cbind(sis.nodes,do.call(rbind,lapply(sis.nodes,function(NODE){
    this = TREE$edge[,1]==NODE
    c(TREE$edge[this,2][1:2],sum(TREE$edge.length[this][1:2]))
  }))))
  colnames(tmp) = c("internal","A","B","dist")
  
  tmp$a = TREE$tip.label[tmp$A]; tmp$b = TREE$tip.label[tmp$B]
  tmp
}
#####

Hope it helps

Cheers

Pete


=======================================
Peter F Cowman, Ph.D.
Senior Research Fellow in Ecosystem Dynamics
ARC Discovery Fellow (DECRA)

ARC Centre of Excellence for Coral Reef Studies <https://www.coralcoe.org.au/>
James Cook University, Townsville, QLD, 4811, Australia

Office: +61 7 4781 3194 | Rm 128 Bld DB019
Email: peter.cow...@jcu.edu.au <mailto:peter.cow...@jcu.edu.au>
Twitter: @pete_cowman
ORCID ID: orcid.org/0000-0001-5977-5327 <http://orcid.org/0000-0001-5977-5327>

> On 10 Jan 2020, at 07:36, Max Shpak <shpak....@gmail.com> wrote:
> 
> If I have an object of class "phylo" in the ape, with attributes edge,
> Nnode, node.label, and tip.label, is there some straightforward way for me
> to extract a list of sister taxon pairs (whether the sister taxa are two
> edges or an edge and a node)?
> 
> I wrote to E. Paradis (the author of ape), and he said that he didn't know
> of a direct way to do this, but it may be possible through some
> manipulation of the mrca functions.
> 
> Does anybody on this board have any suggestions for how to go about this?
> 
> Thank you, Max Shpak
> 
> -- 
> =======================
> Max Shpak, Ph.D.
> Center for Systems and Synthetic Biology
> University of Texas at Austin
> Austin, TX 78712
> 
>       [[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