[Picante-commits] r124 - branches/gsoc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 27 16:04:37 CEST 2008


Author: mrhelmus
Date: 2008-06-27 16:04:37 +0200 (Fri, 27 Jun 2008)
New Revision: 124

Modified:
   branches/gsoc/R/phylodiversity.R
Log:
Fixed Bug: Assign BL of 1 if no BL is given in a phylo tree object

Modified: branches/gsoc/R/phylodiversity.R
===================================================================
--- branches/gsoc/R/phylodiversity.R	2008-06-27 05:46:18 UTC (rev 123)
+++ branches/gsoc/R/phylodiversity.R	2008-06-27 14:04:37 UTC (rev 124)
@@ -131,6 +131,7 @@
 
   if(is(tree)[1]=="phylo")
   {
+    if(is.null(tree$edge.length)){tree<-compute.brlen(tree, 1)}  #If phylo has no given branch lengths
     tree<-prune.sample(samp,tree)
     # Make sure that the species line up
     samp<-samp[,tree$tip.label]
@@ -260,6 +261,7 @@
   
   if(is(tree)[1]=="phylo")
   {
+    if(is.null(tree$edge.length)){tree<-compute.brlen(tree, 1)}  #If phylo has no given branch lengths
     tree<-prune.sample(samp,tree) 
     # Make sure that the species line up
     samp<-samp[,tree$tip.label]
@@ -319,6 +321,7 @@
 
   if(is(tree)[1]=="phylo")
   {
+    if(is.null(tree$edge.length)){tree<-compute.brlen(tree, 1)}  #If phylo has no given branch lengths
     tree<-prune.sample(samp,tree)
     # Make sure that the species line up
     samp<-samp[,tree$tip.label]
@@ -374,6 +377,7 @@
   }  
   if(is(tree)[1]=="phylo")
   {
+    if(is.null(tree$edge.length)){tree<-compute.brlen(tree, 1)}  #If phylo has no given branch lengths
     tree<-prune.sample(samp,tree)
     # Make sure that the species line up
     samp<-samp[,tree$tip.label]
@@ -436,6 +440,7 @@
 
 pd<-function(samp,tree){
   
+  if(is.null(tree$edge.length)){tree<-compute.brlen(tree, 1)}  #If phylo has no given branch lengths
   # Make sure that the species line up
   tree<-prune.sample(samp,tree)
   samp<-samp[,tree$tip.label]



More information about the Picante-commits mailing list