Hi all,

Not sure if this is a bug, but I noticed weird behavior when loading a tree with APE and then converting to phylo4 to do descendants() -- not all the tips are produced.

Example:


library(ape)
library(phylobase)

trstr = "((((((((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);"

# Load tree
tr = read.tree(file="", text=trstr)
tr

# Convert to phylo4
tr4 = as(tr, "phylo4")

# Find root (node 20)
rootnode = nodeId(tr4, type="root")
rootnode

# Only 3 tips! (there should be 19)
tipnames = descendants(phy=tr4, node=rootnode, type="tips")
tipnames




The problem is here in descendants():

if (phy@order == "preorder") {
        edge <- phy@edge
}
else {
        edge <- reorder(phy, order = "preorder")@edge
}
ancestor <- as.integer(edge[, 1])
descendant <- as.integer(edge[, 2])
isDes <- .Call("descendants", node, ancestor, descendant)

...it works if I force phy@order to "cladewise" or "unknown"


library(ape)
library(phylobase)

trstr = "((((((((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);"

# Load tree
tr = read.tree(file="", text=trstr)
tr

# Convert to phylo4
tr4 = as(tr, "phylo4")

# Looks like by default the tree is called "preorder"
tr4@order

# It works if I do this:
tr4@order = "cladewise"

# Find root (node 20)
rootnode = nodeId(tr4, type="root")
rootnode

# Now this works
tipnames = descendants(phy=tr4, node=rootnode, type="tips")
tipnames




# This also works:

# Load tree
tr = read.tree(file="", text=trstr)
tr

# Convert to phylo4
tr4 = as(tr, "phylo4")

# Looks like by default the tree is called "preorder"
tr4@order

# It works if I do this:
tr4@order = "unknown"

# Find root (node 20)
rootnode = nodeId(tr4, type="root")
rootnode

# Now this works
tipnames = descendants(phy=tr4, node=rootnode, type="tips")
tipnames


...so at least there's a workaround...

Cheers,
Nick



--
====================================================
Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher

Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Graduate Student Instructor, IB200B
Principles of Phylogenetics: Ecology and Evolution
http://ib.berkeley.edu/courses/ib200b/
http://phylo.wikidot.com/


Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html
Lab phone: 510-643-6299
Dept. fax: 510-643-6264

Cell phone: 510-301-0179
Email: [email protected]

Mailing address:
Department of Integrative Biology
1005 Valley Life Sciences Building #3140
Berkeley, CA 94720-3140

-----------------------------------------------------
"[W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together."

Isaac Asimov (1989). "The Relativity of Wrong." The Skeptical Inquirer, 14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm

_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/

Reply via email to