Hi Wayne,
I just found myself hand editing constraint trees the other day. I
would be happy to have this functionality and suspect I would use it
regularly.
Cheers,
Jake
Wayne Maddison wrote:
This and the previous query about importing a phylogeny into R raises
a question that was embedded in an email several months ago: How
useful would it be for you to be able to call a function like newphylo
<- mesquite.editTree(phylo) that would put a tree from R into a
Mesquite window, you would edit it there, hit a button, and then the
modified tree would be returned as the function result in R?
We might be able to offer a test version of that soon, if there is
interest.
Wayne
At 12:37 PM +1300 6.10.2009, Sam Brown wrote:
Dear all
To prepare for SH tests between optimised and "expected" trees, I've
been attempting to do tree manipulations in R. Pruning is easy with
the dual functions of extract.clade() and drop.tip(), however
grafting the clade into a different place using bind.tree() is
proving much more difficult.
What seems to be happening is that during the tree binding process,
some tips are becoming nodes and vice versa.
Any help is much appreciated!
Thank you!
Sam
Some code:
library(ape)
data(bird.orders)
phy<-bird.orders
node<-43 #Node with taxa of interest
(Columbiformes:Passeriformes)
site<-21 #Where above group is
expected to be (In a clade with Struthioniformes:Anseriformes)
j<-allDesc(node) #See function definition below
grp<-extract.clade(phy, node)
rest<-drop.tip(phy, j)
tr<-bind.tree(rest, grp, where=site)
plot(tr) #Should get an error:
"Error in plot.phylo(tr) : NA/NaN/Inf in foreign function call (arg 6)"
write.tree(tr) #Can see Upupiformes as
sister to NODE11, among others.
where:
allDesc<-function(node){
N<-length(phy$tip.label)
index<-which(phy$edge[,1]==node)
desc<-phy$edge[index,2]
taxa<-desc[desc<=N]
desc<-desc[desc>N]
while(length(desc)>=1){
ind<-NULL
for(i in 1:length(desc)){
ind<-c(ind,which(phy$edge[,1]==desc[i]))
}
desc<-phy$edge[ind,2]
taxa<-c(taxa,desc[desc<=N])
desc<-desc[desc>N]
}
taxa
}
_________________________________________________________________
Facebook.
k-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-nz:SI_SB_2:092010
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
--
Jake Esselstyn
Biodiversity Research Center
Department of Ecology & Evolutionary Biology
University of Kansas
1345 Jayhawk Blvd.
Lawrence, KS 66045
phone: 785-864-4066
fax: 785-864-5335
http://www.people.ku.edu/~esselsty
_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo