Advanced functional connectivity functions and scripts including ones for connectome-wide association studies. This package offers a fast and memory efficient approach to analyzing big brain connectivity data. It also provides a framework for analyzing how variations in an n x n connectivity matrix can explain behavior or psychiatric diagnosis (where n = a node or brain region). The approach first examines the most important nodes in the brain associated with behavior. It then examines what connections in those relevant nodes are driving the association with behavior. This hierarchical approach makes the connectome-wide association results more interpretable.
If you are interested in a permutation-based cluster correction of data, please see this gist: https://gist.github.com/czarrar/0e620cf64a975380cdc2.
Please note that this package is no longer actively maintained. You can get it to run using an older version of R, Rcpp, and other packages. However, I have ported the R code into Python. Please use the Python version of the package that is a part of CPAC.
Connectome-wide association studies (CWAS) remain limited by statistical approaches that are computationally intensive, depend on a priori hypotheses, or require stringent correction for multiple comparisons. To address these issues, we proposed a data-driven framework (Shehzad et al., 2014) that provides a comprehensive, voxel-wise survey of brain-behavior relationships using multivariate distance matrix regression (MDMR; Anderson 2001). The approach identifies voxels whose whole-brain connectivity patterns vary significantly with a phenotypic variable. Here, we introduce the R software package connectir
for applying CWAS on resting-state fMRI data.
There are two ways to parallelize the analyses. One approach is to divide your workflow into smaller chunks and run those separately (like separate processes). This comes with the R packages installed with connectir_install.R. Another approach is to run each matrix algebra operation (e.g., dot product) in parallel, which we go into detail in this section. Below I detail different linear algebra libraries and linking them to R. Note this section is still under development.
If you have Windows, Ubuntu, or RedHat/Centos, you can install Revolution R. This is a version of R compiled with Intel MKL by the company Revolution Analytics available free for academic use. You can get it from here.
Another option is to compile and install R linked with Intel MKL on your own. Here is a good and quick tutorial.
You can also install R via my own script that links R with a parallel matrix algebra library called openblas. This script is in the Rinstall repo and is called install.py.
Another option for linux is to download repositories. A good/quick tutorial can be found here.
After R is setup, there are several packages within R that need to be installed. To do this, please run connectir_install.R. After downloading (or copying and pasting) this script to your machine, you can run it with Rscript connectir_install.R. On certain linux systems, you need to ensure you have libcurl and libxml installed.
Here we give a vanilla run of CWAS-MDMR and further details can be found on the wiki. I also go through these steps in our resting-state conference poster.
connectir_subdist.R \
-i functional_path_list.txt \
--automask1 \
--brainmask1 standard_grey_matter.nii.gz \
--bg standard_brain_4mm.nii.gz \
--memlimit 20 -c 3 -t 4 \
subject_distances_outdir
```
* -i: List of your input functional images. Can be nifti (nii or nii.gz) containing voxelwise time-series or text files containing region/parcellation time-series (columns=regions and rows=time-points).
* --automask1: Will generate the group mask containing only voxels that have non-zero values (i.e., variance) across all participants.
* --brainmask1: An additional prior mask. We tend to use a 25% probability grey matter mask in MNI152 standard space. You can find these on the CPAC website.
* --bg: This is used to determine writing of output voxelwise files and also in the future will be used to generate images of the results. Since my data here is assumed to be voxelwise in 4mm space, the standard reference image is also in 4mm space.
* --memlimit: The memory (RAM) limit of the processes in GB. Here it is set to 20GB.
* -c: Number of parallel jobs/forks to run in parallel.
* -t: Number of parallel linear algebra operations.
* Finally the last argument gives the full path to the output directory.
## Multivariate Distance Matrix Regression (MDMR)
For the options that are the same as before (--memlimit, -c, -t), I will not repeat the description here.
```bash
connectir_mdmr.R \
-i subject_distances_outdir \
--formula FSIQ + Age + Sex + meanFD \
--model model_evs.csv \
--factors2perm FSIQ \
--memlimit 8 -c 3 -t 4 \
--save-perms --ignoreprocerror \
iq_outdir.mdmr
*
, which will generate the main effects and interaction. To only look at the interaction (for instance between Age and Sex), you would use : as in Age:Sex.Please refer to the paper in NeuroImage
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.