Skip to content

Commit

Permalink
Made it easier to run unit test outside INM7
Browse files Browse the repository at this point in the history
  • Loading branch information
jadecci committed Mar 18, 2020
1 parent 90f7a3e commit 2a4b6e5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
18 changes: 15 additions & 3 deletions unit_test/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
This README includes the instruction on how to run the unit test for the Connectivity-based Psychometric Prediction (CBPP) project. Note that the unit test **runs on the INM7 server only**.
This README includes the instruction on how to run the unit test for the Connectivity-based Psychometric Prediction (CBPP) project.

## Reference

Wu J, Eickhoff SB, Hoffstaedter F, Patil KR, Schwender H, Genon S. **A connectivity-based psychometric prediction framework for brain-behavior relationship studies**, *In prep*.

## Data

The unit test script uses the Human Connectome Project (HCP) data. The downloaded data are in the folder:
The unit test script uses the Human Connectome Project (HCP) data. On the **INM7 server**, the downloaded data are in the folder:


`/data/BnB3/BnB1/Raw_Data_nonBIDS/HCP`
Expand All @@ -25,10 +25,22 @@ To run the unit test, call `unit_test.sh` with the following command:
./unit_test.sh -i /data/BnB3/BnB1/Raw_Data_nonBIDS/HCP -d /data/BnB2/Projects/jwu_HCP_Derivatives/unit_test_data -o $output_dir
```

The whole-brain CBPP performance on test set will be compared to the default results in `/data/BnB2/Projects/jwu_HCP_Derivatives/unit_test_data/wbCBPP_SVR_standard_fix_parc300_Pearson_fixSeed.mat`. The parcel-wise CBPP performance on test set will be compared to the default resutls in `/data/BnB2/Projects/jwu_HCP_Derivatives/unit_test_data/pwCBPP_SVR_standard_fix_parc300_Pearson_fixSeed_parcel5.mat`.
The whole-brain CBPP performance on test set will be compared to the default results in `wbCBPP_SVR_standard_fix_parc300_Pearson_fixSeed.mat`. The parcel-wise CBPP performance on test set will be compared to the default resutls in `pwCBPP_SVR_standard_fix_parc300_Pearson_fixSeed_parcel5.mat`.

The unit test is successful if the screen prints `The two volumes are identical` twice (for whole-brain and parcel-wise results respectively).

This should take about `4h28m` to run.

If only prediction steps need to be tested, put an existing combined FC file in `$out_dir/FC_combined/HCP_gsr_parc300_Pearson.mat` and add `-t 'light'` to the command. This light version of unit test should take about `17m` to run.

## Running Unit Test Outside INM7

As the unit test uses HCP data, it is currently only tested on the **INM7 server**. In order to run the unit test outside INM7, the data need to be prepared in the same structure.

For resting-state fMRI data, follow the description in the `Data` section, saving the data in `$fmri_dir`. Use the subject IDs of the first 50 subjects in `bin/sublist/HCP_surf_fix_allRun_sub.csv`. Save the psychometric data (N subject x P features matrix) as variable `y` in `$deriv_dir/unit_test_y.mat`. Save the confounding variables (N subject x C variables matrix) as variable `conf` in `$deriv_dir/unit_test_conf.mat`.

Then call the unit test script with the following command:

```
./unit_test.sh -i $fmri_dir -d $deriv_dir -o $output_dir
```
Binary file not shown.
8 changes: 3 additions & 5 deletions unit_test/unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ date
# compare results and done
echo "Comparing whole-brain CBPP results ..."
wb_output=$output_dir/CBPP_perf/wbCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed.mat
wb_compare=$deriv_dir/wbCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed.mat
wb_compare=$ROOT_DIR/unit_test/wbCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed.mat
matlab -nodesktop -nosplash -r "addpath('$ROOT_DIR/unit_test'); \
unit_test_compare('$wb_output', '$wb_compare'); \
exit"
echo "Comparing parcel-wise CBPP results ..."
pw_output=$output_dir/CBPP_perf/pwCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed_parcel5.mat
pw_compare=$deriv_dir/pwCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed_parcel5.mat
pw_compare=$ROOT_DIR/unit_test/pwCBPP_SVR_standard_HCP_gsr_parc300_Pearson_fixSeed_parcel5.mat
matlab -nodesktop -nosplash -r "addpath('$ROOT_DIR/unit_test'); \
unit_test_compare('$pw_output', '$pw_compare'); \
exit"
Expand All @@ -98,9 +98,7 @@ usage() { echo "
Usage: $0 -o output_dir
This script parcellates and computes the connectivity of 50 HCP subjects and use the combined FC matrix for whole-brain and parcel-wise CBPP.
The prediction results should be compared to \$deriv_dir/wbCBPP_SVR_standard_gsr_parc300_Pearson_fixSeed.mat and \$deriv_dir/pwCBPP_SVR_standard_gsr_parc300_Pearson_fixSeed_parcel5.mat.
Note that this unit test can only be run on the INM7 cluster.
The prediction results should be compared to wbCBPP_SVR_standard_gsr_parc300_Pearson_fixSeed.mat and pwCBPP_SVR_standard_gsr_parc300_Pearson_fixSeed_parcel5.mat respectively.
REQUIRED ARGUMENTS:
-i <input_dir> absolute path to input directory
Expand Down
Binary file not shown.

0 comments on commit 2a4b6e5

Please sign in to comment.