[Phylobase-devl] readNexus output

François Michonneau francois.michonneau at gmail.com
Fri Apr 23 15:01:13 CEST 2010


Hi David,

  Thanks for your input. 

  I didn't have  the data-only case in mind when I reworked readNexus,
but I think readNexus should be able to handle such files.

  Feel free to commit your patch, and you can upload a toy nexus file in
pkg/inst/nexusfiles/

  If you want, I'll be glad to update the unitTest file once you have
done that.

  Cheers,
  -- François

On Fri, 2010-04-23 at 12:20 +0100, Orme, David wrote:
> Hi everyone,
> 
> Just been very belatedly looking at phylobase again with a view to changing my package to using phylo4d as the basic data structure. 
> 
> I think there's a problem with the way readNexus works in the handling of which of TREE and DATA blocks are actually present in the nexus file:
> 
> 1) There is an actual bug, in that the code assumes a TREE block is present - so DATA only nexus files cause read.nexustreestring() to throw an error with the default type argument of  'all'. 
> 
> 2) More widely though, nexus files hold at least one of data, tree and other blocks. Obviously, mostly we want to get phylo4d objects from files with both TREE and DATA and phylo4 objects from files with just TREE, but my feeling is that the type argument should be more explicitly tied to what is in the file - because nexus files are commonly used simply to hold data too. My first instinct is that the function should give back phylo4, phylo4d, a dataframe or NULL depending on this scheme:
> 
> 	## scheme of what you get back, given what you asked
> 	## for and whether data or tree blocks are actually in
> 	## the file
> 	##                         
> 	## in nexus file        type argument       
> 	## data     tree        all   data  trees
> 	## TRUE     FALSE       df    df    NULL
> 	## FALSE    TRUE        p4    NULL  p4
> 	## TRUE     TRUE        p4d   df    p4
> 	## FALSE    FALSE       NULL  NULL  NULL
> 
> I think this would handle a wider range of nexus files more smoothly - and also means the function can be used to test for tree or data presence. I've implemented this but - since I've been so out  of the loop, I wanted to see if this seems like a sensible change and whether it causes problems elsewhere before committing. Let me know either way - if it gets committed I'll update the Rd file too. Would this also need a unit test with some toy nexus files?
> 
> Cheers and thanks for all the hard work,
> David
> _______________________________________________
> Phylobase-devl mailing list
> Phylobase-devl at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20100423/e87990c4/attachment.pgp 


More information about the Phylobase-devl mailing list