Re: [R-sig-phylo] pgls_different_pacakges_different_results

2020-01-17 Thread Liam Revell
Dear Jeremie.

I agree with Julien. If your tree is non-ultrametric or if you use 
different fitting methods ("REML" vs. "ML") then you could obtain 
different results. The other circumstance in which you might have a 
different result is if your estimated value of lambda is outside the 
default bounds of caper (0,1).

Here's an example of how to use the argument 'weights' in nlme::gls to 
fit a PGLS model to a non-ultrametric tree:

data ## data frame with species names as row names
tree ## phylogeny
w <- diag(vcv(tree))[rownames(data)]
fit <- gls(y~x, data=data, correlation=corPagel(1,tree),
weights=varFixed(~w), method="ML")

phytools has one main function to do PGLS called 'phyl.resid'. I would 
generally recommend using caper or nlme combined with the method 
residuals, but the 'phyl.resid' works so it could be useful to 
doublecheck your results. In this case it would be:

phyl.resid(tree, as.matrix(data[,"x",drop=FALSE]),
as.matrix(data[,"y",drop=FALSE]), method="lambda")

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad:
https://www.umb.edu/academics/caps/international/biology_chile

On 1/17/2020 7:55 AM, Julien Clavel wrote:
> [EXTERNAL SENDER]
> 
> Hello J�r�mie,
> 
> 
> 
> Hard to say without a working example, but here are some hints:
> 
>*   Check if you�re using the same function to optimize (e.g. ML vs REML)
>*   Are you comparing the same tests? (t or F tests, type of sums of 
> squares)
>*   Are you using non-ultrametric trees? In �nlme� for instance, it�s a 
> correlation rather than a covariance structure that is optimized while other 
> approaches are dealing with the covariances. This may produce discrepancies 
> on non-ultrametric trees.
> 
> 
> 
> Cheers,
> 
> 
> 
> Julien
> 
> 
> 
> De : R-sig-phylo  de la part de J�r�mie 
> Bardin 
> Envoy� : vendredi 17 janvier 2020 11:22
> � : r-sig-phylo@r-project.org 
> Objet : [R-sig-phylo] pgls_different_pacakges_different_results
> 
> Hello everyone,
> I did pgls on real data and I tried the 3 common solutions : ape+nlme, caper 
> and phytools. I used BM as model and optimized lambda. I was surprized to get 
> different results especially on intercepts. Lambdas were different but close 
> , and results were still not the same by fixing the same lambda value.
> Then, I tried few simulations by varying the correlation strength between the 
> two variables and the source of the correlation (independent but both 
> simulated on the tree, linearly dependent, these two cases with varying 
> proportion...). The fewer the signal, the bigger the differences of the 
> optimized coefficients. However, sometimes pvalues of coefficients are very 
> small with one package and greater than .5 with another one.
> Have you ever seen such results ? I precise that I am using both three 
> solutions in their most simple form as can be founded on Liam's blog or 
> classical tutos.
> Cheers, J�r�mie.
> 
> 
> J�r�mie Bardin, Dr.
> 
>   CR2P - Centre de Recherche en Pal�ontologie - ParisSorbonne Universit� - 
> MNHN - CNRS
> Site Jussieu, Tour 46-56, 5�et.
> 4 place Jussieu, 75252 Paris Cedex 05
> tel. +331.44.27.51.77.
> jeremie.bar...@upmc.fr / jbar...@mnhn.fr / jeremiebar...@yahoo.fr
>  [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C243409cdb2334b05049408d79b3bdd93%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637148553747552573sdata=Uc%2F%2F1Fz58mJjhMzYnsO%2BN%2BBnjZX3gUtnszSoCosrcUc%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C243409cdb2334b05049408d79b3bdd93%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637148553747552573sdata=0%2F1axEbCuFUGyOkpXSQIUR%2BRv6oy37moptoURL3sbfM%3Dreserved=0
> 
>  [[alternative HTML version deleted]]
> 
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C243409cdb2334b05049408d79b3bdd93%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637148553747572562sdata=p9%2B3vN%2FXZGKWQu1HpM4ky7JNG%2Fths96FUy4qHbeGXmM%3Dreserved=0
> Searchable archive at 
> 

[R-sig-phylo] Postdoc in R phylogenetics

2019-12-17 Thread Liam Revell
Dear colleagues.

I am currently advertising a postdoc in my lab at the University of 
Massachusetts Boston & the deadline to apply has been extended until 
this Friday, Dec. 20th. The idea of this appointment is to work on 
applying phylogenetic analysis methods (phylogenetic inference or 
phylogenetic comparative methods) for the R environment. Please share 
with your colleagues & don't hesitate to contact me with any questions. 
More details as well as the link to apply can be found at the following 
URL: 
https://employmentopportunities.umb.edu/boston/en-us/job/503625/post-doctoral-research-fellow.

All the best, Liam

-- 
Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad:
https://www.umb.edu/academics/caps/international/biology_chile
___
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] Postdoc in computational phylogenetics

2019-11-25 Thread Liam Revell
Dear list members.

I'm currently advertising a postdoctoral position in my lab at the 
University of Massachusetts Boston. The postdoc has a maximum duration 
of 2 years & is to work on the NSF project entitled 'ABI Development: 
Computational infrastructure for phylogenetic analysis in the R 
environment.' I will consider proposals for a remote postdoc, although 
postdocs working remotely should plan to spend at least 1-2 months/year 
in Boston (specifics to be negotiated).

More details about the position as well as a link to apply can be seen 
on the UMass-Boston HR site here: 
http://employmentopportunities.umb.edu/boston/en-us/job/503625/post-doctoral-research-fellow.

Please don't hesitate to contact me with any questions or concerns about 
the position.

Very sincerely, Liam

-- 
Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile
___
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] A test for valid phylo object (ape package) for package developers

2019-11-05 Thread Liam Revell
Hi Elizabeth.

This does not do exactly what you want, but it is possible to use 
capture.output() to grab the printout of checkValidPhylo() and then 
grep() to see if it contains instances of "MODERATE" or "FATAL" errors.

The following simple function does that. It returns 0 if neither 
MODERATE nor FATAL errors are detected in the "phylo" object, 1 if at 
least one MODERATE error (but no FATAL errors) is detected, and 2 if any 
FATAL errors are detected:

chk.phylo<-function(x){
object<-capture.output(checkValidPhylo(x))
if(length(grep("FATAL",object))>0) return(2)
else if(length(grep("MODERATE",object))>0) return(1)
else return(0)
}

E.g.:

library(ape)

t1<-rtree(n=10)

chk.phylo(t1) ## should return 0

t2<-t1
t2$Nnode<-9.5

chk.phylo(t2) ## should return 1

t3<-t1
t3$edge<-t3$edge[-4,]

