DOI: 10.5281/zenodo.18470964
title: Data and scripts for "Effects of resource patch quality and connectivity on fungal colonization and metacommunity dynamics"

description: Data and scripts for reproducing the analyses of Naranjo-Orrico et al, "Effects of resource patch quality and connectivity on fungal colonization and metacommunity dynamics". 

The input data consists of the following two files, "Data_tables_clean.Rdata" and "data_guilds.Rdata". The two files are in R format. The R files need to be loaded using the load () function in R.

"Data_tables_clean.Rdata" includes a total of 6 input data matrices:

1)  Meta_air

2)  Meta_logs

3)  otu.table.plausible.clean, which is a sample x OTU table including the number of reads for each OTU for the plausible OTU taxonomic identification.

4)  otu.table.plausible.clean.w, which is a sample x OTU table including the relative read counts for each OTU for the plausible OTU taxonomic identification.

5)  read.counts.plausible.clean, which includes the read counts per sample during the different phases of the bioinformatics pipeline for the plausible OTU taxonomic identification.

6)  taxonomy.plausible.cl, which contains the taxonomic information at all taxonomic levels (i.e., from species to phylum) of the identified OTUs.

"Data_guilds.Rdata" includes 2 data matrices:

1)  Guilds_plausible, which contains the guild assignments matrices for the OTU plausible taxonomic identification. This table also includes information about the sample (sample_ID, sample type, site name, site type, and tree species) where the guild was found, as well as a taxonomic assignment. 

2)  Guilds_plausible_wide_table, which contains the guild assignments in an OTU x Guild format for the OTU plausible taxonomic identification.

The statistical analyses consist of joint species distribution modelling using the Hmsc package, generalized linear mixed models (GLMMs) using the lme4 and glmmTMB packages, and non-metric multidimensional scaling (NMDS) using the vegan package. Additionally, Venn diagrams (using the eulerr package) and boxplots (using the ggplot2 package) were used for visual analysis.  To perform the HMSC analysis, scripts Scr5a,Scr5b, Scr5c, Scr6a, Scr6b, Scr7, Scr8, and Scr9 are need to be run consecutively.  Scr5a defines the models with site type as a connectivity variable, and Scr5b defines the models with a continuous connectivity variable. These two types of models, each comprising 5 models with a similar set of explanatory variables except for the connectivity variable, are fitted in the study. Scr5c constructs a taxonomic tree that includes all OTUs that appear at least once in all of the models. It also includes a script to incorporate taxonomy and guilds into the taxonomic tree.  Scr6a exports the Hmsc models for fitting, and Scr6b imports the fitted HMSC models. Scr7 evaluates the convergence of the MCMC chains. Scr8 shows the parameter estimates from the fitted models, in particular, beta parameters and the variance partitioning across environmental covariates. Scr9 plots all the beta plots of all the models into one beta plot that includes all the 5 models. The rest of the scripts  Scr1-Scr4 are used to produce the different plots shown in the study of Naranjo-Orrico et al., including venn plots, NMDS plots and boxplots.