A comprehensive Julia-based analysis pipeline for investigating vaccine responsiveness in wild vs laboratory populations of wood mice (Apodemus sylvaticus).
This repository contains the complete data analysis pipeline for the research project examining how environmental factors affect vaccine responsiveness, comparing laboratory-reared and wild wood mice populations. The study investigates the role of habitat, diet, and parasite burden on vaccine-specific antibody responses.
- How do environmental factors affect vaccine responsiveness between wild and laboratory populations?
- What role do diet and nutritional stress play in vaccine efficacy?
- How do helminth infections influence vaccine-specific antibody production?
- Can we develop causally-explicit models to quantify these relationships?
The analysis pipeline consists of several sequential Julia scripts:
0_Data_Checks.jl- Exploratory data analysis and data validation1_Multilevel_Models.jl- Multilevel Bayesian models for vaccine response analysis2_SCM_validation.jl- Directed Acyclic Graph (DAG) validation for causal inference3_SCM_identification.jl- Structural Causal Model (SCM) identification of causal effects4_SCM_intervention.jl- SCM intervention analysis for causal effect estimation4prime_SCM_intervention.jl- Extended SCM analysis with interaction effectscompute_cohens_d_main_effects.jl- Effect size calculations for main effects
DataWrangler.jl- Data processing, cleaning, and encoding functionsTuringUtils.jl- Utility functions for Bayesian models using Turing.jlTuringPlots.jl- Plotting functions for model outputs and diagnosticsPlottingUtils.jl- Additional plotting utilities for data visualisation
Scripts for generating supplementary figures:
generate_temporal_dynamics.jl- Temporal dynamics of vaccine responsegenerate_parasite_analysis.jl- Parasite burden zero-inflation analysisgenerate_sensitivity_analysis.jl- Model sensitivity and robustness testinggenerate_supplementary_figures.jl- Master script for all supplementary figures
Run from the figures/ directory:
cd figures
julia generate_supplementary_figures.jlFigures are saved to: ../../Apodemus_vaccines_manuscript/Figures/plots/
clean_data.csv- Processed dataset ready for analysisjoint_dataset_4analysis_checked.csv- Main analysis dataset with validated entriesdag_df.csv- Data formatted for causal analysisreadme_column_key.csv- Data dictionary explaining variable definitions
- Julia 1.11+ (recommended for optimal performance)
- R (for RCall integration)
-
Clone the repository:
git clone https://github.com/SimonAB/Apodemus_vaccines.git cd Apodemus_vaccines -
Open the project in VSCode or your preferred IDE
-
Launch Julia and activate the project environment:
# Start Julia REPL (⌘⇧P then "Start Julia REPL" in VSCode) ] # Enter Pkg mode activate . instantiate precompile # Optional but recommended
-
Exit Pkg mode and verify installation:
Execute the analysis pipeline sequentially:
# Data exploration and validation
include("src/0_Data_Checks.jl")
# Multilevel models
include("src/1_Multilevel_Models.jl")
# Causal inference
include("src/2_SCM_validation.jl")
include("src/3_SCM_identification_optimized.jl")
include("src/4_SCM_intervention.jl")To generate all supplementary figures:
cd figures
julia generate_supplementary_figures.jlOr generate individual figures:
julia generate_temporal_dynamics.jl
julia generate_parasite_analysis.jl
julia generate_sensitivity_analysis.jlFor custom analyses, load the utility modules:
include("src/DataWrangler.jl")
include("src/TuringUtils.jl")
include("src/PlottingUtils.jl")Analysis figures are automatically saved to the manuscript repository:
- Main figures:
../../Apodemus_vaccines_manuscript/Figures/plots/ - Generated by scripts in
src/andfigures/directories - Requires the manuscript repository to be located at
../../Apodemus_vaccines_manuscript/
The project utilises several key Julia packages:
- Turing.jl - Bayesian modelling and inference
- DataFrames.jl - Data manipulation and analysis
- CairoMakie.jl - High-quality plotting and visualisation
- MixedModels.jl - Mixed-effects modelling
- AlgebraOfGraphics.jl - Grammar of graphics implementation
- GLM.jl - Generalised linear models
- MCMCChains.jl - MCMC chain analysis and diagnostics
The project employs a comprehensive causal inference framework:
- Multilevel Modelling - Account for hierarchical data structure (individuals nested within populations)
- Directed Acyclic Graphs (DAGs) - Explicit causal assumptions and confounding relationships
- Structural Causal Models - Quantify causal effects of environmental factors
- Bayesian Inference - Uncertainty quantification and robust statistical inference
If you use this code or data, please cite:
Babayan, S.A., Venkatesan, S., Hall, J.L., Smith, E., Sweeny, A., & Pedersen, A.B. "Environmental drivers of low vaccine responsiveness in a lab-to-wild rodent model." [Journal] (in preparation).
This research code is provided for reproducibility and transparency. For questions or collaboration inquiries, please contact:
- Simon A. Babayan: [email protected]
- Amy B. Pedersen: [email protected]
This project is licensed under the terms specified in the LICENSE file.
- University of Glasgow, School of Biodiversity, One Health & Veterinary Medicine
- University of Edinburgh, Institute of Ecology and Evolution
- Julia Computing Community for excellent package ecosystem