chk.phylo(t3) ## should return 2

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 11/5/2019 5:54 PM, Elizabeth Purdom wrote:
> [EXTERNAL SENDER]
> 
> Hello,
> 
> I am working with the phylo object from the ape package in my own package in 
> which I am manipulating the trees. I would like to check that I have 
> successfully created a valid ape object, but the `checkValidPhylo` function 
> appears to be solely interactive — it prints out a display, and always 
> returns NULL.
> 
> Is there a function in the ape package (or can there be?) that would do the 
> checks, but return the results in a way that I can then process in my 
> function? (e.g. return a vector of each of the checks as TRUE/FALSE) And I 
> don’t want anything printed out, since I don’t want that output to be printed 
> for users of my function).
> 
> I see the package `paleotree` has ported some of those checks into a test, so 
> I’m guessing such a function doesn’t exist in ape — and I don’t really want a 
> dependency on another package just for these checks.
> 
> Thanks,
> Elizabeth Purdom
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C6584f4bb63dd48f9205008d762326164%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637085840853226654sdata=48LVGO%2FHHvX0rpMy6FaVgIhoeV6UO8Ouc%2B6FUfJcFCM%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C6584f4bb63dd48f9205008d762326164%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637085840853226654sdata=qgug0JIrKlC9fpr8lqrMuBku2XpHV3hfbzPF0m8ByuI%3Dreserved=0
> 
___
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] plotting time-calibrated trees

2019-09-30 Thread Liam Revell
Dear Saleh.

You can do this using my package phytools or using ape::axisPhylo. I 
have an example using both options on my blog: 
http://blog.phytools.org/2018/02/another-technique-for-including-time.html.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 9/30/2019 8:46 AM, Saleh Rahimlouye Barabi wrote:
> [EXTERNAL SENDER]
> 
> Hello,
> 
> I have constructed a big time-calibrated tree (683 tip labels) using the  
> ape::chronopl function. What is a good way of visualizing this tree in a 
> circular way with time scale axis?
> 
> Best,
> Saleh Rahimlou
> Ph.D. Candidate
> Department of Botany and Ecology
> University of Tartu
> 14A Ravila, 50411 Tartu
> Estonia
> Email: saleh.rahim...@ut.ee
> 
> 
>  [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7Cceb0491244b3475a361d08d7459bf638%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637054408469241957sdata=KjF9wmmInmu%2FtILKWt5Yda65fvPRtKiVGjGkYuLsuA0%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7Cceb0491244b3475a361d08d7459bf638%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637054408469251946sdata=Sb1DvrI6ECAEaMf8rUX56db5NVz7j0be003l31fY9nw%3Dreserved=0
> 
___
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] phytools - fitMk producing unexpected optimizations under custom models

2019-09-18 Thread Liam Revell
Dear Ivan.

phytools::fitMk does not do ancestral state reconstruction. What 
function did you use to obtain the estimates at internal nodes?

If you want to constrain the states at particular nodes during ancestral 
state reconstruction this can be done in a fairly straightforward way. 
Here is a demo that I posted to my blog some years ago: 
http://blog.phytools.org/2014/06/constraining-internal-node-values-using.html. 
The demo is for stochastic mapping using make.simmap but it would work 
in a similar way using ape::ace or other methods, and can also be used 
for simple model fitting with fitMk or geiger::fitDiscrete.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 9/18/2019 4:36 PM, Ivan Magalhaes wrote:
> [EXTERNAL SENDER]
> 
> Hello everyone,
> Please, I am trying to use the fitMk function in phytools to test different 
> scenarios for character evolution (equal rates, all-rates-different, and 
> customized matrices with irreversible states) and getting some unexpected 
> results.
> Specifically, I have a character that has a defined ancestral condition 
> (established by outgroups not present in the analysis), three different 
> derived conditions, and taxa which lack this particular structure and have 
> been coded as "absent". A small group of taxa which is deeply nested in the 
> tree presents the plesiomorphic condition, and I would like to test if this 
> is a plesiomorphic retention or a re-gain. In the all-rates-different model, 
> it is optimized as a re-gain. So I wanted to compare this with a model where 
> re-gains are impossible, using this custom model:
> 
> - "ancestral" can shift to any state-"derived" states can shift to "absent" 
> only, but not to other derived states, nor reverse to the "ancestral" 
> condition-"absent" cannot shift to any condition
> 
> 
> This gives me a tree in which the character is optimized as a plesiomorphy. 
> Everything seems fine so far!
> However, the exact same optimization is produced if I use a different, less 
> restrictive model where all transitions are possible except for re-gains from 
> absent structures (i.e. the model allows for reversals from the derived 
> states to the ancestral state, and also transitions among derived states). I 
> find this very strange, because the only difference between this and the ARD 
> model is the impossibility to reverse from "absent" to other states - but 
> neither of the trees suggested such an optimization would occur. Thus, I 
> would expect that this second customized matrix would give results identical 
> to those of ARD -- please, does anyone know why such a result is to be 
> expected?
> Many thanks in advance.
> Best regards,Ivan
> 
> --
> Dr. Ivan L. F. Magalhaes
> 
> División Aracnología
> Museo Argentino de Ciencias Naturales "Bernardino Rivadavia"
> Av. Ángel Gallardo 470, C1405DJR, Buenos Aires, Argentinatel +54 11 4982-8370 
> int. 169
> researchgate.net/profile/Ivan_MagalhaesTwitter: @6eyes8legs
> 
>  [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C6dd2604ffd2646aefcf608d73c6fa1ad%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637044322481538463sdata=%2BiTS1Y1A7al96v%2Fnz7ckLVOgD1sMhNvCUq4BROMzf4g%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C6dd2604ffd2646aefcf608d73c6fa1ad%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637044322481538463sdata=Hi5V324VpX3gzfIyz9r5ULFE29y6olfpcFJX9%2B%2FV2as%3Dreserved=0
> 
___
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] model averaging using brownie.lite

2019-09-05 Thread Liam Revell
Dear Karla.

In my opinion, it is probably correct to use the number of tips on the 
tree as the sample size for AICc when estimating the Brownian rate: as 
the number of independent pieces of information is n-1, just like with 
an ordinary variance. For other parameters in phylogenetic comparative 
analyses, the effective sample size may be different, however.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 9/5/2019 9:49 AM, Karla Shikev wrote:
> [EXTERNAL SENDER]
> 
> Thanks so much, Liam! Just one quick follow-up question: what do you
> suggest should be the sample size for transforming AIC into AICc? the
> number of tips on the tree?
> 
> Karla
> 
> On Thu, Sep 5, 2019 at 10:27 AM Liam Revell  wrote:
> 
>> Dear Karla.
>>
>> You could try & create your own logLik method for the object class
>> "brownie.lite" as follows:
>>
>> ## method
>> logLik.brownie.lite<-function(object,...){
>>  lik<-setNames(
>>  c(object$logL1,object$logL.multiple),
>>  c("single-rate","multi-rate"))
>>  attr(lik,"df")<-c(object$k1,object$k2)
>>  lik
>> }
>> ## fit model
>> fit<-brownie.lite(tree,x)
>> ## use it
>> logLik(fit)
>> AIC(fit)
>>
>> All the best, Liam
>>
>> Liam J. Revell
>> Associate Professor, University of Massachusetts Boston
>> Profesor Asistente, Universidad Católica de la Ssma Concepción
>> web: http://faculty.umb.edu/liam.revell/, 
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.phytools.orgdata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107478464sdata=ofsem4h4SNk6g6QFUwD%2BJKO3TsTArNfH9%2BAyYDEjCvY%3Dreserved=0
>>
>> Academic Director UMass Boston Chile Abroad (starting 2019):
>> https://www.umb.edu/academics/caps/international/biology_chile
>>
>> On 9/5/2019 9:13 AM, Karla Shikev wrote:
>>> [EXTERNAL SENDER]
>>>
>>> Dear all,
>>>
>>> I've been trying to use brownie.lite to implement the tutorial available
>>> here (
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftreethinkers.org%2Ftutorials%2Fmorphological-evolution-in-r%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107478464sdata=64k6WMtazzmyn0SLRrx2wEA%2F2wkk3%2B%2F3dBS0HtjlUT8%3Dreserved=0)
>> to
>>> calculate model-averaged rates of evolution and for model selection (1
>>> versus 2 rates). However, the current version of phytools 0.6-99 won't
>>> produce AICc estimates. Does anyone know a way around this? Any help
>> would
>>> be greatly appreciated.
>>>
>>> thanks a bunch,
>>>
>>> Karla
>>>
>>>   [[alternative HTML version deleted]]
>>>
>>> ___
>>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>>>
>> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107478464sdata=ZZxjUW5cV1gb9De3yOjb54RCNlFv2WHWr01lnaeEf54%3Dreserved=0
>>> Searchable archive at
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107488458sdata=NUqbn4Yz9gYilJAs7K2mW%2BIANK1%2FmXcpvuIo0Q0h0hw%3Dreserved=0
>>>
>>
> 
>  [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107488458sdata=S0vvcWinbTdWb4T%2BwD9Fk7gFn6gdhpycbArMGgd7cYI%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C04607945a9f74968c14e08d73207f67f%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032882107488458sdata=NUqbn4Yz9gYilJAs7K2mW%2BIANK1%2FmXcpvuIo0Q0h0hw%3Dreserved=0
> 
___
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] model averaging using brownie.lite

