Analysis code for "Do Common Dopaminergic Variants Modulate Processing Speed
in Cognitive Aging? A Longitudinal Candidate Gene Study" (PLOS ONE).

These scripts reproduce the association analyses, diagnostics, and summary
tables reported in the manuscript. The underlying participant data are not
included and are not publicly available due to ethical and data-protection
restrictions; see the Data Availability statement in the manuscript for
access requests. The scripts are provided to document the analysis rather
than to be run without the restricted data.

Set the placeholder path at the top of each script
(/path/to/authorised/project_directory) to your local project directory.
All other paths are relative to it.

Software: R 4.4.1, PLINK v1.90p (6 Sep 2023), MAGMA v1.10, Python 3.
R packages: tidyverse 2.0.0, mice 3.18.0, naniar 1.1.0.
The MAGMA executable, the g1000_eur reference panel, and the MAGMA gene
annotation file are not included and are available from
https://cncr.nl/research/magma/.

Scripts are numbered in run order. .sh scripts call PLINK/MAGMA; .R scripts
run in R.

  01  Quality control, gene-panel merging, and preparation of the main,
      sensitivity, neuropathology, and synaptic analysis files with
      genome-wide ancestry PCs (includes multiple imputation of the
      clinical/lifestyle covariates).
  02  89-SNP LD-pruned set and single-SNP association models for all
      cognitive slope and intercept outcomes.
  03  Single-SNP results, multiple-testing correction, and genomic-control /
      Q-Q diagnostics (S1 Dataset; S2 Fig).
  04  957-SNP PLINK models and MAGMA gene-based analyses.
  05  MAGMA gene-based results across all outcomes (S3 Dataset).
  06  Unweighted dopamine pathway allele score (LD pruned at r2 < 0.10).
  07  Pathway allele-score models for processing-speed slope and intercept
      (S4 Dataset).
  08  n=434 clinical/lifestyle sensitivity file and 89-SNP sensitivity
      models.
  09  Sensitivity results and genomic-control diagnostics (S2 Dataset).
  10  Post-mortem neuropathology models (continuous: Braak, Thal, CAA;
      binary: alpha-synuclein, TDP-43).
  11  Neuropathology results, binary event counts and sparse-cell checks,
      and marker-to-cognition models (S5 Dataset; S12 Table).
  12  Post-mortem synaptic-density models (frontal, hippocampus, parietal,
      occipital).
  13  Synaptic-density results and marker-to-cognition models
      (S6 Dataset; S13 Table).
