[Phylobase-commits] r584 - pkg/R

Peter D. Cowan pdc at berkeley.edu
Tue Aug 25 05:08:22 CEST 2009


I think I replied only to Ben previously, perhaps reorder at default, and an option to maintain order?

Peter

On Mon, Aug 24, 2009 at 08:01:40PM -0700, Steve Kembel wrote:
> I'm also in favour of not automatically reordering trees on phylo <>
> phylo4 conversion. There are cases where I would really like to
> maintain tree order (because I have some information about nodes that
> is in Newick string order).
> 
> I am not sure of a better solution. Am I correct that unknown ordering
> is only really a potential problem on export *to* ape where it could
> break some functions (i.e. plotting)? Could we warn in this case but
> not on phylo -> phylo4 conversion?
> 
> -Steve
> On Mon, Aug 24, 2009 at 7:23 PM, Ben Bolker<bolker at ufl.edu> wrote:
> >  hmmm.
> >  you may be right, but this will presumably break round-trip capability
> > -- i.e. if we import a tree with unknown ordering and automatically
> > re-order it when we export, the round trip will have changed it.
> > Am I being too obsessive about this?  Is there a better solution?
> >
> >  Ben
> >
> > Peter D. Cowan wrote:
> >> 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
> >
> >
> > --
> > Ben Bolker
> > Associate professor, Biology Dep't, Univ. of Florida
> > bolker at ufl.edu / www.zoology.ufl.edu/bolker
> > GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc
> >
> >
> > _______________________________________________
> > 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
> >
> >
> 
> 
> 
> -- 
> ______________________________________________
> Dr. Steven Kembel - steve.kembel at gmail.com
> http://www.phylodiversity.net/skembel/


More information about the Phylobase-commits mailing list