Skip to content

jacopoM28/Comparative_methods.Rscript

Repository files navigation

README

Set of R scripts useful in phylogenetic comparative analyses

It is necessary to install the following libraries: phytools, geiger and ape

  • Loss.Aquisitions_range.function.R

It calculates the number of transition events between the two states of a binary character on the basis of a range of rates in which the probability of re-acquiring the “complex” character progressively decreases with respect to the probability of loss it. It allows to consider also a range of loss rates.

Useful to find the probability treshold value after which there are no more re-acquisition events.

Since it uses the make.simmap function from the Phytools package it can also be used on a set of trees and/or for N simulations simulations.

Arguments:
1. tree = phylogenetic tree.
2. x = named vector with character states for each tip of the tree.
3. Endprob = maximal improbability of re-aquisition.
4. nsim = number of simulation makes by make.simmap.
5. interval.prob = interval for improbabilities.
6. StartProb = first improbability value.
7. StarRates = Starting loss rate.
8. EndRates = Ending loss rate.
9. Interval.rates = Interval for loss rate.

  • MultiState_Sensitivity.R

It loops the fitDiscrete function from the “geiger” package for a multi-state character through a set of trees using an ARD model and summarizing the results.

Useful to calculates the imapact of topological uncertainty in model parameters (transition rates and AICc score)

  • Branch_LengthConverter.R

Script useful to convert branches of a tree to reflect substitution rates. It requires a reference time tree were branches are proportional to time.

MultiState_Sensitivity.R and Loss.Aquisitions_range.function.R have been used in :

Giobbe Forni, Jacopo Martelossi, Pablo Valero, Frank H Hennemann, Oskar Conle, Andrea Luchetti, Barbara Mantovani, Macroevolutionary Analyses Provide New Evidence of Phasmid Wings Evolution as a Reversible Process, Systematic Biology, 2022;, syac038, https://doi.org/10.1093/sysbio/syac038

About

R script useful during phylogenetic comparative analyses

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages