Re: [R-sig-phylo] Simulating a phylogeny with outgroup on long branch

2011-10-13 Thread Liam J. Revell

Hi Scott.

I'm not sure why you want to do this, but based on your description it 
sounds like you could just generate two separate trees and then paste 
them together across a deep basal split.


The following is an example of doing this, although I'm sure you could 
also come up with your own using different functions than those that I 
have chosen:


require(phytools); require(geiger) # load packages
ntaxa1-50; ntaxa2-50 # number of taxa in each clade
total.height-10 # total tree height (may need to be adjusted)
# simulate subtree 1
tr1-birthdeath.tree(b=1,d=0,taxa.stop=ntaxa1)
tr1$tip.label-1:ntaxa1; tr1$root.edge-0
# simulate subtree 2
tr2-birthdeath.tree(b=1,d=0,taxa.stop=ntaxa2)
tr2$tip.label-1:ntaxa2+ntaxa1; tr2$root.edge-0
# compute tree heights, so that the whole thing can be ultrametric
height1-max(nodeHeights(tr1))
height2-max(nodeHeights(tr2))
# create the basal split
tr3-list(Nnode=1,edge=matrix(c(3,1,3,2),2,2,byrow=T),edge.length=c(total.height-height1,total.height-height2),tip.label=c(tr1,tr2))
class(tr3)-phylo
# attach the two subtrees one by one
tr3$tip.label[tr3$tip.label==tr1]-NA
tr3-paste.tree(tr3,tr1)
tr3$tip.label[tr3$tip.label==tr2]-NA
tr3-paste.tree(tr3,tr2)
# plot the full tree
plot(tr3)

I hope this is kind of what you are going for.

All the best, Liam

--
Liam J. Revell
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://phytools.blogspot.com

On 10/13/2011 5:32 PM, Scott Chamberlain wrote:

Hello,

I want to simulate two types of phylogenies: one normally done with, for
example, rcoal in ape; and the second type with an outgroup on a long
branch.  The first is easy with rcoal.

I'm not sure how to make the second kind of tree.  An example of this second
kind is a tree with say all animals, and then an outgroup with all plant
species, so that you have many animal species that have relatively short
branches among them, and then the distance between plants and animals is
relatively long.

Is there a way to simulate this second kind of tree with any available R
functions?

Thanks!
Scott Chamberlain
Rice 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


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


Re: [R-sig-phylo] Simulating a phylogeny with outgroup on long branch

2011-10-13 Thread Scott Chamberlain
Hi Liam, Great, thanks so much.

The point of this exercise is to figure out to what extent certain tree
characteristics are influencing phylogenetic meta-analysis output.  We think
that deep basal splits in these types of trees (e.g., mostly animals with a
plant species as an outgroup) may be greatly decreasing model fit in
phylogenetic meta-analysis relative to trees without these deep basal
splits. It may relate to how even the groups are, e.g, in your code below if
one clade has 2 species and the other 48, that may have a different impact
on phylogenetic meta-analysis fit than if each clade had 25 species.

Scott

On Thu, Oct 13, 2011 at 5:14 PM, Liam J. Revell liam.rev...@umb.edu wrote:

 Hi Scott.

 I'm not sure why you want to do this, but based on your description it
 sounds like you could just generate two separate trees and then paste them
 together across a deep basal split.

 The following is an example of doing this, although I'm sure you could also
 come up with your own using different functions than those that I have
 chosen:

 require(phytools); require(geiger) # load packages
 ntaxa1-50; ntaxa2-50 # number of taxa in each clade
 total.height-10 # total tree height (may need to be adjusted)
 # simulate subtree 1
 tr1-birthdeath.tree(b=1,d=0,**taxa.stop=ntaxa1)
 tr1$tip.label-1:ntaxa1; tr1$root.edge-0
 # simulate subtree 2
 tr2-birthdeath.tree(b=1,d=0,**taxa.stop=ntaxa2)
 tr2$tip.label-1:ntaxa2+**ntaxa1; tr2$root.edge-0
 # compute tree heights, so that the whole thing can be ultrametric
 height1-max(nodeHeights(tr1))
 height2-max(nodeHeights(tr2))
 # create the basal split
 tr3-list(Nnode=1,edge=matrix(**c(3,1,3,2),2,2,byrow=T),edge.**
 length=c(total.height-height1,**total.height-height2),tip.**
 label=c(tr1,tr2))
 class(tr3)-phylo
 # attach the two subtrees one by one
 tr3$tip.label[tr3$tip.label==**tr1]-NA
 tr3-paste.tree(tr3,tr1)
 tr3$tip.label[tr3$tip.label==**tr2]-NA
 tr3-paste.tree(tr3,tr2)
 # plot the full tree
 plot(tr3)

 I hope this is kind of what you are going for.

 All the best, Liam

 --
 Liam J. Revell
 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 10/13/2011 5:32 PM, Scott Chamberlain wrote:

 Hello,

 I want to simulate two types of phylogenies: one normally done with, for
 example, rcoal in ape; and the second type with an outgroup on a long
 branch.  The first is easy with rcoal.

 I'm not sure how to make the second kind of tree.  An example of this
 second
 kind is a tree with say all animals, and then an outgroup with all plant
 species, so that you have many animal species that have relatively short
 branches among them, and then the distance between plants and animals is
 relatively long.

 Is there a way to simulate this second kind of tree with any available R
 functions?

 Thanks!
 Scott Chamberlain
 Rice University

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



[[alternative HTML version deleted]]

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