2019-09-05 Thread Liam Revell
Dear Karla.

You could try & create your own logLik method for the object class 
"brownie.lite" as follows:

## method
logLik.brownie.lite<-function(object,...){
lik<-setNames(
c(object$logL1,object$logL.multiple),
c("single-rate","multi-rate"))
attr(lik,"df")<-c(object$k1,object$k2)
lik
}
## fit model
fit<-brownie.lite(tree,x)
## use it
logLik(fit)
AIC(fit)

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 9/5/2019 9:13 AM, Karla Shikev wrote:
> [EXTERNAL SENDER]
> 
> Dear all,
> 
> I've been trying to use brownie.lite to implement the tutorial available
> here 
> (https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftreethinkers.org%2Ftutorials%2Fmorphological-evolution-in-r%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7Cacb98c128374458b48a708d73202efd0%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032860521435814sdata=rOvlxUCu350av35%2F0BzDM4Zh9H7qYgM12wxrY%2BUxjUE%3Dreserved=0)
>  to
> calculate model-averaged rates of evolution and for model selection (1
> versus 2 rates). However, the current version of phytools 0.6-99 won't
> produce AICc estimates. Does anyone know a way around this? Any help would
> be greatly appreciated.
> 
> thanks a bunch,
> 
> Karla
> 
>  [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7Cacb98c128374458b48a708d73202efd0%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032860521435814sdata=J%2FfE7pM%2B2Fukk%2FJbisMjVg57%2FV0gZFRrAP1GMMlKEm4%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7Cacb98c128374458b48a708d73202efd0%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637032860521445801sdata=UOardufWViBYLfmv3Py7%2BORn%2BaTNylcRAgmjN3AhvlI%3Dreserved=0
> 
___
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] Nantucket Phylogenetics DevelopeR Workshop

2019-08-08 Thread Liam Revell
Dear colleagues.

We are very happy to announce the 2nd edition of a graduate-level 
workshop on phylogenetic method development R. The course will be four 
days in length and take place at the University of Massachusetts 
Boston's Nantucket Field Station from the 5th to the 8th of November, 
2019. The workshop is intended for (and open to) anyone from an 
evolutionary biologist with interest in phylogenetic methods and a 
little prior computer programming experience, to an intermediate or 
advanced computational biologist curious about honing their skills in R 
development for phylogenetics.

On the first 2.5 days of the workshop, course leaders Drs. April Wright, 
Josef Uyeda, Klaus Schliep, Claudia Solís-Lemus, & Liam Revell will 
provide an introduction to the primary data structures and methods of 
common phylogenetic R packages, the basics of computational algorithms 
for phylogenies, and an overview of other essential topics of software 
development in R (version control, unit testing, documentation, and R 
package development), the specific details of which will depend on the 
prior experience of the bootcamp participants. Over the subsequent 1.5 
workshop days participants will work in break-out groups with workshop 
leaders to develop small R packages on their chosen topics. These 
projects will focus on adding new functionality to existing R software 
in phylogenetics, and might range from tree manipulation, to 
phylogenetic inference, to comparative methods, to phylogenetic 
simulations, to the visualization of phylogenies or macroevolutionary 
data on trees.

The workshop is funded by awards from the National Science Foundation to 
Dr. Liam Revell (NSF DEB-1350474 and DBI-1759940), with additional 
support from the University of Massachusetts Boston. All accepted 
students originating from a U.S. port of origin will have their travel 
costs covered or defrayed, and room and board during the workshop will 
be provided. As the workshop will be held at a field station, 
accommodation is comfortable, but basic, and participants should be 
prepared to stay in multiple occupancy rooms.

To apply for the course, please complete a Google form that can be found 
at the following link: http://www.phytools.org/nantucket2019/apply.html. 
Details of relevant programming background (computer languages, R 
knowledge, GitHub repositories, ...) should also be provided. Admission 
is competitive, and preference will go towards students with background 
in evolutionary biology, basic to moderate experience in computer 
programming (ability to read a data file into R or a similar language 
and parse it for information, familiarity with iteration and functions, 
ability to identify when to use basic datatypes such as vectors and 
dataframes, and comfort with using help documentation to find answers), 
and a compelling motivation for taking the course. Applications should 
be submitted the google form by September 10, 2019. Questions can be 
directed to klaus.schl...@umb.edu or liam.rev...@umb.edu.

Once again, the link to apply is as follows: 
http://www.phytools.org/nantucket2019/apply.html.

All the best, Liam

-- 
Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile
___
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] model averaging for discrete character evolution

2019-08-07 Thread Liam Revell
Hi Jake.

[Edit: I see just now that Brian has also responded to this inquiry. I 
have no doubt that his message is more insightful than mine - but I'll 
nonetheless send what I was writing anyway just in case it contributes 
anything useful to the discussion.]

If you're simply interested in the states at nodes, you might consider 
just multiplying the marginal reconstructions under maximum likelihood 
by the Akaike weights of each model & summing them.

The former are probabilities that the node is in each state conditioned 
on a model, and the latter are the probabilities that each of the models 
is the best of the set. If the models in the set genuinely comprise all 
possible ways in which your character could have evolved (they don't, 
but still), then the model weighted average marginal reconstructions 
should give the total probability that each node is in each state.

If you really want to do stochastic mapping, you might consider some 
kind of rjMCMC in which you sample models & transition rates from their 
joint posterior distribution and then generate stochastic character maps 
based on this sample. This is not implemented in phytools::make.simmap 
(it does MCMC, but only given a model), but is not to hard to envision 
doing, so long as you are careful about designing the rjMCMC.

