[Phylobase-devl] Fwd: [R-sig-phylo] Tree manipulations (pruning and grafting)
Hilmar Lapp
hlapp at duke.edu
Tue Oct 6 18:32:16 CEST 2009
I've actually been waiting for the phylo4 API to stabilize so that I
can add conversion to Rmesquite. Rmesquite does already convert from
Mesquite to phylo.
-hilmar
On Oct 6, 2009, at 12:21 PM, Brian O'Meara wrote:
> A question that might of interest for phylobase (i.e., should we try
> to advocate for mesquite<->phylo4 interactions rather than just
> mesquite<->phylo, will this change the priority of any features in
> phylobase, etc.).
>
> Brian
>
> Begin forwarded message:
>
>> From: Wayne Maddison <wmaddisn at interchange.ubc.ca>
>> Date: October 6, 2009 12:10:42 PM EDT
>> To: Sam Brown <s_d_j_brown at hotmail.com>
>> Cc: r-sig-phylo at r-project.org
>> Subject: Re: [R-sig-phylo] Tree manipulations (pruning and grafting)
>>
>> 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 at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>
>>
>> --
>> --------------------------------------------------------
>> Wayne Maddison
>> Professor and Canada Research Chair
>> Depts. of Zoology and Botany and
>> Biodiversity Research Centre
>> & Director
>> Beaty Biodiversity Museum
>> 6270 University Boulevard
>> University of British Columbia
>> Vancouver, BC V6T 1Z4 Canada
>>
>> email: wmaddisn at interchange.ubc.ca FAX: +1 604 822-2416
>>
>> Mesquite: http://mesquiteproject.org
>> MacClade: http://macclade.org
>> Salticidae: http://salticidae.org
>> Tree of Life: http://tolweb.org
>> Beaty Biodiversity Museum: http://beatymuseum.ubc.ca
>> Home page: http://salticidae.org/wpm/home.html
>>
>> _______________________________________________
>> R-sig-phylo mailing list
>> R-sig-phylo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
> _______________________________________________
> 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
--
===========================================================
: Hilmar Lapp -:- Durham, NC -:- hlapp at duke dot edu :
===========================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20091006/2e57a4ae/attachment-0001.htm
More information about the Phylobase-devl
mailing list