Saturday, December 17, 2011

Comment on update to plotSimmap()

I just wanted to make a quick comment on my recent update to the phytools function plotSimmap() which now allows it to plot both "phylo" and "multiPhylo" SIMMAP style trees. As a preliminary, an object of class "multiPhylo" is just a list of "phylo" objects with class(...)<-"multiPhylo". To see that this is true, just make a list of "phylo" objects, set the class to "multiPhylo", and then apply any function that accepts "multiPhylo" objects to this list.

For instance, if we want to simulate 100 pure-birth trees we might want to use the geiger function birthdeath.tree. The only problem is it only simulates one tree at a time. To generate a set of (say) 100 pure-birth trees with 100 taxa, we can just do the following:

> require(geiger)
> trees<-replicate(100,birthdeath.tree(b=1,d=0,taxa.stop=100),simplify=F)
> "multiPhylo"->class(trees)
> plot.multiPhylo(trees) # we can also use the generic plot(...) here

Now, the way that plot.multiPhylo is simply by looping over each element in the "multiPhylo" object and calling the function plot.phylo(), after first setting the graphical parameter par(ask=TRUE) which will force R to ask the user for input (click or ENTER) before drawing each new tree. We can easily replicate this in plotSimmap() as follows:

      for(i in 1:length(tree)) plotSimmap(tree[[i]],...)
   } else { ...

If we do this, it works great! So for instance (after getting the new version of phytools here):

> require(geiger); require (phytools)
> tree<-rescaleTree(birthdeath.tree(b=1,d=0,taxa.stop=100),1)
> mtree<-sim.history(tree,Q=matrix(c(-1,1,1,-1),2,2))
> mtrees<-make.simmap(tree,mtree$states,nsim=10)
> plotSimmap(mtrees)
Waiting to confirm page change...

Very cool.


  1. hello to all of you. it is my first time that I have a comment on your post but I really wanted to say how great you are working. I am so happy for this post from your website.
    Seo Service Provider In India

  2. Nutra Trials defines personal characteristics of different health products including skincare, weight loss, muscle and male enhancement. The study presented here is briefly described for reader convenience and to deliver them assurance with health standards. The best possible answers are given here regarding the selection of an ideal supplement or cream or serum that possibly remains to be safe for health and do not cause any side effects.

  3. Fantastic article to go through, I would appreciate the writer's mind ( ) and the skills he has presented this great article to get its look in better style. Fmovies

  4. Hi, I am Pallavi thank you for this informative post.Fantastic article to go through,I would appreciate the writer's

  5. We are Get health tips to lead healthy life information and medical updates on healthy life ideas. latest health news, articles and studies on all health. NutraT line

  6. Whereas, when you choose to cure your sexual health problems by all natural means it said to have no side effects of it. Also, Alpha Rise Male Enhancement is clinically proven and recommended by the doctors. The customers that have used this natural male enhancement supplement before are quite happy with its results and now have a better sexual life.

  7. Alpha Rise Male Enhancement is a 100% natural remedy to your problem and it will boost your sex life through the roof. To inform and educate you more about this product here is an in-depth review of this natural male enhancement supplement. Alpha Rise Male Enhancement

  8. Top Wellness Guru is a health-related website, with continuous use of this you will find important tips to make your health even better, we have created this site with the help of some other helpers, all those helpful and especially faithful. We are able to share the solution of the health problems with the help of them, which is faced by you on daily basis; this site is completely honestly created. And the articles shared by us are also written in the correct manner, no errors have been found in these articles from us, and every knowledge shared with you have been prepared our special health experts.

  9. Supplement Doctor - Search/Buy Health & Wellness Products! Your post is so informative and i got everything from it. Thanks again!

  10. Supplement Doctor - Search/Buy Health & Wellness Products! Your post is so informative and i got everything from it. Thanks again!


  11. True Light Keto ia an extremely innovative weight loss supplement that’s formulated with high-quality ketone ingredients.
    When you have this supplement, your system raises digestion speed, the metabolism rate, burns off fat in the pace that is rapid.
    True Light Keto

  12. Hello, I am Prithvika malhotra thank you for this informative post. That is a great job. Wish you more success.Thank you so much and for you all the best. Takes Down

  13. TimesForHealth is Online Health & Wellness Program! I came on the your post and i got so information here. Thanks for the valuable post.