Now to read Brian's answer

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 8/7/2019 11:32 AM, Jacob Berv wrote:
> Dear R-sig phylo
> 
> I’ve been running a few discrete character Mk type models using phytool's 
> SIMMAP — and I had the idea that it might be useful to try model averaging 
> across posterior probabilities for node states.
> 
> Might this make sense to do, to avoid problems associated with model ranking 
> via AIC? Ie, average the node state probabilities based on AIC weights? Is 
> there some fundamental problem with this?
> 
> I could imagine generating some code to generate all possible transition 
> models given a set of N states, and then rather than ranking with AIC, model 
> averaging for parameter estimates (though now that I think about it, not sure 
> how one might reasonably average a symmetrical rate and an asymmetrical rate).
> 
> Best,
> Jake
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7Ce85015cb8c314c684bdc08d71b4c8fee%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637007887976647805sdata=F8qdVoT17J%2BuC6wgvFktdI1id%2Bf37hDLe1W17z6OhTw%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7Ce85015cb8c314c684bdc08d71b4c8fee%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637007887976657803sdata=ogCaep2DN92bk6%2FZwOOcpmHaCPQwX7BzNgKo2UMcWtw%3Dreserved=0
> 
___
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] Recursive addition along a tree

2019-08-04 Thread Liam Revell
Dear Mario.

 From your drawing it looks like each node & tip has a value, and then 
you update these values by reassigning each node a value equal to the 
sum of its value and that of all its descendants. Is this correct?

If so, then assuming you have ordered your quantities in x such that 
they are in the order of their node indices in the "phylo" tree object, 
you should be able to just compute:

library(phytools)
desc<-sapply(1:(Ntip(tree)+tree$Nnode),function(n,tree)
if(n<=Ntip(tree)) n else c(n,getDescendants(tree,n)),
tree=tree)
y<-sapply(desc,function(n,x) sum(x[n]),x=x)

Does that help?

Here is a complete example using a small random tree & randomly chosen 
integer values for the tips & nodes. In the illustrative plot, the 
values being summed are shown in round parentheses, while the sums are 
given in square brackets:

library(phytools)

## random tree
tree<-rtree(n=6,tip.label=LETTERS[1:6],br=NULL)

## random starting values at nodes
x<-setNames(sample(0:5,Ntip(tree)+tree$Nnode,replace=TRUE),
c(tree$tip.label,1:tree$Nnode+Ntip(tree)))
x

x<-x[c(tree$tip.label,1:tree$Nnode+Ntip(tree))]

plotTree(tree,type="cladogram",nodes="centered")

tiplabels(paste("(",x[1:Ntip(tree)],")",sep=""),
tip=1:Ntip(tree),frame="none",adj=c(-1,-1))

nodelabels(paste("(",x[1:tree$Nnode+Ntip(tree)],")",sep=""),
node=1:tree$Nnode+Ntip(tree),frame="none",
adj=c(0.5,-1))

desc<-sapply(1:(Ntip(tree)+tree$Nnode),function(n,tree)
if(n<=Ntip(tree)) n else c(n,getDescendants(tree,n)),
tree=tree)

y<-sapply(desc,function(n,x) sum(x[n]),x=x)

tiplabels(paste("[",y[1:Ntip(tree)],"]",sep=""),
tip=1:Ntip(tree),frame="none",adj=c(-1,1))

nodelabels(paste("[",y[1:tree$Nnode+Ntip(tree)],"]",sep=""),
node=1:tree$Nnode+Ntip(tree),frame="none",
adj=c(0.5,1.5))

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 8/3/2019 9:32 PM, Mario Schädel wrote:
> Dear people on this list,
> 
> I am a German PhD student in the field of arthropod palaeontology. I 
> want to develop a new approach for comparing abundance data in a 
> phylogenetic context. Unlike following the standard techniques of 
> community ecology, I want to include the abundance data not only for the 
> tips of a tree but also for its nodes. The background for this is, that 
> in palaeontology it is often not possible to identify specimens to 
> species level and also some fossils are better preserved as others, 
> hence the level of identification within samples can vary a lot.
> 
> So, I want to link a vector, or at best a data frame, that holds 
> abundance data for tips and nodes, to a tree (even this proved to be 
> problematic as all functions that I found make distinctions between tip 
> and node data). In the next step, I would like to recursively sum-up the 
> abundances along the tree, from the leaves to the root. When the data is 
> properly linked, this should not be too complicated, once the tree is 
> reordered into the “postorder” format. Afterwards, the computed data 
> should be converted in a format, that can be included into plots. 
> Alternatively, I also came up with the idea, that the abundance data 
> could be visualised by the branch lengths of the tree.
> 
> I would be more than grateful, if someone could offer me some help with 
> this project. I have been wrecking my head around this since months now.
> 
> I attached a graphical representation of my idea in case my explanations 
> are a bit confusing (orange color, abundances before computation; green, 
> summed up aundances).
> 
> 
> Best wishes to all of you!
> 
> Mario
> 
> 
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7Cf182d74c49814d14ea4d08d7187ba78d%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637004791700218025sdata=XKgwyKOdMhOPkJ9mcC5%2FTHsvoI3JrdFqQ1fVcVCavFM%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7Cf182d74c49814d14ea4d08d7187ba78d%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C637004791700218025sdata=ykNTk0VNMFGgOEGRk6w2vTJHVaXIJjNSQ9dxUxGEejc%3Dreserved=0
> 
___
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] cophylo

2019-06-17 Thread Liam Revell
I also just pushed an update to phytools that now permits exact 
duplicate tip labels in a cophylo plot. You can get this update by running:

library(devtools)
install_github("liamrevell/phytools")

with devtools installed.

More details about the update can be seen on my blog: 
http://blog.phytools.org/2019/06/update-to-plotcophylo-to-permit.html.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 6/17/2019 9:00 AM, Liam J. Revell wrote:
> Yes. Just to echo Juan, there should be no problem in your case if you 
> specify the desired matching in your association table, provided to 
> cophylo via the argument assoc.
> 
> In your case, for instance, you may have M._loti_1 and M._loti_2 in one 
> tree, but just M._loti in the other, in which case your assoc table 
> would have:
> 
> "M._loti_1"    "M._loti"
> "M._loti_2"    "M._loti"
> 
> as two of its rows. There is an example of how to use the association 
> table on my blog in a few places, including here: 
> http://blog.phytools.org/2016/08/new-user-control-of-plot-method-for.html.
> 
> Note that the method does produce an error if two tips in a single tree 
> have tip labels that match exactly. I'm not sure that this needs to be 
> the case so I may try to fix it.
> 
> Liam J. Revell
> Associate Professor, University of Massachusetts Boston
> Profesor Asistente, Universidad Católica de la Ssma Concepción
> web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org
> 
> Academic Director UMass Boston Chile Abroad (starting 2019):
> https://www.umb.edu/academics/caps/international/biology_chile
> 
> On 6/17/2019 6:40 AM, Juan Antonio Balbuena wrote:
>> Hi
>>
>> I don't see why you cannot it with cophylo. All comes down to 
>> configuring assoc (matrix containing the tip labels in tr1 to match to 
>> the tip labels in tr2) correctly.
>>
>> All the best
>>
>> Juan A. Balbuena
>>
>> El 17/06/2019 a las 12:03, Sa
>> El 17/06/2019 a las 12:03, Saleh Rahimlouye Barabi escribió:
>>>
>>> Hello,
>>>
>>> I want to plot two phylogenetic trees face-to-face using 
>>> phytools::cophylo function. I see there is no possibility to connect 
>>> 2 or 3 same taxa in a tree to one taxon in the other tree (attached). 
>>> Is there anyway doing this in R?
>>>
>>> Best
>>>
>>> Saleh Rahimlou
>>>
>>> Ph.D. Candidate
>>>
>>> Department of Botany and Ecology
>>>
>>> University of Tartu
>>>
>>> 14A Ravila, 50411 Tartu
>>>
>>> Estonia
>>>
>>> Email: saleh.rahim...@ut.ee 
>>>
>>>
>>> ___
>>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>>> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C5ef523436a534817f90908d6f3103b50%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C636963648377367229sdata=EBU1sn4OJ7b0PG57yevqBu0Er79LrQdU4kr%2FPqvSDsU%3Dreserved=0
>>>  
>>>
>>> Searchable archive at 
>>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C5ef523436a534817f90908d6f3103b50%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C636963648377367229sdata=Vp65xsQlCHdpj%2FvSrFRMgepSg%2BVYOC6H0Nd30TsjdWw%3Dreserved=0
>>>  
>>>

