<div dir="ltr"><div><div><br></div>Hi all,<br><br></div><div>  I just submitted to R-forge a patch to fix this issue. It came from a recent change to ape. If you notice something weird or have any question, let us know.<br>

<br></div><div>  Cheers,<br></div><div>  -- François<br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 27, 2013 at 5:10 PM, Ben Bolker <span dir="ltr"><<a href="mailto:bbolker@gmail.com" target="_blank">bbolker@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
  Thanks for the heads-up.  I or one of the other phylobase developers<br>
will try to take a look ...<br>
<br>
  cheers<br>
    Ben Bolker<br>
<div><div class="h5"><br>
<br>
On 13-04-26 06:50 PM, Nick Matzke wrote:<br>
> Hi all,<br>
><br>
> Not sure if this is a bug, but I noticed weird behavior when<br>
> loading a tree with APE and then converting to phylo4 to do<br>
> descendants() -- not all the tips are produced.<br>
><br>
> Example:<br>
><br>
><br>
> library(ape) library(phylobase)<br>
><br>
> trstr =<br>
> "((((((((P_hawaiiensis_WaikamoiL1:0.9656850499,P_mauiensis_Eke:0.9656850499):0.7086257935,(P_fauriei2:1.230218511,P_hathewayi_1:1.230218511):0.4440923324):0.1767115552,(P_kaduana_PuuKukuiAS:1.851022399,P_mauiensis_PepeAS:1.851022399):0.0008897862802):0.3347375986,P_kaduana_HawaiiLoa:2.185759997):0.302349378,(P_greenwelliae07:1.131363255,P_greenwelliae907:1.131363255):1.35674612):1.689170274,((((P_mariniana_MauiNui:1.994011054,P_hawaiiensis_Makaopuhi:1.994011054):0.7328279804,P_mariniana_Oahu:2.726839034):0.2574151709,P_mariniana_Kokee2:2.984254205):0.4601084855,P_wawraeDL7428:3.444362691):0.732916959):0.7345185743,(P_grandiflora_Kal2:2.479300491,P_hobdyi_Kuia:2.479300491):2.432497733):0.2873119899,((P_hexandra_K1:2.363984189,P_hexandra_M:2.363984189):0.4630447802,P_hexandra_Oahu:2.826939991):2.372081244);"<br>


><br>
><br>
><br>
> # Load tree tr = read.tree(file="", text=trstr) tr<br>
><br>
> # Convert to phylo4 tr4 = as(tr, "phylo4")<br>
><br>
> # Find root (node 20) rootnode = nodeId(tr4, type="root") rootnode<br>
><br>
> # Only 3 tips! (there should be 19) tipnames = descendants(phy=tr4,<br>
> node=rootnode, type="tips") tipnames<br>
><br>
><br>
><br>
><br>
> The problem is here in descendants():<br>
><br>
> if (phy@order == "preorder") { edge <- phy@edge } else { edge <-<br>
> reorder(phy, order = "preorder")@edge } ancestor <-<br>
> as.integer(edge[, 1]) descendant <- as.integer(edge[, 2]) isDes <-<br>
> .Call("descendants", node, ancestor, descendant)<br>
><br>
> ...it works if I force phy@order to "cladewise" or "unknown"<br>
><br>
><br>
> library(ape) library(phylobase)<br>
><br>
> trstr =<br>
> "((((((((P_hawaiiensis_WaikamoiL1:0.9656850499,P_mauiensis_Eke:0.9656850499):0.7086257935,(P_fauriei2:1.230218511,P_hathewayi_1:1.230218511):0.4440923324):0.1767115552,(P_kaduana_PuuKukuiAS:1.851022399,P_mauiensis_PepeAS:1.851022399):0.0008897862802):0.3347375986,P_kaduana_HawaiiLoa:2.185759997):0.302349378,(P_greenwelliae07:1.131363255,P_greenwelliae907:1.131363255):1.35674612):1.689170274,((((P_mariniana_MauiNui:1.994011054,P_hawaiiensis_Makaopuhi:1.994011054):0.7328279804,P_mariniana_Oahu:2.726839034):0.2574151709,P_mariniana_Kokee2:2.984254205):0.4601084855,P_wawraeDL7428:3.444362691):0.732916959):0.7345185743,(P_grandiflora_Kal2:2.479300491,P_hobdyi_Kuia:2.479300491):2.432497733):0.2873119899,((P_hexandra_K1:2.363984189,P_hexandra_M:2.363984189):0.4630447802,P_hexandra_Oahu:2.826939991):2.372081244);"<br>


><br>
><br>
><br>
> # Load tree tr = read.tree(file="", text=trstr) tr<br>
><br>
> # Convert to phylo4 tr4 = as(tr, "phylo4")<br>
><br>
> # Looks like by default the tree is called "preorder" tr4@order<br>
><br>
> # It works if I do this: tr4@order = "cladewise"<br>
><br>
> # Find root (node 20) rootnode = nodeId(tr4, type="root") rootnode<br>
><br>
> # Now this works tipnames = descendants(phy=tr4, node=rootnode,<br>
> type="tips") tipnames<br>
><br>
><br>
><br>
><br>
> # This also works:<br>
><br>
> # Load tree tr = read.tree(file="", text=trstr) tr<br>
><br>
> # Convert to phylo4 tr4 = as(tr, "phylo4")<br>
><br>
> # Looks like by default the tree is called "preorder" tr4@order<br>
><br>
> # It works if I do this: tr4@order = "unknown"<br>
><br>
> # Find root (node 20) rootnode = nodeId(tr4, type="root") rootnode<br>
><br>
> # Now this works tipnames = descendants(phy=tr4, node=rootnode,<br>
> type="tips") tipnames<br>
><br>
><br>
> ...so at least there's a workaround...<br>
><br>
> Cheers, Nick<br>
><br>
><br>
><br>
</div></div>ph<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
Comment: Using GnuPG with undefined - <a href="http://www.enigmail.net/" target="_blank">http://www.enigmail.net/</a><br>
<br>
iQEcBAEBAgAGBQJRfD6oAAoJEOCV5YRblxUHwC0IAKFRYnR1RoYqxVf2GFQxc03R<br>
HQAo5/N01tWBsTKZ7c4KdIk9HIhANu3F9v0trtwutUNXs/V7v3oa8QZFI9CC4Plk<br>
2HIAox/rgwrX7yhlmKPf21KTMiiM5zHxtlCF63tkGCnwi/v/xf8IbFyqTd9ZH9NG<br>
0xoeQTrhOLp8Lu0ARVWc1Ie01ujV+RXgJvv9RTJEhDSqeRKsYb46qhh4eFHjd4bE<br>
qB/9P40Z4RUhV2gMXRkaPDWGWzXUhLrl1qvdPgSJ/5yQgns+g0I007452SALv3yV<br>
mQ13Nkd/9Ze0mGUC2KjxlBiVmyDWWQQvKbJlA9eTHxZv3DPZgyg5YwiBDgf3Tsk=<br>
=L06Y<br>
-----END PGP SIGNATURE-----<br>
_______________________________________________<br>
Phylobase-devl mailing list<br>
<a href="mailto:Phylobase-devl@lists.r-forge.r-project.org">Phylobase-devl@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl</a><br>
</blockquote></div><br></div>