[Adephylo-commits] r90 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 12 19:42:43 CET 2008


Author: jombart
Date: 2008-12-12 19:42:43 +0100 (Fri, 12 Dec 2008)
New Revision: 90

Modified:
   pkg/R/orthogram.R
Log:
Modification of orthogram so that the treePart orthobasis can be called.


Modified: pkg/R/orthogram.R
===================================================================
--- pkg/R/orthogram.R	2008-12-12 18:32:37 UTC (rev 89)
+++ pkg/R/orthogram.R	2008-12-12 18:42:43 UTC (rev 90)
@@ -1,4 +1,4 @@
-orthogram <- function (x, orthobas = NULL, prox = NULL,
+orthogram <- function (x, tre=NULL, orthobas = NULL, prox = NULL,
                         nrepet = 999, posinega = 0, tol = 1e-07, cdot = 1.5,
                         cfont.main = 1.5, lwd = 2, nclass,
                         high.scores = 0,alter=c("greater", "less", "two-sided")){
@@ -37,8 +37,15 @@
 
     ## retrieve the orthobasis from a proximity matrix
     if(is.null(orthobas)){
-        if(is.null(prox)) stop("Neither orthobas or prox are provided.")
-        orthobas <- orthobasis.phylo(prox=prox)
+        if(is.null(prox)) { # both orthobas and prox are not given -> default orthobasis
+            ## check that tre is provided and right
+            if(is.null(tre)) stop("tre, orthobasis or prox must be provided")
+            tre <- as(tre, "phylo4")
+            if (is.character(checkval <- check_phylo4(tre))) stop(checkval)
+            orthobas <- treePart(tre, result="orthobasis")
+        } else { # else orthobasis from the proxi matrix.
+            orthobas <- orthobasis.phylo(prox=prox)
+        }
     }
 
     if (!inherits(orthobas, "data.frame")) stop ("'orthobas' is not a data.frame")



More information about the Adephylo-commits mailing list