___
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] cophylo

2019-06-17 Thread Liam Revell
Yes. Just to echo Juan, there should be no problem in your case if you 
specify the desired matching in your association table, provided to 
cophylo via the argument assoc.

In your case, for instance, you may have M._loti_1 and M._loti_2 in one 
tree, but just M._loti in the other, in which case your assoc table 
would have:

"M._loti_1" "M._loti"
"M._loti_2" "M._loti"

as two of its rows. There is an example of how to use the association 
table on my blog in a few places, including here: 
http://blog.phytools.org/2016/08/new-user-control-of-plot-method-for.html.

Note that the method does produce an error if two tips in a single tree 
have tip labels that match exactly. I'm not sure that this needs to be 
the case so I may try to fix it.

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 6/17/2019 6:40 AM, Juan Antonio Balbuena wrote:
> Hi
> 
> I don't see why you cannot it with cophylo. All comes down to 
> configuring assoc (matrix containing the tip labels in tr1 to match to 
> the tip labels in tr2) correctly.
> 
> All the best
> 
> Juan A. Balbuena
> 
> El 17/06/2019 a las 12:03, Sa
> El 17/06/2019 a las 12:03, Saleh Rahimlouye Barabi escribió:
>>
>> Hello,
>>
>> I want to plot two phylogenetic trees face-to-face using 
>> phytools::cophylo function. I see there is no possibility to connect 2 
>> or 3 same taxa in a tree to one taxon in the other tree (attached). Is 
>> there anyway doing this in R?
>>
>> Best
>>
>> Saleh Rahimlou
>>
>> Ph.D. Candidate
>>
>> Department of Botany and Ecology
>>
>> University of Tartu
>>
>> 14A Ravila, 50411 Tartu
>>
>> Estonia
>>
>> Email: saleh.rahim...@ut.ee 
>>
>>
>> ___
>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C5ef523436a534817f90908d6f3103b50%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C636963648377367229sdata=EBU1sn4OJ7b0PG57yevqBu0Er79LrQdU4kr%2FPqvSDsU%3Dreserved=0
>>  
>>
>> Searchable archive at 
>> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C5ef523436a534817f90908d6f3103b50%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C636963648377367229sdata=Vp65xsQlCHdpj%2FvSrFRMgepSg%2BVYOC6H0Nd30TsjdWw%3Dreserved=0
>>  
>>

___
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] using color function in phylomorphospace

2019-03-09 Thread Liam Revell
Cecile makes a good point. In this case if your tree has 36 edges all 
you would have to do is change your code such that:

phylomorphospace(...,control=list(col.edge=setNames(1:36,tree$edge[,2])))

and you'll have the colors that correspond to the numeric vector 1:36. 
(These are just the 8 colors of palette() repeated until you get to 36.)

For the purposes of painting different clades with different colors I 
still recommend paintSubTree.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 3/9/2019 12:27 PM, Cecile Ane wrote:
> colors can be numeric. for example:
> plot(1:36, 1:36, col=1:36)
> Cécile
> 
>> On Mar 8, 2019, at 8:42 PM, Liam Revell > <mailto:liam.rev...@umb.edu>> wrote:
>>
>> Dear Amanda.
>>
>> I'm a little confused by your code. If you want to use
>> control=list(col.edge) you need to set col.edge to a vector of colors,
>> but in your example col.edge is a numeric vector from 1 to 36.
> 
___
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] using color function in phylomorphospace

2019-03-08 Thread Liam Revell
Dear Amanda.

I'm a little confused by your code. If you want to use 
control=list(col.edge) you need to set col.edge to a vector of colors, 
but in your example col.edge is a numeric vector from 1 to 36.

For your particular case, there is actually a much simpler way to set 
all the edges in a particular clade to be a specific color and that is 
by first 'painting' a set of states onto the tree using 
phytools::paintSubTree. This creates an object with a new class 
("simmap") and when phylomorphospace sees that object it will 
automatically paint the edges of each subtree with different colors.

It is very old, but you can see an example of this on my blog here: 
http://blog.phytools.org/2013/05/paintsubtree-doesnt-actually-paint-tree.html.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

Academic Director UMass Boston Chile Abroad (starting 2019):
https://www.umb.edu/academics/caps/international/biology_chile

On 3/8/2019 5:36 PM, AMANDA M SALVI wrote:
> Hi all,
> 
> I'm having issues adding color onto a phylomorphospace plot. I want one 
> subgenera to be color 1 and the other subgenera to be color 2, so I can 
> more easily visualize how the two subgenera covariate across the plot.
> 
> What I've attempted:
> 
> phylomorphospace(tree,df[,c("PEp","P50")], control=list(col.edge=1:36, 
> lwd=2))
> 
> But that gives me a plot without any edges (see attached png).
> 
> Thanks,
> 
> Amanda Salvi
> 
> 
> 
> 
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylodata=02%7C01%7Cliam.revell%40umb.edu%7C90755769f89d461f1a1d08d6a405d14c%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C636876742236592272sdata=OfAbbR4h1yd6WBvSwy1YThANe3HAX9U6PwZ0q8r0KRc%3Dreserved=0
> Searchable archive at 
> https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2Fdata=02%7C01%7Cliam.revell%40umb.edu%7C90755769f89d461f1a1d08d6a405d14c%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C636876742236592272sdata=1IKTCiV8USm5OuhKM1Ecoak%2B8v0ceTkHdlfSkmnZen8%3Dreserved=0
> 

___
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] patristic distance doubts and meanings

2019-02-04 Thread Liam Revell
Dear Bruno.

 > To estimate species divergence time between pair of species, I'm using
 > the phylogeny in Smith & Brown 2018 which is rooted and contain
 > 353 185 seed plant species along with 85 679 nodes, branch lengths
 > are dated. I'm applying the R function phytools::fastDist for a list
 > of sampled species to achieve a matrix of patristic distance.

