[Phylobase-devl] NCL and Mr. Bayes output
Brian O'Meara
bcomeara at nescent.org
Mon Apr 14 17:07:30 CEST 2008
I don't think it would be too hard to have the NCL handle weights:
the old (pre-sourceforge) version of the NCL I used in my standalone
program had been modified by Rod Page to handle tree weights. The
person doing the most work now to develop NCL is actually Mark
Holder, not Paul Lewis, btw. We had a bit of discussion about tree
weights in the phylo4 spec during the hackathon, I think: they're
used in bootstrapped trees, and bayes topologies, but in most cases
(when dealing with likelihood bootstrap runs, where there is usually
(but not always) one tree per replicate, or the post-burnin bayes
trees (with branch lengths) rather than summarized topologies), all
trees have essentially the same weight, and so the consensus seemed
to be that tree weights should be left out.
The way we're using the NCL in phylobase is to pass the file name to
the C++ code, load the file, parse it (which entails storing the taxa
names in one block object, trees in another, data in a third), and in
the case of trees pass back basically what would be an exported
simple nexus tree file that is then read with a modified read.nexus,
and in the case of data is passed back as the internal R
representation for the data as a text string that is then eval'ed.
This partly, maybe entirely, explains why the NexusToPhylo4 is slower
than read.nexus: first it does all the tree parsing in C++, then it
does it again in R. I think it would be faster to do the eval method
for trees, too, but the NCL doesn't include the tree traversal
command that would make this fairly easy. There are almost surely
better ways to do this than the one we adopted, so don't be shy about
improving them/suggesting improvements.
Brian
On Apr 13, 2008, at 7:48 PM, Peter Cowan wrote:
> Ben,
>
> Yes, it now works. I would vote for being in contact with Paul Lewis,
> if the code bases drift from each other it will make things more
> difficult in the future.
>
> Also, NexusToPhylo4() is about half the speed of read.nexus() on a
> file with 250 trees, and worse with larger files.
>
> I've made one small enhancement (~10%) that I am testing.
>
> I can't really tell what's going on, but it looks like NCL returns a
> list, that is then parsed with regular expressions. What exactly does
> the NCL code do to the file?
>
> Peter
>
> On Apr 13, 2008, at 7:51 AM, Ben Bolker wrote:
>> It was fairly easy to hack nxstreesblock.cpp to silently
>> ignore &W / weights statements (just committed this to SVN);
>> we should give further thought to how to make it work right.
>> Should we add a "weights" element to the multi-tree object??
>>
>> Brian, do you have any sense of how hard it would
>> be too get the ncl code to pay attention to this?
>> Is it worth relaying this back to the ncl author?
>>
>> Ben
>>
>>
>> Johan Nylander wrote:
>>> Hi,
>>> On Sat, 2008-04-12 at 20:54 -0700, Peter Cowan wrote:
>>>> [&W 0.000133] is not a valid command comment in a TREE command
>>>> Line: 32
>>>> Column: 54
>>>>
>>>> Here is an example that causes this issue. Does anyone know if
>>>> this *is* improper Nexus? We might need a work around as it
>>>> seems likely that folks will want to read these files in (I do!).
>>>>
>>> Can't answer to 100% since the NEXUS format seems to change
>>> constantly
>>> (original NEXUS description from 1997, Maddison et al. Syst. Biol.
>>> does
>>> only mention &R for rooted and &U for unrooted trees), but the &W
>>> command is used in, e.g., current public version of PAUP to
>>> represent
>>> tree weight. The use of it might be slightly different, however,
>>> from
>>> the example given in the previous post. Note the use of fractions
>>> instead of decimal numbers for the weights, and the occurrence of a
>>> separate square-bracketed comment for the &W:
>>> (from the output of 'boot treefile=file')
>>> [Trees found in bootstrap replicate #10 (seed=1960800279)]
>>> tree B_10.1 = [&U] [&W 1/2] (1,(((2,4),(3,8)),(5,(6,7))));
>>> tree B_10.2 = [&U] [&W 1/2] (1,(((2,4),(5,(6,7))),(3,8)));
>>> To summarize:
>>> I believe you/we want to handle the weight command properly!
>>> Yours
>>> Johan Nylander
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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
More information about the Phylobase-devl
mailing list