[adegenet-commits] r519 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 18 19:01:06 CET 2009


Author: jombart
Date: 2009-12-18 19:01:06 +0100 (Fri, 18 Dec 2009)
New Revision: 519

Modified:
   pkg/R/haploPop.R
Log:
???


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-12-18 13:01:35 UTC (rev 518)
+++ pkg/R/haploPop.R	2009-12-18 18:01:06 UTC (rev 519)
@@ -475,10 +475,11 @@
 ## plot.haploPop
 ###############
 plot.haploPop <- function(x, y=NULL, type="unrooted", size.limit=300, show.pop=TRUE,
-                          transp=TRUE, tip.cex=2, ...){
+                          transp=TRUE, tip.cex=2, method=c("nj", "bionj", "fastme.bal", "fastme.ols"), ...){
     ## CHECKS ##
     if(!require(ape)) stop("ape package is required")
     if(!inherits(x, "haploPop")) stop("x is not a haploPop object")
+    method <- match.arg(method)
 
     N <- sum(sapply(x$pop,length))
 
@@ -488,7 +489,12 @@
 
 
     ## PLOT TREE ##
-    tre <- root(nj(dist.haploPop(x)),"1")
+    f1 <- get(method)
+    if(method %in% c("nj","bionj")){
+        tre <- root(f1(dist.haploPop(x)),"1")
+    } else {
+        tre <- f1(dist.haploPop(x))
+     }
     plot(tre, type=type, ...)
     xy <- get("last_plot.phylo", envir = .PlotPhyloEnv)
 



More information about the adegenet-commits mailing list