[Phylobase-commits] r584 - pkg/R

Ben Bolker bolker at ufl.edu
Tue Aug 25 04:23:01 CEST 2009


  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-commits/attachments/20090824/51758828/attachment.pgp 


More information about the Phylobase-commits mailing list