Multi shell pipeline - adpines/tutorials GitHub Wiki
Author: Adam Pines
Date: 2/18/19
Replicator: Matthew Cieslak
Goal: To replicate comparative developmental and head-motion analyses of FA, ICVF, and RTOP in five subjects
Input data: Initial Data consists of subjects' T1's, topup reference scan, and multi-shell DWI's (b=0, 300, 800, and 2000). Pre-calculated transformation matrices are also utilized, as well as study templates.
Path to example input data: /data/joy/BBL/tutorials/exampleData/AMICO_NODDI/raw/
Code: /data/joy/BBL/tutorials/code/multishell_diffusion
1. Preprocessing (Raw --> Distortion corrected image)
Preprocessing though the wrapper will submit Multishell_PreProc jobs for each subject.
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PreProc/wrap_MultiShell_PreProc.sh
Output: topup, motion, and eddy corrected data with t1 mask. Also includes coregistrations (transforms via .mat files and needed coregistered images) for each subject. NODDI scalars (and their coregs) are also included in preproc - should output to an AMICO/NODDI folder within subject directory.
2. MAPL Fitting
This also works as a wrapper. Fits MAPL to preproced data.
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/wrap_MultiShell_mapl.sh
Output: RTAP,RTPP, and RTOP for subjects. Also can output basis function fits.
3. Tractography
FA/Tractography in wrapper form. Like others, it will run through every subject in your "general" file path.
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/wrap_determTract.sh
Output: Camino FA map, scalar weighted connectivity matrices.
4. Standard Space Developmental Effects (Mean White matter, voxelwise)
Here we have to extract the mean white matter value of each scalar. This is done in standard space using a standardized white matter mask for a basis of equivalence between subjects. First you have to:
4a) transform all subject scalar maps to the PNC template using ANTs.
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/wrap_MultiShell_std_space.sh
Output: RTOP and FA in Standard PNC space in each subjects /norm/
folder. ICVF Should already be there from the preproc steps.
4b) mean values of all scalars from white matter mask in standard/PNC space
Literally just 3dROIstats commands in a for loop. Set to print out .txt file to users' home directory.
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/wm_mask_stats.sh
Output: .txt files with mean scalar values of subjects' white matter
4c) Voxelwise analyses
This step utilizes Angels' voxelwise wrapper. Example listed is for FA.
Syntax: /data/joy/BBL/applications/R-3.5.1/bin/Rscript /data/jux/BBL/applications-from-joy/groupAnalysis/gam_voxelwise.R -c /data/joy/BBL/tutorials/exampleData/AMICO_NODDI/Voxelwise/rdsFiles/fa_voxelwise.rds -o /data/joy/BBL/tutorials/exampleData/AMICO_NODDI/Voxelwise/voxelwise_fa -p "path.val" -m /data/joy/BBL/tutorials/exampleData/AMICO_NODDI/templates/pnc_wm_prior_bin2mm.nii.gz -i include -u 'bblid' -f '~s(age,k=4)+meanRELrms.x' -n 1 -s 0 -r true -a "fdr" -k 1
To run on ICVF and RTOP, replace fa_voxelwise.rds with icvf_voxelwise.rds and rtop_voxelwise.rds. Additionally, replace the output directory (Voxelwise/voxelwise_fa
-> Voxelwise/voxelwise_icvf
), etc.
Output: Voxelwise maps of GAM evaluations of input terms. Map used for paper was gamPadjusted_fdr_sage.nii.gz.
5. Edgewise analyses
Here we use scalar weighted tractography edges to run analyses. This involves taking the squareform of each matrix (vectorizing), stacking them into one 2-D matrix, making a generalized additive model on each possible edge, and FDR-correcting them
5a) Squareforming and stacking Squareform_new (matlab lingo) is a matlab script. It vectorizes and saves connectivity values to subject directories
Syntax: matlab -nodisplay -r 'run /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/squareform_new.m' -r 'exit'
Then to combine (prints out in home directory)
Syntax: /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/SQcombine.sh
5b) GAM/p-val correction
R scripting for this one, takes a while given the number of possible edges in 200 ROIs
Syntax: Rscript /data/joy/BBL/tutorials/code/multishell_diffusion/PostProc/edge_gams.R