Skip to content

brainhack-school2026/leblanc_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leblanc_project

tested with R version 4.5.2

INSTRUCTIONS

System Requirements

In addition to the R packages managed by renv, this project requires several system dependencies.

Ubuntu / Debian
sudo apt update
sudo apt install gdal-bin libx11-dev pandoc

These packages are required by:

ggseg / sf → gdal-bin
clipr → libx11-dev
knitr / rmarkdown → pandoc

You can verify that the required system dependencies are available by running:

renv::restore()

If any system packages are missing, renv will report them.

1. Clone the repository

git clone <repo-url>
cd leblanc_project

2. Set up R environment

Open R or RStudio and run :

install.packages("renv") # if needed
renv::restore()

3. Verify installation

In R or Rstudio, run : 

renv::status()

Expected output:

No issues found -- the project is in a consistent state.

4. Run the full analysis pipeline (Requires an active DUC for the ABCD data)

If you have an active Data Use certification (DUC) for the ABCD data, from the trerminal (in the root of the repository) :

make

This runs the full workflow:

01_prepare_data.Rmd
02_preliminary_analyses.Rmd
03_main_models.Rmd
04_generate_brainmaps.Rmd

5. Run individual steps


If you do not have an active DUC for the ABCD data, you can run make brainmaps to be able to use the interactive visualization tool.  
make merge
make clean
make models
make brainmaps

6. Visualize results with interactive tool

From the terminal, run :

jupyter notebook visualizations/visualisations.ipynb

And then run the jupyter notebook.

Architecture of the repo

leblanc_project/

│├── data/
│   ├── .gitkeep
│   ├── raw/
│   │   └── (empty; raw ABCD data not included)
│   └── processed/
│       └── (empty; intermediate datasets generated locally)
│
├── analyses/
│   ├── 01_prepare_data.Rmd
│   │   └── Input: raw data
│   │   └── Output: merged dataset
│   │
│   ├── 02_preliminary_analyses.Rmd
│   │   └── Input: merged dataset
│   │   └── Output: cleaned dataset
│   │
│   ├── 03_main_models.Rmd
│   │   └── Input: cleaned dataset
│   │   └── Output: statistical result tables
│   │
│   └── 04_generate_brainmaps.Rmd
│       └── Input: statistical result tables
│       └── Output: brain maps
│
├── results/
│   ├── tables/
│   │   └── tables.zip
│   │       └── Contains all tables generated by the main statistical models
│   │
│   └── brainmaps/
│       └── Brain maps generated from the statistical result tables
│
└── visualisations/
    └── visualisations.ipynb
        └── Interactive visualization tool for exploring brain maps

Workflow

Raw data
    ↓
01_prepare_data.Rmd
    ↓
Merged dataset
    ↓
02_preliminary_analyses.Rmd
    ↓
Cleaned dataset
    ↓
03_main_models.Rmd
    ↓
Statistical tables (results/tables/tables.zip)
    ↓
04_generate_brainmaps.Rmd
    ↓
Brain maps (results/brainmaps)
    ↓
visualisations.ipynb
    ↓
Interactive brain map visualization

Project presentation

I am a Ph. D. student in neuropsychology. I will be working on IRMs data to analyze the effects of oral contraceptives on brain development during adolescence.


Roxanne Leblanc

Introduction

This project aims to investigate the effects of oral contraceptives initiation on brain development during adolescence. For an animated overview of the litterature on this subject, please follow this link : https://docs.google.com/presentation/d/18sPFdWEy6WP5lSThgEJ0WI-9j097xqXL/edit?usp=sharing&ouid=107748738109768169913&rtpof=true&sd=true

Objectives

  1. To model longitudinal changes in cortical thickness and grey matter volume across adolescence in relation to hormonal group.

  2. To identify and visualize cortical regions showing differential developmental trajectories between hormonal groups using brain surface maps.

Data

Sample

My sample contains around 12 000 participants divised in the following groups : around 400 OC users, 5000 females non-users and 5000 males. They provided sMRI scans at 4 times : 9-10 y/o, 11-12 y/o, 13-14 y/o, and 15-16 y/o.

Material

T1 sMRI scans, already pre-processed and segmented using Desikan-Killiany and Destrieux atlas Cortical thickness, cortical and subcortical volumes

Sex at birth at T1, and OC use at each time.

Tools

Analyses

We will conduct separate linear mixed-effects models to model brain development across time for each gray matter phenotype in every region of interest (ROI), including cortical thickness and volume. The models will include the following variables :

Independant variables : hormonal group (masculine, feminine non OC user, feminine OC user), time (1, 2, 3, 4) Dependant variables : cortical thickness/volume

Control variables : hemisphere (r/l), total intracranial volume, site, IRM model) Random effect : per ID

To do so, I will use the following tools :

lme4 R package

I will use the lmer function (chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://cran.r-project.org/web/packages/lme4/lme4.pdf)

This function will allow me to modelize linear mixed models. My arguments will be the following :

model_cortical_thickness_or_volume <- lmer( thickness/volume ~ time * hormonal_group + hemisphere + site + scanner + (1 | subject_id), data = data

The ouputs will be the estimate (beta), the standard error, the t-value avec the p-value of every principal and interaction effect. Multiple comparisons will be controlled using the False Discovery Rate (FDR) correction, applied separately for each gray matter phenotype.

emmeans R package

I will first use the emmeans function (chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://cran.r-project.org/web/packages/emmeans/emmeans.pdf)

This function will allow me to estimate marginal means for factors in my model. The models for which the interaction between hormonal group and time is still statistically significant after FDR correction will me estimated. My arguments will be the following :

model_emmeans<- emmeans(model, ~ time * hormonal_group)

I will then use the contrast function.

This function will allow be to test specific comparisons between estimated marginal means previously calculated with emmeans.

Vizualisation

The second step of this project will be to visualize the model results on brain maps. I will map the group differences in developmental trajectories by visualizing the estimates (beta) of the time × hormonal group interaction from linear mixed-effects models. I will generate a total of 6 brain maps: 3 for each brain phenotype (cortical thickness and volume). Because there are three groups, each map corresponds to a specific pairwise group comparison (using the reference group), and displays the time × group interaction effects, reflecting differences in developmental trajectories between the two groups being compared. I plan on coloring the map using the same logic as these authors : https://onlinelibrary.wiley.com/doi/epdf/10.1002/hbm.23154

ggseg R package

I will be using the ggseg package, in order to visualize the interaction effects for each ROI of the brain. chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://cran.r-project.org/web/packages/ggseg/ggseg.pdf To do so, the beta of the interaction effects of all the roi models be in a dataframe with 2 columns : roi, and value. There will be a dataframe for each gray matter phenotype, and for each pair of group comparison. It will also be important to name the roi the same way as they are names in the atlas I will be using. I will use the following arguments :

ggseg(atlas = "nom_atlas", data = dataframe_betas, mapping = aes(fill = nom_colonne_beta)) + scale_fill_gradient2(low="blue", mid="white", high="red", midpoint=0)

Le code de couleur de cette visualisation sera le suivant : bleu pour betas négatifs, blanc pour betas près de 0, rouge pour betas post. The color code will be the following : blue for negative betas, white for betas eith values around 0, red for positive betas.

Deliverables

May 28th : finish data cleaning and structure data for analyses June 3rd : finish analyses June 5th : finish visualizations

Medium

The results of the analyses and the graphs will be presented in this repo. I will also provide the code, but I will not share the data since it needs a Data Use Certification.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors