This repository contains the batch scripts, input data, and R utilities that support the 2016-2022 Pt. Fourchon isotope comparison project. The workflow centers on running MixSIAR mixing models on the Georgia Advanced Computing Resource Center (GACRC) cluster, followed by local post-processing to summarise posterior draws, compare model structures, and evaluate isotopic niche hypervolumes.
5_data_analyses/gacrc_packets/fa22_extra_error_BA/data/- Input files grouped intomix_files,source_files, andtef_files.5_data_analyses/gacrc_packets/fa22_extra_error_BA/scripts/- Slurm submission helpers (*.sh) and analysis scripts (*.R).README.md- Project overview and operating instructions (this document).
Outputs produced by the cluster (outputs/, results/, and log files) are intentionally left out of version control because they are large and run-specific.
- Bash 4 or newer together with Slurm (tested on GACRC)
- R 4.3.x
- JAGS 4.3.1
Install these packages before running the scripts: MixSIAR, tidyverse (dplyr, ggplot2, purrr, readr, stringr, tidyr), hypervolume, fs, R2jags, scales, reshape2, dunn.test, and loo.
On GACRC the batch script fourchon_mixing_model_hypervolume.sh loads foss/2022a, R/4.3.1-foss-2022a, and JAGS/4.3.1-foss-2022a. Update the module list if the environment changes.
Each model run combines one file from each data subfolder:
mix_files/edge_<edge>_buf_<buffer>_<species>_mix.csv- Animal isotope measurements and covariates for a specific edge distance and buffer radius.source_files/<species>_mix.csv- Source isotope measurements with concentration dependencies.tef_files/tef_<species>_step_<value>.csv- Trophic enrichment factors evaluated at multiple step sizes.
Before launching jobs, copy the data/ and scripts/ directories to /work/jnlab/fourchon_isotope_runs/fa22_extra_error_BA/ (or the appropriate run folder) so the absolute paths in the scripts resolve correctly.
- Stage the run directory under
/work/jnlab/fourchon_isotope_runs/and confirm thatdata/andscripts/contain the desired files. - Generate the array definition file:
This scans
bash scripts/combinations.sh
data/tef_filesanddata/mix_files, writesscripts/combinations.txt(one line per species/TEF/buffer combination), and logs any missing files toscripts/logs/missing_files.log. - Inspect
scripts/combinations.txtto confirm that every intended pairing exists. Delete and rerun the script if you need to regenerate the list. - Submit the Slurm array job:
The wrapper calculates the array length from
bash scripts/submit_array_jobs.sh
combinations.txtand launchesfourchon_mixing_model_hypervolume.sh. Each array task runsRscript scripts/fourchon_mixing_hv_scales.r <species> <tef> <edge> <buffer>. - Monitor progress with
squeue -u <user>orsacct -j <jobid>and review per-task logs inscripts/logs/. - Collect the outputs once the jobs finish. The R script saves
.rds,.csv, and figure files tooutputs/<species>/tef_step_<value>/<buffer>/within the run directory.
All scripts assume the working directory is 5_data_analyses/gacrc_packets/fa22_extra_error_BA unless otherwise noted.
model_outputs.Rconverts eachresults_*.rds(and related models) into posterior draw tables, source contribution summaries, and trophic level estimates per buffer.confidence_intervals.Rrebuilds MixSIAR objects and produces custom continuous covariate plots (resource contribution vs. percent mangrove cover) for every model, saving PNGs underresults/<species>/<tef>/<buffer>/.compare_models.Rpairsresults_*.rdswithnull_results_*.rds, computes Akaike weights, and plots how model support changes with buffer size.hypervolumes.Randhypervolumes_with _boxplot.Roffer prototype code for isotopic niche hypervolume plots and contribution boxplots using the CSVs created bymodel_outputs.R. Review and clean these scripts before reuse.hypervolume_bootstrap.rbootstraps hypervolume size and Sorensen overlap between low- and high-mangrove habitats, writing confidence intervals toresults/hv_bootstrap/._on.Rand_on-MSMARS-60014H.Rare ad-hoc DIC comparison utilities retained for historical reference.
Before running any R script, double-check the hard-coded setwd() or absolute paths so that they point to your local clone or the cluster workspace.
- Update the
run_nameconstant and absolute paths insidefourchon_mixing_hv_scales.r(and other scripts) when creating a new packet. - Edit
SPECIES_CODESincombinations.shif the focal species list changes. - The path near the top of
combinations.shcurrently references/work/jnlab/fourchon_isotope_runs/fa22_isotope_scales_extra_error/; adjust it to match the folder that holds the data for the new run. - Modify the Slurm directives in
fourchon_mixing_model_hypervolume.sh(memory, walltime, CPU count, email) to fit future workloads.
- An empty
scripts/combinations.txtusually indicates a filename mismatch indata/. - If
Rscriptfails inside the array job, check the correspondingscripts/logs/mix_hypervolume_<job>-<task>.errfile for the error message. - MixSIAR requires JAGS on the compute node. The job will terminate immediately if the module is missing or incompatible.
- The hypervolume scripts expect balanced sample sizes between low and high mangrove groups. If they exit early, verify that the
mixing_model_df_*.csvfiles contain enough observations per habitat.
Maintained by the Pt. Fourchon Food Webs research group at the University of Georgia. Cite MixSIAR (Stock et al. 2018) and the hypervolume package (Blonder 2018) when publishing results derived from this workflow.