This repository contains the code for the simulation study presented in On the construction of molecular signatures of lifestyle exposures, evaluating feature selection strategies under different latent variable scenarios.
simulation_signatures/
├── run_simulation.R # Main simulations (Scenarios 1 and 2)
├── run_supplementary.R # Supplementary simulations
├── R/
│ ├── generate_data.R # Data generation functions
│ ├── generate_latent_data.R # Data generation functions for supplementary
│ ├── analysis_fxns.R # Analysis functions
│ ├── generate_figures.R # Main figure generation
│ ├── generate_figures_supplementary.R # Supplementary figure generation
│ ├── run_scenario.R # Script to run scenarios 1 and 2
│ ├── run_supplementary_scenario.R # Script to run scenario 3
├── config/
│ ├── scenario_1.R # Config file for baseline and Scenario 1 (Common confounders)
│ ├── scenario_2.R # Config file for Scenario 2 (Downstream features)
│ ├── supplementary_scenario_3.R # Config file for Scenario 3 (Latent variables)
├── renv/ # Reproducible R environment
├── renv.lock # Package versions used in the study
└── README.md # You're here
If you have Git installed, run:
git clone https://github.com/IARCBiostat/SimulationSignatures/
cd SimulationSignaturesAlternatively, you can download the ZIP file directly from GitHub and unzip it.
To ensure the correct package versions, we recommend using the renv environment:
install.packages("renv") # If not already installed
renv::restore() # Restores package versions from renv.lockThis will install the specific versions of all required packages as used in the original analysis.
Simulations are designed to be run in parallel. The number of cores used is controlled via the NCore parameter defined in the corresponding config file (e.g., config/scenario_1.R).
Rscript run_simulation.R config/scenario_1.RRscript run_supplementary.R config/supplementary_1.RYou can edit the NCore value in the config file to match the number of CPU cores you wish to allocate.
Simulation results will be saved in the results/ directory as .rds files.
Once the simulations are complete, you can generate the figures used in the paper and supplementary material:
source("R/generate_figures.R")source("R/generate_figures_supplementary.R")Figures will be saved to a figures/ or equivalent output directory specified in the figure generation script.
For issues, bugs, or questions, feel free to open an issue or contact us.