Connectome Wide Association Studies


Connectome Wide Association Studies

This workflow performs CWAS on a group of subjects.

name : string, optional
Name of the workflow.
cwas : nipype.pipeline.engine.Workflow
CWAS workflow.

Workflow Inputs:

inputspec.roi : string (nifti file)
    Mask of region(s) of interest
inputpsec.subjects : list (nifti files)
    4-D timeseries of a group of subjects normalized to MNI space
inputspec.regressor : list (float)
    Corresponding list of the regressor variable of shape (`N`) or (`N`,`1`), `N` subjects
inputspec.cols : list (int)
inputspec.f_samples : int
    Number of permutation samples to draw from the pseudo F distribution
inputspec.strata : None or ndarray
inputspec.parallel_nodes : integer
    Number of nodes to create and potentially parallelize over

Workflow Outputs:

outputspec.F_map : string (nifti file)
    Pseudo F values of CWAS
outputspec.p_map : string (nifti file)
    Significance p values calculated from permutation tests

CWAS Procedure:

  1. Calculate spatial correlation of a voxel
  2. Correlate spatial z-score maps for every subject pair
  3. Convert matrix to distance matrix, 1-r
  4. Calculate MDMR statistics for the voxel
  5. Determine significance of MDMR statistics with permutation tests

Workflow Graph:


Detailed Workflow Graph:

[1]Shehzad Z, Kelly C, Reiss PT, Emerson JW, McMahon K, Copland DA, Castellanos FX, Milham MP. An Analytic Framework for Connectome-Wide Association Studies. Under Review.
CPAC.cwas.calc_cwas(subjects_data, regressor, cols, iter, voxel_range, strata=None)[source]

Performs Connectome-Wide Association Studies (CWAS) [1]_ for every voxel. Implementation based on [2]_.

subjects_data : ndarray
Numpy data array of shape (S,`T`,`V`), S subjects, T timepoints, V voxels. The number of timepoints T can vary between subjects.
regressor : ndarray
Matrix of shape (S, R), S subjects and R regressors
iter : integer
Number of permutations to derive significance tests
voxel_range : tuple
(start, end) tuple specify the range of voxels (inside the mask) to perform cwas on.
strata : None or list
F_set : ndarray
Pseudo-F statistic calculated for every voxel
p_set : ndarray
Significance probabilities of F_set based on permutation tests

The distance matrix can potentially take up a great deal of memory and therefore is not returned.

[1]Shehzad Z, Reiss PT, Adelstein JS, Emerson JW, Chabernaud C, Mennes M, Di Martino A, Kelly C, Castellanos FX, Milham MP. (June 2011). Connectome-Wide Association Studies (CWAS): A Multivariate Distance-Based Approach. Poster to be presented at the Annual Meeting of the Organization for Human Brain Mapping, Quebec City.
[2]Xiao-Wei Song, Zhang-Ye Dong, Xiang-Yu Long, Su-Fang Li, Xi-Nian Zuo, Chao-Zhe Zhu, Yong He, Chao-Gan Yan, Yu-Feng Zang. (2011) REST: A Toolkit for Resting-State Functional Magnetic Resonance Imaging Data Processing. PLoS ONE 6(9): e25031. doi:10.1371/journal.pone.0025031
CPAC.cwas.mdmr(ys, x, cols, perms, strata=None, debug_output=False)[source]

Multivariate Distance Matrix Regression

ys : ndarray x : ndarray perms : integer or ndarray strata : list or ndarray

ps : float Fs : float Fperms : ndarray perms : ndarray

[1]Anderson, M. J. 2002. DISTML v.2: a FORTRAN computer program to calculate a distance-based multivariate analysis for a linear model. Dept. of Statistics University of Auckland. (
[2]Anderson, M. J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology 26: 32-46.
[3]Legendre, P. & L. Legendre. 1998. Numerical ecology. 2nd English ed. Elsevier Science BV, Amsterdam.
[4]McArdle, B. H. and M. J. Anderson. 2001. Fitting multivariate models to community data: a comment on distance-based redundancy analysis. Ecology 290-297.
[5]Neter, J., M. H. Kutner, C. J. Nachtsheim, and W. Wasserman. 1996. Applied linear statistical models. 4th ed. Irwin, Chicago, Illinois.
CPAC.cwas.joint_mask(subjects_file_list, mask_file)[source]

Creates a joint mask (intersection) common to all the subjects in a provided list and a provided mask

subjects_file_list : list of strings
A length N list of file paths of the nifti files of subjects
mask_file : string
Path to a mask file in nifti format
joint_mask : string
Path to joint mask file in nifti format
CPAC.cwas.nifti_cwas(subjects_file_list, mask_file, regressor, cols, f_samples, voxel_range, strata=None)[source]

Performs CWAS for a group of subjects

subjects_file_list : list of strings
A length N list of file paths of the nifti files of subjects
mask_file : string
Path to a mask file in nifti format
regressor : ndarray
Vector of shape (S) or (S, 1), S subjects
cols : list
f_samples : integer
Number of pseudo f values to sample using a random permutation test
voxel_range : tuple
(start, end) tuple specify the range of voxels (inside the mask) to perform cwas on. Index ordering is based on the np.where(mask) command
strata : ndarray (optional)
F_file : string
.npy file of pseudo-F statistic calculated for every voxel
p_file : string
.npy file of significance probabilities of pseudo-F values
voxel_range : tuple
Passed on by the voxel_range provided in parameters, used to make parallelization easier