To get this straight, do you want to compute pairwise distances from a 
tree containing over 353 thousand taxa? One problem that immediately 
arises is the memory that would be required to store such a matrix. If 
we assume that each element of the matrix occupies 8 bytes of memory, 
and that we are economic & record only the upper or lower diagonals of 
the matrix, we would still need about 500 GB to store the matrix.

Maybe it would be sufficient to write each distance to file, so you 
don't have to worry as much about memory (just enough disk space to 
store the file). In that case, you could use fastDist to compute each 
distance, but this would take a while as there are 62,369,645,520 
non-trivial distances between taxa (that is, excluding the distance of 
each taxon to itself and remembering that Dij=Dji). fastDist can indeed 
calculate distances between tips on such a large tree, but (on my 
computer) it takes about 0.5s per tip. At that rate it would take about 
10 years to compute all these distances.

Perhaps you actually only need to compute the distances between a subset 
of the taxa on your tree, like a few hundred up to a couple of thousand. 
If that is the case, you should be able to use fastDist; however, for 
cases in which all distances (not just one or a few) are required then 
cophenetic (which computes all distances between all tips in the tree) 
will be much faster than fastDist. fastDist is really only useful if one 
or a small number of distances are required in which case it can be used 
to compute these without calculating all patristic distances from the tree.

 > As I see in Revell's blog "the patristic distance between them is
 > simply the sum of the heights above the root for species i and j minus
 > two times the height above the root of the common ancestor of i & j",
 > is this the same that Fourment and colleagues define as a patristic
 > distance: "A patristic distance is the sum of the lengths of the
 > branches that link two nodes in a tree"?

Yes, these distances are the same. The patristic distance is the sum of 
the edge lengths that connect a pair of taxa, but this value can be 
computed by taking the sum of the total distance from the root to each 
taxon, and then subtracting two times the distance from the root to 
their common ancestor.

 > Furthermore, I'm wondering if the results of the phytools::fastDist is
 > interchangeable with the adephylo::distTips(method="patristic")?

I can't comment on that function, but the distances from fastDist are 
the same as in ape::cophenetic.

 > Finally, is the patristic distance the right choice for my propose or
 > should I use another phylogenetic distance?

