[Phylobase-commits] r584 - pkg/R

Peter D. Cowan pdc at berkeley.edu
Tue Aug 25 03:22:16 CEST 2009


On Tue, Aug 25, 2009 at 02:58:59AM +0200, noreply at r-forge.r-project.org wrote:
> Author: bbolker
> Date: 2009-08-25 02:58:59 +0200 (Tue, 25 Aug 2009)
> New Revision: 584
> 
> Modified:
>    pkg/R/setAs-Methods.R
> Log:
>   added error if unknown ordering imported from ape
>   added warning if unknown ordering exported to ape
> 

How about reordering unknown trees before exporting them?  This seems likely to flood users with warnings.

peter

> Modified: pkg/R/setAs-Methods.R
> ===================================================================
> --- pkg/R/setAs-Methods.R	2009-08-25 00:51:06 UTC (rev 583)
> +++ pkg/R/setAs-Methods.R	2009-08-25 00:58:59 UTC (rev 584)
> @@ -26,11 +26,11 @@
>          }
>      }
>      oldorder <- attr(from,"order")
> -    neworder <- if (is.null(oldorder)) { "unknown" } else {
> -      switch(oldorder,
> -             pruningwise="pruningwise",
> -             cladewise="preorder")
> -    }
> +    neworder <- if (is.null(oldorder)) { "unknown" } else 
> +    if (!oldorder %in% phylo4_orderings) {
> +      stop("unknown ordering '",oldorder,"' in ape object")
> +    } else if (oldorder=="cladewise") "preorder"
> +    else oldorder
>      attr(from,"order") <- NULL
>      newobj <- phylo4(from$edge, from$edge.length, from$tip.label,
>                       node.label = from$node.label,
> @@ -113,9 +113,10 @@
>                                     preorder  = 'cladewise',
>                                     unknown = 'unknown',
>                                     pruningwise = 'pruningwise')
> -    } else {
> -      ## warning ??
> -    }
> +      } else {
> +        ## warning ??
> +        warning("trees with unknown order may be unsafe in ape")
> +      }
>      if (length(y$edge.length) == 0)
>          y$edge.length <- NULL
>      if (length(y$node.label) == 0)
> 
> _______________________________________________
> Phylobase-commits mailing list
> Phylobase-commits at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-commits


More information about the Phylobase-commits mailing list