Re: [R-sig-phylo] Add terminal branches to tree

2017-06-28 Thread David Bapst
No problem. Glad someone other than me could make use of my function!

Cheers,
-Dave

On Tue, Jun 27, 2017 at 4:42 AM, Sergio Ferreira Cardoso
 wrote:
> Hi Dave,
>
> Thanks a lot. It was exactly this I was trying to do.
> Thank you all for your advice.
>
> Cheers,
> Sérgio.
>
> - Mensagem original -
>> De: "David Bapst" 
>> Para: "Sergio Ferreira Cardoso" 
>> Cc: "Eliot Miller" , "r-sig-phylo" 
>> 
>> Enviadas: Terça-feira, 20 De Junho de 2017 0:11:02
>> Assunto: Re: [R-sig-phylo] Add terminal branches to tree
>
>> Hi Sergio,
>>
>> Sorry for being late to the party, but maybe expandTaxonTree in
>> paleotree does what you're looking for? I wrote it for turning trees
>> of genera into trees of species, with the resulting generic polytomies
>> collapsed or not (in case we know that the genera is paraphyletic).
>>
>> Cheers,
>> -Dave
>>
>> On Mon, Jun 19, 2017 at 9:36 AM, Sergio Ferreira Cardoso
>>  wrote:
>>> Thank you all for your suggestions. I guess the more direct way is to use
>>> Megaptera. I tried and it worked (I added Man cra1, Man cra2, etc.).
>>> However, I wanted it to create a new node that would basically include all
>>> these taxa. I sthere any way to merge all the added species in a new node?
>>> Thank you all, once again.
>>>
>>> 
>>>
>>> De: "Eliot Miller" 
>>> Para: "Christoph Heibl" 
>>> Cc: "Liam Revell" , "r-sig-phylo"
>>> , "Sergio Ferreira Cardoso"
>>> 
>>> Enviadas: Segunda-feira, 19 De Junho de 2017 14:40:15
>>> Assunto: Re: [R-sig-phylo] Add terminal branches to tree
>>>
>>> Just to add to the slew of other good options, I have a small package up on
>>> GitHub (https://github.com/eliotmiller/addTaxa/tree/master/R) that is
>>> basically a big loop around Liam's bind.tip. There are examples included
>>> with the package. The main function you'd be interested in is
>>> randomlyAddTaxa(). It works fairly well last I checked, but there are some
>>> limitations and the package is in need of an overhaul. The main limitation
>>> is when two clades (A and B) are sister to one another and you intend to add
>>> a taxon into the clade (A+B); it's currently impossible to generate the
>>> topology (C,(A,B)), even though that's monophyletic and shouldn't be
>>> prohibited. I aim to fix this at some point within the next month or two if
>>> anyone's interested.
>>> Eliot
>>>
>>> On Mon, Jun 19, 2017 at 8:30 AM, Christoph Heibl 
>>> wrote:

 Another possibility would be addSingleTip() and addTips() from the
 megaptera package (https://github.com/heibl/megaptera). The latter function
 can add any number of tips; the loop that Liam mentioned is already build
 into that function. This is potentially very slow, but for your tree size 
 it
 should work. Note that you have to specify the 'tax' argument; it allows 
 you
 to add tips also to internal nodes of higher rank than genera. In your case
 where you have only genera you can create 'tax' easily like this:

 ## 'species' is a vector of tip labels that you want to add
 ## will work only if your tip labels are of the form
 "Genus_epithet-or-any-other-string"
 library(megaptera)
 tax <- data.frame(genus = strip.spec(species),
 species = species,
 stringsAsFactors = FALSE)



 Christoph Heibl
 An der Weiherleite 3
 86633 Neuburg an der Donau
 08431-53 96 534 (Festnetz)
 0176-23 86 57 92 (Mobil)
 christoph.he...@gmx.net


 Am 19.06.2017 um 14:06 schrieb Liam Revell:

 > The function add.species.to.genus may do what you want. It adds a single
 > species to the group defined by the MRCA of members of a genus, 
 > according to
 > multiple criteria (randomly and so on). It can add only one species at a
 > time, so you will need to write a for loop or something to iterate over 
 > the
 > species that you‚d like to add.
 >
 > --
 > Liam J. Revell, Associate Professor of Biology
 > University of Massachusetts Boston
 > web: http://faculty.umb.edu/liam.revell
 > email: liam.rev...@umb.edu
 >
 > Sent from my Windows 10 phone
 >
 > From: Sergio Ferreira
 > Cardoso
 > Sent: Monday, June 19, 2017 6:58 AM
 > To: r-sig-phylo
 > Subject: [R-sig-phylo] Add terminal branches to tree
 >
 > Hello all,
 >
 > I'm using the package 'phytools' to try to add terminal branches to a
 > tree (attached). I tried to use add.everywhere function to add terminal
 > branches. I have 

[R-sig-phylo] Is my subset of species random?

2017-06-28 Thread Ondřej Mikula
Dear list,

I am now browsing through a large phylogeny trying to select species for
multilocus analysis. I am, of course, constrained at least by availability
of material and thus I cannot pick a purely random subset of species.
Therefore, I would like to know how much is any particular selection
non-random (with implications for subsequent analyses). In an ideal random
sampling the picks are completely independent - if you know that some
species was sampled it tells you nothing about sampling of any other
species. In fact I need to know whether branches retained after sampling
are on the original phylogeny predictably separated by the dropped
branches. If sampling is random (or close to complete), there is no
regularity in distribution of dropped branches. Otherwise, some pattern is
(at least theoretically) recognizable - e.g. in diversified sampling they
tend to be closer to tips, in other cases they may be preferably in some
clades.

Does any measure of this kind exist (ideally implemented in R)?

Best wishes,
Ondrej Mikula


-- 
Ondřej Mikula

Institute of Animal Physiology and Genetics
Academy of Sciences of the Czech Republic
Veveri 97, 60200 Brno, Czech Republic

Institute of Vertebrate Biology
Academy of Sciences of the Czech Republic
Studenec 122, 67502 Konesin, Czech Republic

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/