Coevolution-induced stabilizing and destabilizing selection shapes species richness in clade codiversification
This project is for simulating eco-evolutionary dynamics described in "Coevolution-induced stabilizing and destabilizing selection shapes species richness in clade codiversification". It is written in the R language (4.0.0) and is to be run on computing clusters running on Slurm Workload Manager.
- Copy all files to your working directory on the computing cluster.
- Unzip 'slurm.zip' and 'control.zip'.
- Create two folders under the working directory, one named "Output_extinction" and the other named "Output_no_extinction". Extinction vs. no extinction are obsolete features of the model that have been nullified, but the folder names need to be kept intact to generate the desired number of replicates.
- Replace the default working directory "Desktop/model_rcpp_hpc_OneDrive" with your own working directory in the code.
- Depending on the user's R library, packages will need to be installed before they can be used.
To simulate the described eco-evolutionary dynamics:
- Run the code in batch_script/simulation.text by copying it to your command line, and the simulation output will be stored in the two folders that you created in Step 2 in Setup.
- (Optional) Run the code in batch_script/cancel_all_jobs.text by copying it to your command line if you need to cancel all jobs.
-
To quantify trait temporal variation as mean absolute step difference (the mean absolute value of delta z): Run 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/delta_ex.slurm' and 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/delta_noex.slurm'. The output will be saved to the two folders that you created in Step 2 in Setup.
-
To quantify the degree of dispersal limitation as the proportion of native individuals among all individuals: Run 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/prop_col_ex.slurm' and 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/prop_col_noex.slurm'. The output will be saved to the two folders that you created in Step 2 in Setup.
-
To quantify genetic distance between geographic sites: Run 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/hybr_lik_ex.slurm' and 'sbatch Desktop/model_rcpp_hpc_OneDrive/slurm/hybr_lik_noex.slurm'. The output will be saved to the two folders that you created in Step 2 in Setup.
-
To quantify species richness accomulated: Run 'calc_div_turn.R' twice, first time with 'output_dir <- "Output_extinction"' and second time with 'output_dir <- "Output_no_extinction"'. This step does not necessarily need to be run on a computing cluster.
-
To read in the quantified variables: Run 'read_in_data.R'.
-
To visualize the relationships between selective regime, degree of dispersal limitation, genetic differentiation, and species richness accumulated: Run 'figure_continuous.R'. The plot will be saved as a PDF to your work directory.
-
To visualize, for each simulated scenario, a typical time series where trait value changes over time: Run 'trait_single_cell_zoom_in_out.R'. The plot will be saved as a PDF to your work directory.
- Any questions or comments are welcome and should be sent to Yichao Zeng (yichaozeng.weebly.com).