[Phylobase-devl] I am on hopefully the right track in manipulating "trees" using R.

Ben Bolker bolker at zoo.ufl.edu
Mon Apr 7 05:35:43 CEST 2008


   If you're willing to set a maximum number of mutations, and
live with some inefficiencies, you can do this by setting up
a matrix with times, with NAs filling in beyond the number of
mutations -- so if there were 0, 1, 2, 0 mutations (say) along
4 edges the mutation-time matrix would be

NA,  NA, NA, NA
t11, NA, NA, NA
t21, t22, NA, NA
NA, NA, NA, NA

   I can't send you code for how to do this at this moment ...

   Ben Bolker





Sang Chul Choi wrote:
> Hi,
> 
> I cannot keep up with last few correspondences since I am learning  
> phylobase package. This may be due to my lack of knowledge of "using  
> R." Since it is okay for me to know how many mutation events  
> "happened" on branches, I could use one more column to phylo4 class  
> e.g., n.mutations. The following code would generate a genealogy with  
> one mutation event for each branch.
> 
>  > c1 <- rcoal(10)
>  > c2 <- as(c1, "phylo4")
>  > c2d <- phylo4d(c2, node.data=data.frame(n.mutations=c(0,rep(1,8))))
> 
> Here is my question. Is it possible or legitimate to have a phylo4d  
> object that has mutation events with their event time points? Then,  
> each node has an array of mutation event time not a single value that  
> is the case for number of mutations.
> 
> Thank you,
> 
> Sang Chul
> 
> On Apr 6, 2008, at 9:08 PM, Peter Cowan wrote:
> 
>> Ben,
>>
>> I think we could take that approach, but it *could* require changes to
>> the plotting commands, and a variety of other commands.
>>
>> To meet it seems a bit overboard to update the tree structure when
>> mapping data onto a tree.  For example, if I want to generate a null
>> model of a character then I have to store a 1000 copies of a tree,
>> instead of some lists that correspond to a tree. Also, adding data to
>> a list is going to be far less expensive than rewriting the whole edge
>> matrix every time the state changes (does that example make sense?).
>>
>> Are you thinking that we want to support singleton nodes anyway, and
>> then we can use them to store edge data?  That would potentially make
>> plotting them easier.
>>
>> I don't recall if there was a consensus view before, which is probably
>> why nothing has happened.
>>
>> Peter
>>
>> On Apr 6, 2008, at 6:50 PM, Ben Bolker wrote:
>>> OK, now I'm confused.  Why can't we extend the branches
>>> with singleton nodes?  Or is it that this is feasible but
>>> would require to much hacking around (i.e., if we write
>>> good tools we can still do it this way)?
>>>
>>> After deciding to throw out the edge data structure, I'd like to
>>> see a good reason to put it back in ...
>>>
>>> but maybe I'm just confused about what's needed.
>>>
>>> cheers
>>>   Ben
>>>
>>>
>>> Peter Cowan wrote:
>>>> Hi Sang Chul,
>>>> Thanks for taking a look at phylobase!  As you can see we are
>>>> still  early on in the development (version 0.3) and greatly
>>>> appreciate any  feedback we can get from users, so please keep the
>>>> questions and bug  reports coming.
>>>> As I'm sure you've seen by now there are two basic data classes
>>>> for  single trees, the phylo4 class and the phylo4d class.  This
>>>> later one  is the probably interested in using.
>>>> As of now there is no good mechanism for adding variable length
>>>> (such  as stochastic mutations) data to edges.  This was discussed
>>>> on the  list a couple of weeks ago, but nothing is implemented yet.
>>>> One way to do this would to extend the phylo4d class and include a
>>>> slot for edge data that takes a list.  This approached was used
>>>> with  ape style trees in the evolve.trait() function in the picante
>>>> package  [^1](also alpha stage).
>>>> Peter
>>>> [1] <http://r-forge.r-project.org/projects/picante/>
>>>> On Apr 6, 2008, at 5:16 PM, Sang Chul Choi wrote:
>>>>> Hi,
>>>>>
>>>>> I think that mutation events on branch may be tree information
>>>>> additional to branch length. I am wondering whether adding mutation
>>>>> events directly to phylo4 class or indirectly subclassing phylo4
>>>>> class
>>>>> is better. Since I have been skimming through phylobase code for a
>>>>> day, I am not sure which way is good one for me. I will appreciate
>>>>> any
>>>>> input.
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Sang Chul
>>>>>
>>>>> On Apr 6, 2008, at 7:30 PM, Sang Chul Choi wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I think that I might have to change or extend phylo4 class if I
>>>>>> want
>>>>>> to have mutation events on branches. Otherwise, I may have to have
>>>>>> other variables out side the phylo4 class, which does not seem
>>>>>> to  be a
>>>>>> good idea.
>>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>> Sang Chul
>>>>>>
>>>>>> On Apr 6, 2008, at 7:04 PM, Sang Chul Choi wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> After asking a few people, I think that I am on the right place
>>>>>>> to  do
>>>>>>> manipulation of "trees" using R.
>>>>>>>
>>>>>>> I am trying to do a simple coalescent simulation: 1. generates a
>>>>>>> genealogy, and 2. puts mutations on each branch. I am wondering
>>>>>>> if I
>>>>>>> could use phylobase package to do the second one.
>>>>>>>
>>>>>>> Thank you,
>>>>>>>
>>>>>>> Sang Chul
>>>>>>>
>>>>>>> P.S. The vignette (0.3r104) has typos at page 5.
>>>>>>>> NodeLabels(g1)   ---> > nodeLabels(g1)
>>>>>>>> EdgeLabels(g1)   ---> > edgeLabels(g1)
>>>>>>> _______________________________________________
>>>>>>> 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
>>>> _______________________________________________
>>>> 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
> 
> _______________________________________________
> 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.r-forge.r-project.org/pipermail/phylobase-devl/attachments/20080406/81c6d1a0/attachment.pgp 


More information about the Phylobase-devl mailing list