-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
109 lines (70 loc) · 4.84 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
<img src="fig/Fig1.png" alt="mcfly logo" width="200px" align="right"/>
# There and back to the present: a model-based framework to estimate phylogenetically constrained alpha diversity gradients
[![DOI:10.1101/2021.12.11.472171](http://img.shields.io/badge/DOI-10.1101/2021.12.11.472171-B31B1B.svg)](https://www.biorxiv.org/content/10.1101/2021.12.11.472171v1)
[![DOI](https://zenodo.org/badge/438417407.svg)](https://zenodo.org/badge/latestdoi/438417407)
## Authors
**Leandro Duarte**,
Gabriel Nakamura,
Vanderlei Debastiani,
Renan Maestri,
Maria João Veloso da Costa Ramos Pereira,
Marcus Cianciaruso,
José Alexandre F. Diniz-Filho
## Repository overview
This repository contains data and R scripts that allows to reproduce the analyses presented in the
manuscript entitled "There and back to the present: a model-based framework to estimate phylogenetically constrained alpha diversity gradients",
in which we introduce an individual-based simulation approach coupled with Approximate Bayesian Computation (ABC)
that allows to parameterize adaptation rates of species niche positions along the evolution of a monophyletic lineage, as well as the intensity of dispersal limitation between local assemblages potentially connected by dispersal (metacommunity).
The analytic tool was implemented in an R package called [mcfly](https://github.com/GabrielNakamura/mcfly).
A preprint version of this work can be found [here](https://www.biorxiv.org/content/10.1101/2021.12.11.472171v1).
Obs -The preprint does not correspond to the most updated version of the study.
If you want to use this repository you can clone or download to your computer machine using the following code:
To clone using github from command line:
```{bash echo = TRUE, eval = FALSE}
git clone https://github.com/GabrielNakamura/Data_MS-mcfly your_repo_title
```
To download using R:
```{r echo = TRUE, eval=FALSE}
download.file(url = "https://github.com/GabrielNakamura/Data_MS-mcfly/archive/main.zip", destfile = "Data_MS-mcfly.zip")
```
## Repository structure
The script and data are organized in folders containing files that are described in the next section.
### `R` folder
The `R` folder contains all the scripts needed to read data and libraries and running the analysis
contained in the manuscript.
- `read_data_libraries.R` reads and proccess data before running the analysis for the real communities (Phyllostomidae communities)
- `Phyllostomidae.R` perform mcfly analysis using data from Phylostomidae communities accordingly to the parameters passed to `mcfly`function
- `RunSimTest_mcfly.R` contains an R function used to perform the simulations used in this study
- `SimulatedData_mcfly.R` calls `RunSimTest_mcfly.R` function to run the simulation using five degrees of dispersal parameter (w)
### `data` folder
The `data` folder contains all data necessary to run the analysis with empirical communities (using Phylostomidae communities).
- `comm_phyllostomidae_final.txt` is a community matrix with species in the columns and assemblages in the rows
- `tree_phyllostomidae_final.tre` is a newick file containing the phylogenetic tree
- `grid_data.txt` is a txt file containing coordinates (coords.x1 and coords.x2) and environmental variables used in the analysis of Phylostomidae dataset
+ Elevation - elevation in meters
+ Elev_range - elevation range in meters
+ Temp - mean annual temperature in Celcius
+ Temp_Seas - temperature seasonality as coefficient of variation in temperature for a year
+ Prec - mean anual preciptation in mm
+ Prec_Seas - precipitation seasonality as coefficient of variation in precipitation for a year
### `figs` folder
This folder contains all Figures presented in the manuscript.
All the Figures were made using [DataGraph](https://apps.apple.com/us/app/datagraph/id407412840?mt=12) software, however all data needed to construct the same figures can be obtained by running the analysis.
## Additional software
As an additional tool we developed the R package `mcfly`. The latest development version of the package can be downloaded using:
```{r echo=TRUE, eval=FALSE}
devtools::install_github(repo = "GabrielNakamura/mcfly", ref = "master")
```
**Important**: All analyses described in the preprint was done using previous versions of `mcfly`
Additionaly to R, [DataGraph](https://apps.apple.com/us/app/datagraph/id407412840?mt=12) software was used to produce all the Figures present in the manuscript. Files used in additional software can be found in `DataGraph` folder.
## Getting help
If you find a problem or a bug, please open an [Issue at GitHub](https://github.com/GabrielNakamura/Data_MS-mcfly/issues) with a minimal reproducible example.