Re: [R-sig-phylo] Simulating tree from a given tree

2018-07-30 Thread Eduardo Ascarrunz
Maybe you could use a birth-death model. You can estimate the speciation
rate and extinction rate from your original tree, and use those parameters
to run simulations of trees for 5 My with the pbtree function from
phytools. Run as many simulations as you have living tips in your original
tree, and bind each simulated tree to one of the living tips. It shouldn't
be too difficult to write a wrapper function to perform all those steps.

Cheers,

Eduardo

2018-07-29 11:06 GMT+02:00 :

> Hi list:
>
> Is there any function to simulate a tree from a given tree?. For example,
> I have a tree encompassing 10 Million years and I would like to simulate
> the "growth" of such tree for the following 5 MY.
>
> Thanks in advance
>
> Miguel Verdú
>
> --
> 
> Centro de Investigaciones sobre Desertificacion
> (CSIC-UV-GV)
> Carretera Moncada - Náquera, Km. 4,5
> Apartado Oficial
> 46113 Moncada (Valencia)
> Spain
> Tel +34 96 3424204
> Fax +34 96 3424160
> www.uv.es/verducam
>
> ___
> 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-ph...@r-project.org/
>

[[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/


Re: [R-sig-phylo] selecting a set of incongruent trees from a posterior distribution

2017-07-26 Thread Eduardo Ascarrunz
Hi Jesse,

Do you want to select the trees that are most incongruent with some sort of
average of the tree distribution? The `treespace`and `phytools` packages
have functions that compute average trees with different metrics, and they
also allow you to measure the distance between each tree and the average
tree.

Cheers,

Eduardo

2017-07-25 22:16 GMT+02:00 Jesse Delia :

> Dear list,
>
> Does anyone know of a function or script that could select a set of the
> most incongruent trees from a list of trees? Maybe I missed a post, but
> haven't found anything.
>
> I running mixed models, which take a lot of computational space on my lap
> top. In effort to account for phylogenetic uncertainty, without having to
> run 100s of chains, I figured maybe i could run models across a (much)
> shorter list that accounts for more diversity in tree shape observed within
> the posterior distribution. Not sure if this makes sense, and/or is
> extremely complicated?
>
> Thanks for you time!
>
> Jesse
>
> [[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-ph...@r-project.org/
>

[[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/


Re: [R-sig-phylo] converting TNT(?) tree to newick tree

2017-02-27 Thread Eduardo Ascarrunz
Hi Chris,

The tntfile2R and tntfile2newick functions from Nick Matzke's package TNTR
should help you with that. Here's the link:

http://phylo.wdfiles.com/local--files/tntr/tnt_R_utils_v1.R

You can also export files in Newick format directly from TNT using the
command EXPORT with the flag "=".

Cheers,

Eduardo

2017-02-27 19:10 GMT+01:00 Chris Law :

> Hi all,
>
> We have a set of consensus trees in an unknown file format (attached)
> originally from the TNT software. We wish to convert it to a newick format
> so that they can be imported into R. Does anybody know the what would be
> the best way to do so? Alternatively, is there an R function that can read
> a file format from TNT?
>
> Thanks!
> Chris
>
> ___
> 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-ph...@r-project.org/
>

[[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/


Re: [R-sig-phylo] error when using function read.GenBank in ape

2016-11-12 Thread Eduardo Ascarrunz
Hi Emmanuel,

Right! Sorry I misspoke.

Best,

Eduardo

2016-11-11 23:32 GMT+01:00 Emmanuel Paradis <emmanuel.para...@ird.fr>:

> Hi Eduardo & Ting-Wen,
>
> ape 4.0 is not yet released. The available version is 3.5-0.10 and, you
> are right Eduardo, it fixes this issue. The instructions to install this
> new version of ape is here:
>
> http://ape-package.ird.fr/ape_installation.html#versions
>
> The issue (not really a bug, strictly speaking) is because NCBI servers do
> not accept HTTP requests anymore like many web services. The new version of
> read.GenBank() uses HTTPS in place of HTTP. The relevant information from
> NCBI can be found there:
>
> https://www.ncbi.nlm.nih.gov/news/06-10-2016-ncbi-https/
>
> Best,
>
> Emmanuel
>
>
> Le 11/11/2016 à 09:22, Eduardo Ascarrunz a écrit :
>
>> Hi Ting-Wen.
>>
>> Are you using the latest version of ape? Emmanuel released ape v.4.0
>> yesterday with a bug fix for that function.
>>
>> Best,
>>
>> Eduardo
>>
>> 2016-11-11 0:35 GMT+01:00 Chen, Ting-Wen <
>> ting-wen.c...@biologie.uni-goettingen.de>:
>>
>> Dear all,
>>>
>>> recently I got an error when downloading sequences in R using MacOS 10.12
>>> (but no problem when using WIndows 7). I was using the function
>>> read.GenBank in package ape and pretty sure my laptop was connecting to
>>> the
>>> internet. Following is how the error looks like:
>>>
>>> R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
>>> Copyright (C) 2016 The R Foundation for Statistical Computing
>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>> ...
>>> [R.app GUI 1.68 (7288) x86_64-apple-darwin13.4.0]
>>>
>>> library(ape)
>>>> read.GenBank("U15717")
>>>>
>>> Error in file(file, "r") : cannot open the connection
>>>
>>> Does anybody know how to solve this problem?
>>>
>>> All the best
>>> Ting-Wen
>>>
>>> --
>>> Ting-Wen Chen
>>> J.F. Blumenbach Institute of Zoology and Anthropology
>>> Georg August University Goettingen
>>> Berliner Str. 28
>>> D-37073 Goettingen, Germany
>>> Tel: +49-55139-10943
>>>
>>> ___
>>> 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-ph...@r-project.org/
>>>
>>>
>> [[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-ph...@r-project.org/
>>
>>
>>
>>
>>
>>

[[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/

Re: [R-sig-phylo] error when using function read.GenBank in ape

2016-11-11 Thread Eduardo Ascarrunz
Hi Ting-Wen.

Are you using the latest version of ape? Emmanuel released ape v.4.0
yesterday with a bug fix for that function.

Best,

Eduardo

2016-11-11 0:35 GMT+01:00 Chen, Ting-Wen <
ting-wen.c...@biologie.uni-goettingen.de>:

> Dear all,
>
> recently I got an error when downloading sequences in R using MacOS 10.12
> (but no problem when using WIndows 7). I was using the function
> read.GenBank in package ape and pretty sure my laptop was connecting to the
> internet. Following is how the error looks like:
>
> R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> ...
> [R.app GUI 1.68 (7288) x86_64-apple-darwin13.4.0]
>
> > library(ape)
> > read.GenBank("U15717")
> Error in file(file, "r") : cannot open the connection
>
> Does anybody know how to solve this problem?
>
> All the best
> Ting-Wen
>
> --
> Ting-Wen Chen
> J.F. Blumenbach Institute of Zoology and Anthropology
> Georg August University Goettingen
> Berliner Str. 28
> D-37073 Goettingen, Germany
> Tel: +49-55139-10943
>
> ___
> 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-ph...@r-project.org/
>

[[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/


Re: [R-sig-phylo] Disagreement between "length" of data and "length" of phylogeny

2016-01-05 Thread Eduardo Ascarrunz
Hi,

It's not clear from your code how are you using `fixdata` in your
analysis. Is `SWSPeak` a vector you are extracting from the `fixdata`
table? Could it be that you still have the old (w/o species removed)
`SWSPeak` in memory from a previous session?

Best,

E.

On 5 January 2016 at 07:50, Michael Pauers  wrote:
> Dear List,
>
> I am having some difficulties calculating phylogenetic independent
> contrasts on a multiPhylo object using APE.  When I attempt to calculate a
> contrast, the following error message appears (preceded by the code I am
> using to calculate the PIC):
>
>> fixtree <- read.nexus("fixeddatatrees.nex")
>> fixdata <- read.table("newfix.txt")
>> PIC.SWSPeak <- mapply(pic, list(SWSPeak), fixtree)
> Error in (function (x, phy, scaled = TRUE, var.contrasts = FALSE,
> rescaled.tree = FALSE)  :
>   length of phenotypic and of phylogenetic data do not match
>
> I know that both the phylogenies ("fixeddatatrees.nex") and the phenotypic
> dataset ("newfix.txt") contain the same number of taxa (21).  However, when
> I ask APE for the length of the data, it tells me the following:
>
>> length(SWSPeak)
> [1] 39
>
> This is somewhat meaningful, as this particular analysis is restricted to a
> subset of my original group, which contained 39 species.  From my original
> phyloeny, then, I pruned the unnecessary 18 species, and also deleted them
> from the phenotypic dataset.  Could it be the case that there is some sort
> of artefact in either of these files that is left over from their "parent"
> files?  I should note that my analyses, also PICs, on the original tree and
> data went perfectly and without any error message.
>
> Thanks in advance for whatever help you can offer.
>
> Best,
>
> Mike Pauers
>
> [[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/

___
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/


Re: [R-sig-phylo] pairwise comparisons of 100s of gene tree topologies

2014-04-14 Thread Eduardo Ascarrunz
Hello Chris,

I know there's a program that was specifically developed for calculating
large pairwise Robinson-Foulds distances matrices efficiently. I'll be able
to send you the reference this evening (Paris time).

All the best,

E.
On 14 Apr 2014 14:44, Chris Buddenhagen cbuddenha...@gmail.com wrote:

 Thanks. That answers part of the question. It isn't the comparison of any
 single pair of topologies that is troubling, but a quick means of doing all
 the possible comparisons between 100s of loci.

 Chris Buddenhagen
 Florida State University
 cbuddenha...@gmail.com


 On Mon, Apr 14, 2014 at 8:27 AM, Mattia Prosperi ahn...@gmail.com wrote:

  You may use dist.topo from the ape package, there are a couple of tree
  distance functions implemented.
 
 
  2014-04-14 13:13 GMT+01:00 Chris Buddenhagen cbuddenha...@gmail.com:
 
  I would like to make pairwise comparisons of topological similarity
  between
  all possible combinations of 518 gene trees.
 
  The expected output would be a matrix of topological distances for each
  gene tree to each other tree.
 
  Any suggestions?
 
  Also as an aside, is there a way to mechanize the estimation of 100s of
  gene trees from alignments, such that the best model models of
 nucleotide
  substitution is chosen objectively and then a tree is generated using
  likelihood or Bayesian methods. Ideally I give the program the folder of
  100s of alignments and tell it to go and wait for the gene trees.
 
  Best
  Chris Buddenhagen
  Florida State University
  cbuddenha...@gmail.com
 
  [[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/
 
 
 

 [[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/


[[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/


Re: [R-sig-phylo] Sampling from all bifurcating and multifurcating trees

2014-01-02 Thread Eduardo Ascarrunz
 alloreg2-c(1:48)
 dim(alloreg2)-c(nrow=24,ncol=2)
 for (i in 2:25) {
+
alloreg2[i-1,]-c(summary((lm(datasetln[,i]~datasetln[,1])))$r.squared,anova((lm(datasetln[,i]~datasetln[,1])))$Pr(F)[1])
+ }
 alloreg2
  [,1] [,2]
 [1,] 2.480627e-01 4.692452e-06
 [2,] 1.583641e-02 2.787183e-01
 [3,] 1.332119e-04 9.211746e-01
 [4,] 6.954092e-04 8.211058e-01
 [5,] 2.449341e-02 1.769866e-01
 [6,] 3.009983e-02 1.339250e-01
 [7,] 4.976260e-02 5.274791e-02
 [8,] 1.146599e-02 3.572196e-01
 [9,] 7.008708e-03 4.721380e-01
[10,] 4.136657e-05 9.560258e-01
[11,] 1.142588e-02 3.580668e-01
[12,] 4.828307e-02 5.649079e-02
[13,] 5.808281e-03 5.128909e-01
[14,] 1.738474e-02 2.562216e-01
[15,] 2.213051e-03 6.865520e-01
[16,] 5.806873e-03 5.129422e-01
[17,] 1.488570e-02 2.937490e-01
[18,] 9.790540e-05 9.323945e-01
[19,] 1.908742e-06 9.905496e-01
[20,] 4.690994e-03 5.566098e-01
[21,] 4.412028e-02 6.857869e-02
[22,] 1.726578e-02 2.578693e-01
[23,] 5.252169e-03 5.338479e-01
[24,] 6.538443e-05 9.447305e-01

 alloreg3-c(1:48)
 dim(alloreg3)-c(nrow=24,ncol=2)
 for (i in 2:25) {
+
alloreg3[i-1,]-c(summary((lm(jmpthomas[,i]~jmpthomas[,1])))$r.squared,anova((lm(jmpthomas[,i]~jmpthomas[,1])))$Pr(F)[1])
+ }
 alloreg3
  [,1] [,2]
 [1,] 2.460384e-01 5.202590e-06
 [2,] 1.468026e-02 2.971299e-01
 [3,] 2.672849e-05 9.646462e-01
 [4,] 5.245843e-04 8.443070e-01
 [5,] 2.637115e-02 1.610467e-01
 [6,] 2.856208e-02 1.44e-01
 [7,] 4.933823e-02 5.379439e-02
 [8,] 1.032559e-02 3.824230e-01
 [9,] 6.695454e-03 4.822442e-01
[10,] 1.157413e-04 9.265097e-01
[11,] 7.565447e-03 4.549905e-01
[12,] 4.681145e-02 6.048797e-02
[13,] 6.447833e-03 4.904846e-01
[14,] 1.841212e-02 2.425089e-01
[15,] 2.238318e-03 6.848614e-01
[16,] 5.937185e-03 5.082370e-01
[17,] 1.569970e-02 2.808195e-01
[18,] 7.665993e-05 9.401625e-01
[19,] 3.878511e-05 9.574187e-01
[20,] 5.438222e-03 5.266709e-01
[21,] 4.386239e-02 6.941131e-02
[22,] 1.732606e-02 2.570328e-01
[23,] 5.629804e-03 5.194573e-01
[24,] 1.634704e-04 9.127115e-01

 alloreg2 - alloreg3
   [,1]  [,2]
 [1,]  2.024287e-03 -5.101376e-07
 [2,]  1.156150e-03 -1.841153e-02
 [3,]  1.064834e-04 -4.347159e-02
 [4,]  1.708249e-04 -2.320121e-02
 [5,] -1.877741e-03  1.593991e-02
 [6,]  1.537743e-03 -1.051939e-02
 [7,]  4.243667e-04 -1.046481e-03
 [8,]  1.140399e-03 -2.520332e-02
 [9,]  3.132538e-04 -1.010615e-02
[10,] -7.437470e-05  2.951609e-02
[11,]  3.860437e-03 -9.692373e-02
[12,]  1.471617e-03 -3.997175e-03
[13,] -6.395521e-04  2.240629e-02
[14,] -1.027378e-03  1.371264e-02
[15,] -2.526664e-05  1.690596e-03
[16,] -1.303119e-04  4.705225e-03
[17,] -8.139970e-04  1.292944e-02
[18,]  2.124547e-05 -7.767984e-03
[19,] -3.687637e-05  3.313087e-02
[20,] -7.472282e-04  2.993891e-02
[21,]  2.578922e-04 -8.326114e-04
[22,] -6.027869e-05  8.365089e-04
[23,] -3.776347e-04  1.439056e-02
[24,] -9.808602e-05  3.201904e-02


On 25 December 2013 18:21, Eduardo Ascarrunz ear...@gmail.com wrote:

 Thanks Joe!


 On 24 December 2013 17:31, Joe Felsenstein felse...@uw.edu wrote:

 Eduardo Ascarrunz ear...@gmail.com wrote:

  Also, I figured out I could work with unrooted trees. I suspect the
 procedure would be similar to your rooted method, wouldn't it?

 There is a 1-1 correspondence between n-species rooted tree topologies
 and (n+1)-species unrooted tree topologies (this is discussed in
 Chapter 3 of my book).  So you can simply generate a bifurcating
 rooted tree, or a multifurcating rooted tree, of  n-1  tips, and then
 unroot it, making the previous root now be species  n.   Then you get
 a randomly sampled unrooted tree.

 This works for tree topologies but not, I think, for labeled histories.

 Joe
 
 Joe Felsenstein j...@gs.washington.edu
  Department of Genome Sciences and Department of Biology,
  University of Washington, Box 355065, Seattle, WA 98195-5065 USA




[[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/


Re: [R-sig-phylo] Sampling from all bifurcating and multifurcating trees

2014-01-02 Thread Eduardo Ascarrunz
Please ignore my last message, it was sent by mistake. Sorry!

Happy new year to all.

E.


On 2 January 2014 11:41, Eduardo Ascarrunz ear...@gmail.com wrote:

  alloreg2-c(1:48)
  dim(alloreg2)-c(nrow=24,ncol=2)
  for (i in 2:25) {
 +
 alloreg2[i-1,]-c(summary((lm(datasetln[,i]~datasetln[,1])))$r.squared,anova((lm(datasetln[,i]~datasetln[,1])))$Pr(F)[1])
 + }
  alloreg2
   [,1] [,2]
  [1,] 2.480627e-01 4.692452e-06
  [2,] 1.583641e-02 2.787183e-01
  [3,] 1.332119e-04 9.211746e-01
  [4,] 6.954092e-04 8.211058e-01
  [5,] 2.449341e-02 1.769866e-01
  [6,] 3.009983e-02 1.339250e-01
  [7,] 4.976260e-02 5.274791e-02
  [8,] 1.146599e-02 3.572196e-01
  [9,] 7.008708e-03 4.721380e-01
 [10,] 4.136657e-05 9.560258e-01
 [11,] 1.142588e-02 3.580668e-01
 [12,] 4.828307e-02 5.649079e-02
 [13,] 5.808281e-03 5.128909e-01
 [14,] 1.738474e-02 2.562216e-01
 [15,] 2.213051e-03 6.865520e-01
 [16,] 5.806873e-03 5.129422e-01
 [17,] 1.488570e-02 2.937490e-01
 [18,] 9.790540e-05 9.323945e-01
 [19,] 1.908742e-06 9.905496e-01
 [20,] 4.690994e-03 5.566098e-01
 [21,] 4.412028e-02 6.857869e-02
 [22,] 1.726578e-02 2.578693e-01
 [23,] 5.252169e-03 5.338479e-01
 [24,] 6.538443e-05 9.447305e-01
 
  alloreg3-c(1:48)
  dim(alloreg3)-c(nrow=24,ncol=2)
  for (i in 2:25) {
 +
 alloreg3[i-1,]-c(summary((lm(jmpthomas[,i]~jmpthomas[,1])))$r.squared,anova((lm(jmpthomas[,i]~jmpthomas[,1])))$Pr(F)[1])
 + }
  alloreg3
   [,1] [,2]
  [1,] 2.460384e-01 5.202590e-06
  [2,] 1.468026e-02 2.971299e-01
  [3,] 2.672849e-05 9.646462e-01
  [4,] 5.245843e-04 8.443070e-01
  [5,] 2.637115e-02 1.610467e-01
  [6,] 2.856208e-02 1.44e-01
  [7,] 4.933823e-02 5.379439e-02
  [8,] 1.032559e-02 3.824230e-01
  [9,] 6.695454e-03 4.822442e-01
 [10,] 1.157413e-04 9.265097e-01
 [11,] 7.565447e-03 4.549905e-01
 [12,] 4.681145e-02 6.048797e-02
 [13,] 6.447833e-03 4.904846e-01
 [14,] 1.841212e-02 2.425089e-01
 [15,] 2.238318e-03 6.848614e-01
 [16,] 5.937185e-03 5.082370e-01
 [17,] 1.569970e-02 2.808195e-01
 [18,] 7.665993e-05 9.401625e-01
 [19,] 3.878511e-05 9.574187e-01
 [20,] 5.438222e-03 5.266709e-01
 [21,] 4.386239e-02 6.941131e-02
 [22,] 1.732606e-02 2.570328e-01
 [23,] 5.629804e-03 5.194573e-01
 [24,] 1.634704e-04 9.127115e-01
 
  alloreg2 - alloreg3
[,1]  [,2]
  [1,]  2.024287e-03 -5.101376e-07
  [2,]  1.156150e-03 -1.841153e-02
  [3,]  1.064834e-04 -4.347159e-02
  [4,]  1.708249e-04 -2.320121e-02
  [5,] -1.877741e-03  1.593991e-02
  [6,]  1.537743e-03 -1.051939e-02
  [7,]  4.243667e-04 -1.046481e-03
  [8,]  1.140399e-03 -2.520332e-02
  [9,]  3.132538e-04 -1.010615e-02
 [10,] -7.437470e-05  2.951609e-02
 [11,]  3.860437e-03 -9.692373e-02
 [12,]  1.471617e-03 -3.997175e-03
 [13,] -6.395521e-04  2.240629e-02
 [14,] -1.027378e-03  1.371264e-02
 [15,] -2.526664e-05  1.690596e-03
 [16,] -1.303119e-04  4.705225e-03
 [17,] -8.139970e-04  1.292944e-02
 [18,]  2.124547e-05 -7.767984e-03
 [19,] -3.687637e-05  3.313087e-02
 [20,] -7.472282e-04  2.993891e-02
 [21,]  2.578922e-04 -8.326114e-04
 [22,] -6.027869e-05  8.365089e-04
 [23,] -3.776347e-04  1.439056e-02
 [24,] -9.808602e-05  3.201904e-02


 On 25 December 2013 18:21, Eduardo Ascarrunz ear...@gmail.com wrote:

 Thanks Joe!


 On 24 December 2013 17:31, Joe Felsenstein felse...@uw.edu wrote:

 Eduardo Ascarrunz ear...@gmail.com wrote:

  Also, I figured out I could work with unrooted trees. I suspect the
 procedure would be similar to your rooted method, wouldn't it?

 There is a 1-1 correspondence between n-species rooted tree topologies
 and (n+1)-species unrooted tree topologies (this is discussed in
 Chapter 3 of my book).  So you can simply generate a bifurcating
 rooted tree, or a multifurcating rooted tree, of  n-1  tips, and then
 unroot it, making the previous root now be species  n.   Then you get
 a randomly sampled unrooted tree.

 This works for tree topologies but not, I think, for labeled histories.

 Joe
 
 Joe Felsenstein j...@gs.washington.edu
  Department of Genome Sciences and Department of Biology,
  University of Washington, Box 355065, Seattle, WA 98195-5065 USA





[[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/


Re: [R-sig-phylo] Sampling from all bifurcating and multifurcating trees

2013-12-25 Thread Eduardo Ascarrunz
Thanks Joe!


On 24 December 2013 17:31, Joe Felsenstein felse...@uw.edu wrote:

 Eduardo Ascarrunz ear...@gmail.com wrote:

  Also, I figured out I could work with unrooted trees. I suspect the
 procedure would be similar to your rooted method, wouldn't it?

 There is a 1-1 correspondence between n-species rooted tree topologies
 and (n+1)-species unrooted tree topologies (this is discussed in
 Chapter 3 of my book).  So you can simply generate a bifurcating
 rooted tree, or a multifurcating rooted tree, of  n-1  tips, and then
 unroot it, making the previous root now be species  n.   Then you get
 a randomly sampled unrooted tree.

 This works for tree topologies but not, I think, for labeled histories.

 Joe
 
 Joe Felsenstein j...@gs.washington.edu
  Department of Genome Sciences and Department of Biology,
  University of Washington, Box 355065, Seattle, WA 98195-5065 USA


[[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/


[R-sig-phylo] Sampling from all bifurcating and multifurcating trees

2013-12-24 Thread Eduardo Ascarrunz
Thanks Joe!

I'll check out your refs. If I understand the code correctly, the rtree
function in ape seems to implement something very much like the method for
you described for bifucating trees. I'm guessing it could be adapted to
implement the multifurcate method as well. I'll have to develop my R skills
and give it a try.

Also, I figured out I could work with unrooted trees. I suspect the
procedure would be similar to your rooted method, wouldn't it?

Best,

E.

PS: I just realised I forgot to modify the subject on my message and
hijacked Samantha's thread. Sorry about that! I changed the subject now.


On 24 December 2013 08:11, Joe Felsenstein felse...@uw.edu wrote:

 One can sample from all possible rooted labeled histories by randomly
 bifurcating lineages, and at the end assigning the names randomly to the
 tips.  Note that a labeled history is not the same as a tree topology.

 One can sample randomly from all topologies of rooted bifurcating trees
 with labeled tips by adding the species one by one to a one-species tree,
 each time choosing to split them off from one of the branches.  The
 enumeration of all such trees is based on counting all possible ways of
 doing this, so choosing one such sequence should choose one of them at
 random. Jim Rohlf has a paper with an algorithm equivalent to this in (I
 think) Systematic Zoology but I cannot locate it at the moment.

 For rooted multifurcating trees a similar method could be used.  In my
 1978 paper in Systematic Zoology I showed that each such tree corresponded
 to way adding the species 1 to n in order, where at each step we choose
 equiprobably from among all branches and all interior nodes (so that if
 there are 13 branches and 6 interior nodes we split off one of these 19 at
 random). The enumeration algorithm for which this is based is also
 discussed in detail in Chapter 3 of my book.

 Joe


 On Mon, Dec 23, 2013 at 8:57 PM, Eduardo Ascarrunz ear...@gmail.comwrote:

 Hi Liam,

 Thank you! That looks clever. How does this method bias the sampling? I
 think it could be useful for test running my code anyway.

 Looking forward your findings, and all the best,

 E.
 On 24 Dec 2013 04:49, Liam J. Revell liam.rev...@umb.edu wrote:

  Hi Eduardo.
 
  You could try something like this:
 
  randomFurcTrees-function(n,N=1){
foo-function(n){
  t-di2multi(rtree(n,br=sample(c(0,1),
size=2*(n-2),replace=TRUE),rooted=FALSE))
  t$edge.length-NULL
  t
}
trees-if(N1) replicate(N,foo(12),simplify=FALSE) else foo(n)
if(N1) class(trees)-multiPhylo
return(trees)
  }
 
  What this does is it generates random bifurcating topologies (using
 rtree
  in ape) with branch lengths that can be 0 or 1; then it collapses all
 zero
  length branches to polytomies. This is (demonstrably) *not* the same as
  picking trees at random from the set of all bi- and multifurcating
  topologies. It's not immediately obvious how you could do that, but I'll
  think about it.
 
  All the best, Liam
 
  Liam J. Revell, Assistant Professor of Biology
  University of Massachusetts Boston
  web: http://faculty.umb.edu/liam.revell/
  email: liam.rev...@umb.edu
  blog: http://blog.phytools.org
 
  On 12/23/2013 10:15 PM, Eduardo Ascarrunz wrote:
 
  Hello everyone,
 
  Newbie here. I'm looking for a way to generate random trees of N tips,
  allowing multifurcations. My N would be 12, so it wouldn't be
 practical
  (nor possible) to work with all the possible trees (cf. allFurcTrees).
 I'd
  be happy with a set of 1000 trees, sampled equiprobably. I'd much
  appreciate any help.
 
  Best to all,
 
  E.
 
  [[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-ph...@r-project.org/
 
 

 [[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/




 --
 
 Joe Felsenstein j...@gs.washington.edu
  Department of Genome Sciences and Department of Biology,
  University of Washington, Box 355065, Seattle, WA 98195-5065 USA



[[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/


Re: [R-sig-phylo] R help generating a heat map

2013-12-23 Thread Eduardo Ascarrunz
Hello everyone,

Newbie here. I'm looking for a way to generate random trees of N tips,
allowing multifurcations. My N would be 12, so it wouldn't be practical
(nor possible) to work with all the possible trees (cf. allFurcTrees). I'd
be happy with a set of 1000 trees, sampled equiprobably. I'd much
appreciate any help.

Best to all,

E.

[[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/