The randomise_non_imaging script is designed to take advantage of the functionalities of FSL randomise to perform GLM-based non-parametric permutation testing using non-imaging data. This can be done fairly easily with other programs, but using randomise could be convenient to FSL users, who are accustomed to creating the necessary input files.
Download randomise_non_imaging.zip from here
This scripts requires FSL
as well as python (including the numpy
packages), and is meant to be used in Linux systems. The necessary python packages can be easily obtained by installing Anaconda
Add alias and route to .bashrc:
After unzipping randomise_non_imaging.zip, we recommend adding an alias to the user’s .bashrc as an easy way to call the script from any terminal. The path to the folder containing the parameter2nifti.pyscript should also be specified as route_NIR in the .bashrc:
alias randomise_non_imaging='bash /full/path/to/your/folder/randomise_non_imaging.sh'
Three basic input files are required:
1. Dependent variable matrix: text file containing the variables to be tested, consisting of one column per variable and one row for each observation. This is equivalent to the image input in randomise – and will in fact be converted to image format so it can be fed into the program
2. Design matrix (.mat)
3. Contrast matrix (.con): no more than 9 contrasts should be included in each contrast matrix.
Some options require additional input files:
1. F tests: requires .fts files (with the same root name as the design and contrast files)
2. Block permutation: requires exchangeability block labels .grp file (with the same root name as the design and contrast files)
Output (text) files:
1. P value file: named (output)_p_all_contrasts
2. Stats file: named (output)_stat_all_contrasts
3. F test p value file: (output)_p_F_test
4. F test stats file: (output)_Fstat
5. Corrected p value file: (output)_corrp_all_contrasts
6. Corrected F test p value file: (output)_corrp_F_test
* We recommend creating the .mat
, and .grp
files using the Glm tool in FSL. Details can be found here
randomise_non_imaging -V (V_input) -D (D_input) -O (O_name) [options]
-V: dependent variable matrix
-D: root name of the design (.mat), contrast (.con), and (optionally) F-test (.fts) and exchangeability block (.grp) files
-O: output root name
– F: perform F-test. Options are YES or NO (default is NO). If set to YES, the .fts file must be present
-G: perform block permutation. Options are YES or NO (default is NO). If set to YES, the .grp file must be present
-C: By default, p values are not corrected for multiple testing. Optionally, family-wise error-corrected p values can be generated (option -C YES) by comparing the statistic of each variable to the maximum statistic distribution across all variables under the null hypothesis.
-P: The number of permutations performed (default 10,000) can be specified using the -P option.
Example data set:
and unzip example_data.zip
. This file contains a variable file (MMSE_BDI
), corresponding to two test scores for 72 subjects. The design matrix control_vs_patient.mat
specifies two subject groups (controls and patients), and the contrast matrix control_vs_patient.con
specifies two contrasts (control>patient, patient>control). The corresponding randomise_non_imaging command would be:
randomise_non_imaging -V MMSE_BDI -D control_vs_patient -O intergroup_comparison
Hope this can be of use!