HI Kevin,

  If I understand correctly what you're trying to do, you'll first need to
collapse some of your tips to create clades, a proportion of which will
have the trait. You'll then be able to use this new tree to generate the
data.frame needed by the functions you mentioned in your original post.

  Depending on what you're trying to do, you may not want to lose this
phylogenetic information. Maybe a different approach, such as using BiSSE
in the diversitree package might be more appropriate?

  Cheers,
  -- François

On Thu, Oct 23, 2014 at 10:27 AM, Arbuckle, Kevin <
[email protected]> wrote:

>  Hi François,
>
> Thank you kindly for your offer of help. The code below will simulate a
> phylogeny ("tree") and a dataframe ("trait") with one binary trait for 100
> species. The format is representative of the data I am using for my
> analyses so should serve as a test case. Hopefully this helps, let me know
> if there's any other information I can provide.
>
>
>
> library(ape)
> library(phytools)
> tree<-rtree(100)
> tran<-matrix(c(-1,1,1,-1),2,2)
> rownames(tran)<-c("0","1")
> colnames(tran)<-c("0","1")
> phy<-sim.history(tree,tran)
> trait<-data.frame(sp=tree$tip.label,bt=getStates(phy,type="tips"))
> rownames(trait)<-tree$tip.label
>
> Cheers,
>
>
>
> Kev
>
>
>  ------------------------------
> *From:* François Michonneau [[email protected]]
> *Sent:* 23 October 2014 14:54
> *To:* Arbuckle, Kevin
> *Subject:* Re: [R-sig-phylo] Extracting sister groups
>
>
>  Hi Kevin,
>
>    We should be able to help you but it would be much easier if you
> provided us with a small data set that illustrate the format of your
> current dataset. How is your trait currently stored? and how is it
> associated with the tips in your tree?
>
>    Cheers,
>    -- François
>
> On Thu, Oct 23, 2014 at 6:23 AM, Arbuckle, Kevin <
> [email protected]> wrote:
>
>> Hi everyone,
>>
>>
>>
>> I am attempting to run sister group analyses as one way to look at the
>> effect of a binary trait on diversification. Two of the functions from ape
>> that I'm looking at are diversity.contrast.test and richness.yule.test, but
>> both have the same limitation. They require the data to be input as a
>> dataframe of two columns, one with the number of species in clades that
>> have the trait of interest, and the other with the number of species in the
>> respective sister clades that don't have the trait. The issue is that I am
>> working with a very large tree, and so extracting and entering such
>> information by hand is not really feasible.
>>
>>
>>
>> I am therefore looking for a function which extracts all sister clades
>> that differ in the presence vs absence of the trait, and ideally is capable
>> of generating a dataframe of the appropriate format for the above functions
>> automatically. It seems that a function to do this should exist already,
>> but as I can't seem to find anything I would appreciate some help
>> (hopefully someone will know of such a function that already exists).
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Kevin Arbuckle
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> 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]/
>>
>
>

        [[alternative HTML version deleted]]

_______________________________________________
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