I don't know.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 2/4/2019 12:41 PM, Bruno Garcia Luize wrote:
> Dear Phylo-community,
> 
> I would like to acknowledge this channel that is extremely helpful for my
> education regard phylogenetic research in a broad sense. I can describe
> myself as an ecologist recently introduced to evolution.
> 
> As an enthusiast and moved by my curiosity and desire to better understand
> tropical tree ecology I'm now trying to include phylogenetic information
> for answer my research questions. Obviously, I'm stucked in a lot of
> doubts.
> 
> I'm asking if the divergence time is corelated with the probability of a
> species pair positive or negative co-occurrence. I expect species pairs
> relatively more divergent show greater probability of positive
> co-occurrence, while close related species pairs show greater probability
> of negative co-occurrence.
> 
> To estimate species divergence time between pair of species, I'm using the
> phylogeny in Smith & Brown 2018 (ALLOTB
> https://github.com/FePhyFoFum/big_seed_plant_trees) which is rooted and
> contain 353 185 seed plant species along with 85 679 nodes, branch lengths
> are dated. I'm applying the R function phytools::fastDist for a list of
> sampled species to achieve a matrix of patristic distance.
> 
> I have doubt regard the values that the function fastDist is returning. May
> I consider those values as the divergence time between species?
> 
> As I see in Revell's blog (
> http://blog.phytools.org/2015/10/new-reasonably-fast-method-to-compute.html)
> "the patristic distance between them is simply the sum of the heights above
> the root for species i and j minus two times the height above the root of
> the common ancestor of i & j", is this the 

Re: [R-sig-phylo] Mesquite->ape node numbers and/or parsimony ancestral reconstruction

2019-01-31 Thread Liam Revell
Roland.

You have not done 'squared change parsimony' in that case, but just 
parsimony. The problem (among various) is that for a discrete character 
there is not always a single most parsimonious set of ancestral states 
and there are often many equally parsimonious reconstructions. That's 
why some scientists have developed criteria (such as 'ACCTRAN' and 
'DELTRAN') for consistently selecting one or two among the usually many 
equally parsimonious reconstructions. One should not be deceived by 
this, however. Just because the ACCTRAN and DELTRAN criteria exist 
doesn't mean that these MP solutions for ancestral states are any more 
probable than any other equally parsimonious solution (and under some 
circumstances all parsimonious solutions can be misleading).

I believe parsimony ancestral state reconstruction is implemented in the 
phangorn function ancestral.pars.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 1/31/2019 2:18 PM, Roland Sookias wrote:
> Dear Liam,
> 
> Thanks very much indeed - a really nice blog post. However, the issue is
> that I am using discrete states, which are not ordered. (and to make things
> more exciting there are also polymorphisms and missing data - although they
> can be worked around I guess)
> 
> Is there any way to get ML to yield the same as SCP would (in Mesquite at
> least) for this kind of data?
> 
> Best wishes
> 
> Roland
> 
> On Thu, Jan 31, 2019 at 8:03 PM Liam Revell  wrote:
> 
>> Dear Roland.
>>
>> I didn't really solve your problem of reading a Mesquite result into R;
>> however I just posted about the relationship between unweighted &
>> weighted square-change-parsimony & ML ancestral character estimation on
>> my blog:
>> http://blog.phytools.org/2019/01/unweighted-weighted-square-change.html.
>> (In summary, you should be able to do what you want within R.)
>>
>> All the best, Liam
>>
>> Liam J. Revell
>> Associate Professor, University of Massachusetts Boston
>> Profesor Asistente, Universidad Católica de la Ssma Concepción
>> web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org
>>
>> On 1/31/2019 12:48 PM, Roland Sookias wrote:
>>> Dear all,
>>>
>>> I want to get squared change parsimony ancestral state reconstructions
>> for
>>> a matrix into R.
>>>
>>> I have tried the asr_max_parsimony() function from castor, but the
>> results
>>> are not the same as in Mesquite for example. To take an example, a
>>> two-taxon clade with a unique state for these taxa optimized as having a
>>> different state (shared by near relatives) at the ancestral node. This
>>> doesn't happen in Mesquite and is *not* what I want.
>>>
>>> If there were some way to get the results from Mesquite into R that would
>>> also be OK, but I cannot figure out the node numbering system in
>> Mesquite,
>>> to match them up with nodes as numbered by ape.
>>>
>>> Any help would be *very* greatly appreciated.
>>>
>>> Best wishes,
>>>
>>> Roland
>>>
>>>[[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/
> 
___
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] Mesquite->ape node numbers and/or parsimony ancestral reconstruction

2019-01-31 Thread Liam Revell
Dear Roland.

I didn't really solve your problem of reading a Mesquite result into R; 
however I just posted about the relationship between unweighted & 
weighted square-change-parsimony & ML ancestral character estimation on 
my blog: 
http://blog.phytools.org/2019/01/unweighted-weighted-square-change.html. 
(In summary, you should be able to do what you want within R.)

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 1/31/2019 12:48 PM, Roland Sookias wrote:
> Dear all,
> 
> I want to get squared change parsimony ancestral state reconstructions for
> a matrix into R.
> 
> I have tried the asr_max_parsimony() function from castor, but the results
> are not the same as in Mesquite for example. To take an example, a
> two-taxon clade with a unique state for these taxa optimized as having a
> different state (shared by near relatives) at the ancestral node. This
> doesn't happen in Mesquite and is *not* what I want.
> 
> If there were some way to get the results from Mesquite into R that would
> also be OK, but I cannot figure out the node numbering system in Mesquite,
> to match them up with nodes as numbered by ape.
> 
> Any help would be *very* greatly appreciated.
> 
> Best wishes,
> 
> Roland
> 
>   [[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] Problem date consensus phylogeny

2019-01-25 Thread Liam Revell
Hi Alina.

Since you mentioned some functions of phytools, I thought it might be 
helpful to describe what each function is actually doing:

1) The function ls.consensus computes a least-squares (LS) consensus 
tree. This is the LS tree on the average patristic distance matrix of 
the input trees, as described by Lapointe & Cucumel (1997). This is a 
consensus method, but it has been criticized for not possessing what I 
believe is referred to as the 'Pareto' property - meaning, in this case, 
that the consensus tree can include relationships not present in any 
input tree! (In practice, this is probably rare for real empirical 
distributions of trees.) In general, the resultant tree will usually be 
completely resolved and if all input trees are ultrametric, the output 
tree will also be ultrametric. (Also see: 
http://blog.phytools.org/2016/04/average-trees-and-maximum-clade.html.)

2) The function averageTree trees to find the tree with the minimum sum 
of squared distances to all the trees in a set. The tree is not 
necessarily a member of the set. Any of a number of different distance 
criteria can be used; however, if the distance criterion selected does 
not use branch lengths (e.g., Robinson-Foulds distance) then the output 
tree will also not have branch lengths. (Also see: 
http://blog.phytools.org/2016/04/consensus-methods-and-computing-average.html.)

3) Finally, the function consensus.edges computes consensus edge lengths 
based on a set of input trees with edge lengths and a consensus 
topology. By default, this function computes the average edge lengths 
across all trees in which each edge of the consensus topology is 
present. The user can decide what to do if an edge is absent in a given 
input tree. The tree can be ignored, and thus contribute nothing to the 
consensus edge length for that particular edge, or the edge length for 
that tree can be set to zero. This function has a third mode, which is 
to merely compute the consensus non-negative least squares edge lengths 
on the user-supplied consensus tree. If all the input trees are 
ultrametric, then the computed tree will also be ultrametric. Note that 
this is difference from just using ls.consensus because in 
consensus.edges the LS edge lengths are computed on a fixed tree, 
whereas in ls.consensus we optimize both the topology and edge lengths 
given a set of trees. (Also see: 
http://blog.phytools.org/2016/03/method-to-compute-consensus-edge.html.)

maxCladeCred was also mentioned by another list member. This is a 
function of phangorn that finds the tree (or trees?) in the input set 
with the highest total clade probability. This is done by going clade by 
clade in each tree of a set, and computing the relative frequencies with 
which each clade is represented across the set (these are the posterior 
probabilities for each clade), multiplying the clade relative 
frequencies for each tree, and then selecting the tree with the highest 
product. Since this procedure merely permits us to select a tree or 
trees from our posterior distribution, our tree should generally be 
fully resolved and ultrametric if the trees in our input set are fully 
resolved and ultrametric. Note also that in a Bayesian posterior sample 
our maximum clade credibility (MCC) tree will usually be represented 
many times. If we find all instances of the MCC tree in our set, and all 
instances are ultrametric, then computing the average edge lengths 
across this set (e.g., using consensus.edges) will also produce a tree 
that is ultrametric.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 1/24/2019 6:14 PM, Alina van dijk wrote:
> Hi everyone,
> 
> Thanks Emmanuel and Joseph for sharing your thoughts!
> Emmanuel, today I tried multi2di and it works. But, if I understand
> correctly, this function transforms the dichotomies with branches of length
> zero. So for me, in fact, doesn't solve the politomy. Right?
> Joseph, I'm only a begginer with R and this program already gives me a lot
> of headache.
> It drives me crazy think in another program... hahahha
> Just kidding! :)
> But, nice to know that I have a plan B!
> I will take a look!
> 
> Thanks in advance,
> Best Regards,
> 
> Alina
> 
> 
> Em qua, 23 de jan de 2019 às 16:29, Emmanuel Paradis <
> emmanuel.para...@ird.fr> escreveu:
> 
>> Hi Alina,
>>
>> Did you try multi2di() to remove polytomies?
>>
>> Best,
>>
>> Emmanuel
>>
>> Le 23/01/2019 à 17:41, Alina van dijk a écrit :
>>> Hi everyone,
>>>
>>> My name is Alina, I'm attending master degree in ecology and I have a
>>> little problem with my consensus phylogeny. I used 1000 phylogeny of
>>> birdtree to construct the consensus tree but now I need to insert the
>> dates
>>> in this consensus tree.
>>>
>>> To accomplish this idea, I tried different methods:
>> 

Re: [R-sig-phylo] make.simmap -- strange posterior probability for root using ARD model?

2018-12-21 Thread Liam Revell
Dear Jesse.

The most logical explanation is that in the fitted ARD model the rate of 
transition away from the rare state is >> than the fitted transition 
rates to it (or even that the ML value of these rates is zero). 
Conditioning on this fitted model make it highly probably that the root 
is in the rare state (and that the state is rare among extant taxa of 
the tree). Is this consistent with the parameter values of the fitted Mk 
model for your data?

Another option that is available in make.simmap is Q="mcmc". This 
samples values for the transition matrix Q (given a model, such as 
model="ARD") in proportion to their posterior probability using MCMC and 
then stochastic histories according to their probability given the 
sampled value of Q. In theory this should make the result less dependent 
on the specific fitted value of Q.

To dig any deeper I would need to have your data & tree.

All the best, Liam

Liam J. Revell
Associate Professor, University of Massachusetts Boston
Profesor Asistente, Universidad Católica de la Ssma Concepción
web: http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 12/21/2018 4:41 PM, Jesse Delia wrote:
> Hello all,
> 
> I have, what I think is, a strange result from make.simmap (phytools V 
> 0.6.44). Using an ARD model, I'm getting a high probability for the 
> rarest state in my dataset. Based on trait distribution, this seems like 
> a red flag but I cant figure out whether there is an issue.
> 
> If anyone can have a look, I reproduced my dataset and tree, but its a 
> bit long and will post upon request. In the meantime, just wondering 
> whether this result is cause for concern? I pasted the plotted results 
> below, not sure if it will post to the board.
> 
> Thanks for all your help!
> 
> Jesse
> 
> Rplot.jpg
> 
> ___
> 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] Branch lengths in phytools::plot.cophylo

2018-12-12 Thread Liam Revell
I didn't see the email that this addresses, but I will add a couple of 
comments to Juan's suggestion:

(1) phytools::cophylo does not require the input trees to have branch 
lengths. If they do not, arbitrary branch lengths for plotting are 
computed using ape::compute.brlen.

(2) The code suggested by Juan does indeed assign branch lengths to the 
tree; however, it has effect of assigning different depths for 
equivalently nested relationships. If you don't like the spacing of 
compute.brlen, it is possible to change it using the argument 'power.' 
0http://faculty.umb.edu/liam.revell/, http://www.phytools.org

On 12/12/2018 12:07 PM, Juan Antonio Balbuena wrote:
> You can try this:
> 
> tree<- compute.brtime(tree, tree$Nnode:1)
> 
> It will produce an ultrametric tree with its nodes well separated.
> 
> I hope it helps
> 
> All the best
> 
___
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] Add terminal branches to tree

