DOI: 10.5281/zenodo.16411411
title: FGF21 regulates sex-specific metabolic adaptation to juvenile protein restriction

description: # FGF21 Liver-Specific Knockout Study

This repository contains all data, analysis scripts, and figures used in the manuscript:

**"FGF21 regulates sex-specific metabolic adaptation to juvenile protein restriction"**

## Contents

FGF21_study/├── data/│   ├── raw/                  # Raw input data files (e.g., body weight, qPCR, puberty onset)│   │   └── transcriptomics_counts/  # TSV files with raw counts of liver transcriptomics│   ├── processed/            # Output files from each script (e.g., Excel summary tables)│   ├── external/             # Data from an external source (e.g., Green et al., Cell Metab, 2022)├── metadata/│   ├── diet_composition.xlsx # Decription of the experimental diets│   ├── qpcr_primers.xlsw     # Primer sequences for qPCR│   ├── statistical_models_overview.xlsx # Summary table of statistical models used to analyze the data├── scripts/│   ├── 01_...R               # Numbered analysis scripts │   └── ...├── plots/│   ├── BPS_by_Weight_...png  # Final figures (PNG format)│   └── ...├── FGF21_study.Rproj         # RStudio project file└── README.md                 # This file

## How to reproduce

All scripts are written in R and use a modular, FAIR-compliant pipeline:

1. Install required R packages:   - `tidyverse`, `car`, `lme4`, `emmeans`, `DHARMa`, `openxlsx`, `broom`, etc.2. Open the project in RStudio via `FGF21_study.Rproj`.3. Run each script in order (see numbered filenames).

Each script:- Declares root via `here::i_am()`- Outputs results to `data/processed/`- Saves figures to `plots/`

## List of Scripts (51 Total)

Scripts are ordered to match the flow of figures and tables in the manuscript.

├──01–20: Juvenile Growth and Reproduction01_length_lmm_spline.R02_body_weight_lmm_spline.R03_femur_lm.R04_igf1_lmm.R05_kcal_lmm_by_interval.R06_feed_efficiency_lmm_by_interval.R07_lean_mass_permutation.R08_fat_mass_parametric.R09_BPS_timing.R10_sperm_count.R11_seminal_vesicle_ANCOVA.R12_testis_weight_t_test.R13_VO_timing.R14_first_estrus.R15_estral_cycles_P56_to_P70.R16_uterus_weight_t_test.R17_VO_to_estrus.R18_logistic_regression_puberty_males.R19_logistic_regression_puberty_females.R20_growth_puberty_reciprocal_model_females.R├──21–24: Serum and Liver Amino Acids21_serum_amino_acids_postprandial.R22_serum_amino_acids_postabsorptive.R23_individual_AA_log_lmm_and_heatmap.R24_liver_individual_AA_lmm_and_heatmap.R├──25–31: Transcriptomics & Gene Expression25_rlog_vst_pca_sample_qc.R26_DESeq2_global_model.R27_GSEA_liver.R28_Volcano_plot_liver.R29_liver_heatmaps_gene_sets.R30_sPLSDA_liver_transcriptome_metabolome.R31_liver_qPCR_models.R├──32–39: Longitudinal Models & Strain Comparisons32_FGF21_lmm_longitudinal.R33_length_lmm_spline_FGF21_liverKO.R34_body_weight_lmm_spline_FGF21_liverKO.R35_body_weight_lmm_spline_B6J.R36_femur_lm_FGF21_liverKO.R37_BPS_timing_B6J.R38_VO_timing_B6J.R39_FGF21_B6J.R├──40–48: Liver KO Specific Models40_BPS_FGF21_liverKO.R41_sperm_count_FGF21_liverKO.R42_seminal_vesicle_ANCOVA_FGF21_liverKO.R43_testis_weight_lm_FGF21_liverKO.R44_VO_timing_FGF21_liverKO.R45_first_estrus_FGF21_liverKO.R46_uterus_weight_lm_FGF21_liverKO.R47_FGF21_AFT_FGF21_liverKO.R48_liver_qPCR_models_FGF21_liverKO.R├──49–51: Additional Models for Figure S449_IGF1_longitudinal_lmm_FGF21_liverKO.R50_logistic_regression_growth_puberty_males_FGF21_liverKO.R51_logistic_regression_puberty_females_FGF21_liverKO.R

## Model Diagnostics

To determine whether transformations or non-parametric methods were necessary, we used a standalone helper script:

`scripts/52_diagnostics_DHARMa_helper.R`

This script defines a reusable function `check_model_diagnostics()` that performs the following steps:

1. Fits a linear (LM or LMM) model on the raw outcome.2. Runs residual diagnostics using the `DHARMa` package.3. If the model fails to meet assumptions:   - Applies a log-transformation and re-runs diagnostics.   - If the log-transformed model passes, the log-transformation is retained.   - If both fail, the script recommends using non-parametric alternatives such as `ARTool` or `permuco`.

This diagnostic pipeline was applied to each outcome variable prior to formal modeling, guiding decisions on:- When to apply log-transformations (e.g., for lean mass, amino acids)- When to use permutation-based ANOVA (e.g., if assumptions were violated even after transformation)

**Note**: This diagnostic procedure is not embedded in the main scripts. It serves as documentation of the decision-making process applied to the raw data before modeling, ensuring statistical validity and transparency.

## Output Files

Each script saves:

- Model results as `.xlsx` files in `data/processed/`- Figures as `.png` files in `plots/`, named to match figure panels in the manuscript (e.g., `BPS_by_Weight_FGF21_liverKO.png`)

## Session Information

A full list of all packages and their versions is provided in the `sessionInfo.txt` file at the root of the repository.

## Citation

If you use this code or dataset, please cite:

> Joly, A. et al. (2025) *Liver FGF21 mediates sex-specific adaptation to juvenile protein malnutrition.* bioRxiv. https://doi.org/10.1101/2025.07.09.663702

## External Data

This repository includes transcriptomic data from:

> Green, C. L., et al. (2022). *Sex and genetic background define the metabolic, physiologic, and molecular response to protein restriction*. Cell Metabolism, 34(2), 209-226.e5. https://doi.org/10.1016/j.cmet.2021.12.018

Data used under the terms of the **Elsevier Open Access license (CC BY-NC-ND 4.0)**.

## License

This dataset and code are shared under a [CC BY 4.0 License](https://creativecommons.org/licenses/by/4.0/).