2017-06-19 Thread 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 167 terminal taxa inside each of the 7 genera on my tree. Basically, I 
just wanted to add some dozens of specimens to the end of each branch, but I 
don't find a way to do it. Is there any tool that would allow me to do this? 
Like adding 30 branches to 'Phal', adding 25 to 'Phat', etc.

Thanks in advance.



--
Institut des Sciences de l'Evolution
UMR5554, CNRS, IRD, EPHE
Universit� de Montpellier
Place Eug�ne Bataillon
34095 Montpellier Cedex 05
France
Email: sergio.ferreira-card...@umontpellier.fr
Tel: +33 (4 ) 67 14 46 52

[[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] need finite 'xlim' values error with plot.phylo

2017-06-13 Thread Liam Revell
This is a bug that is related to how the function optimizes xlim to permit 
space for the tip labels. By not showing tip labels, there is no optimization, 
and thus no error.



This doesn�t seem to create an issue for plotTree in phytools, which has many 
of the same options (and some additional ones) as plot.phylo.



--
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: Santiago S�nchez
Sent: Tuesday, June 13, 2017 11:35 AM
To: r-sig-phylo@r-project.org
Subject: [R-sig-phylo] need finite 'xlim' values error with plot.phylo



Hello,

I was wondering if there could be a bug in the plot.phylo code. I'm trying
to plot a tree which is scaled in yr units (less than 1 million years).
However I'm getting this error:

Error in plot.window(...) : need finite 'xlim' values

I tried rescaling to kyr and it plots well. Here is a sample test code:

library(ape)
rtr <- rtree(50)
rtr$edge.length <- rtr$edge.length*10
plot(rtr)
rtr2 <- rtr
rtr2$edge.length <- rtr2$edge.length/1000
plot(rtr2)

Something interesting is that it will plot if I omit tip labels:

plot(rtr, show.tip.label=F)

Cheers,
Santiago
--
==
Santiago Sanchez-Ramirez, PhD
Postdoctoral Associate
Ecology and Evolutionary Biology
University of Toronto
==

[[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] Truncate x-axis in phydataplot barplots

2016-10-17 Thread Liam Revell
Hi Marian.



You should be able to do it with the phytools function plotTree.barplot using 
the argument args.barplot, supplied as a list containing the arguments you want 
to pass to barplot. Not sure if this is on CRAN yet so you might have to 
install from GitHub.



Let me know if you need help.



--
Liam J. Revell, Associate Professor of Biology
University of Massachussetts Boston
email: liam.rev...@umb.edu
web: http://faculty.umb.edu/liam.revell

Sent from Outlook Mail for Windows 10 phone



From: Marian Schubert
Sent: Monday, October 17, 2016 9:12 AM
To: r-sig-phylo@r-project.org
Subject: [R-sig-phylo] Truncate x-axis in phydataplot barplots



Hey APE users,

I was wondering if there is a possibility to limit the dimensions of the x-axis 
for barplots created with phydataplot(). With other words, in barplot() I have 
the option to set xlim, how can I achieve the equivalent in phydataplot()?

Cheers and thanks in advance!
marian

___
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] Unable to reorder any phylo object with reorder.phylo

2016-08-11 Thread Liam Revell
Hi Zach.



What is your objective here? reorder.phylo reorders the edges in the �phylo� 
object, but does not usually change the order in which the tips are plotted. 
For that, you should look at ape::rotate or phytools::rotateNodes (I believe), 
ape::ladderize, or the argument tips in phytools::plotTree.



All the best, Liam



--
Liam J. Revell, Associate Professor of Biology
University of Massachussetts Boston
email: liam.rev...@umb.edu
web: http://faculty.umb.edu/liam.revell

Sent from Outlook Mail for Windows 10 phone



From: Zach Culumber
Sent: Thursday, August 11, 2016 10:48 AM
To: r-sig-phylo@r-project.org
Subject: [R-sig-phylo] Unable to reorder any phylo object with reorder.phylo



Hi everyone,

I seem to have an issue where I cannot get any trees (real data or
simulated trees) to reorder.  I've tried a lot of different things
including updating packages, restarting R, using a different computer.  My
real trees have 501 tips, but I'm having this issue even when I simulate
trees with just 25 or 50 tips.  Currently using R 3.3.1 in Rstudio and APE
3.5.  I also came across the trick of using:

phy <- read.tree(text=write.tree(phy))

but that didn't seem to work either.  The structure of the my phylo
objects (my real trees and simulated trees) are fine when passed
through checkValidPhylo.  Ultimately, if it were just one tree I
would do it in an outside program and just import the reordered tree,
but I'm wanting to apply a reordering function across a multiphylo
object.  However, I can't seem to get a single tree
reordered!  I'm pasting some code below which is pretty boiler plate
but *should* I believe work, but doesn't work for me.  If anyone has
any thoughts or advice, I would appreciate it.
Thank you!

#Simulate a single tree to test the reorder function

tree1<-pbtree(n=500,scale=10,nsim=1)

plot(tree1)

#Reorder with pruningwise

tree2<-reorder.phylo(tree1, "pruningwise")

plot(tree2)


Zach

--
Zachary W. Culumber
Postdoctoral Research Associate
Kansas State University
Division of Biology
http://www.zwcresearch.com

Coordinator
Centro de Investigaciones Cient�ficas de las Huastecas Aguazarca
http://www.cichaz.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] multipage pdf of a huge tree

2015-03-04 Thread Liam Revell
Hi Jonas.

One option is to use the function splitPlotTree in phytools. By default it 
plots the split tree in two columns, but there is an option to split it into 
two windows. Then each plotted tree could be saved as a PDF.

I will also investigate this to see if there is a better possibility.

All the best,

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
---
Sent from my Windows Phone

From: Jonas Eberlemailto:eberle.jo...@gmail.com
Sent: �3/�4/�2015 12:14 PM
To: r-sig-phylo@r-project.orgmailto:r-sig-phylo@r-project.org
Subject: [R-sig-phylo] multipage pdf of a huge tree

Dear all,

I'm searching for a way to plot a huge phylogenetic tree to multiple pages
in one searchable pdf file from R.
I thought of something like:
1. opening a pdf file
2. plotting a 'clipped' part of the tree (e.g. tips 1-100) as the first
figure on page one
3. plotting the next part of the tree (tips 101-200) as the second figure
on page two and so on...
4. closing the pdf file.

However, clip() seems not to work with plot.phylo() from ape. I tried:

library(phytools)
tree - tree-pbtree(n=100,scale=1)
plot.new()
clip(x1=0, x2=1, y1=1, y2=50)
par(new = TRUE)
plot.phylo(tree)
axis(side=1); axis(side=2)

Does anybody know if this is possible and an effective way of doing this?
Depending on the method of clipping (if there is more than one available),
is the whole tree plotted internally in each step or even worse hiddenly
embedded in the pdf?

Thank you very much for your help!

Jonas

--
Jonas Eberle
PhD student

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