This repo holds the analysis scripts for From Maps to Models: A Survey on the Reliability of Small Studies of Task-Based fMRI.
The report uses data from the HCP YA S500 release. These should be stored in data-raw/hcp/disk*. Given that this only relies on a few elements from the HCP dataset (e.g., a few copes), the script tools/collecthcp may be helpful. The tabular information should be deposted into data-raw/hcp/[un]restricted.csv
. A copy of the unrestricted table is included in this repo. The reference table to contrasts must also be available, as provided by contrasts.
Part of the main analysis script relies on a parquet version of the S500 release that was compiled with tools/hcptoparquet.py. The location of that script's output should be stored in the path referenced by the environment variable HCPPARQUET
, defined at the top of _targets.R.
It is expected that fslr::fsldir()
resolves to a valid directory.
The rest of the analysis scripts assume that the following folders are also in data-raw:
Analysis results (including outputs from _targets) are available on zenodo: https://doi.org/10.5281/zenodo.12686151.
The R environment was tracked with renv. The environment can be installed with
renv::restore()
The python scripts relied on an environment that is described in env.yml.
The model predictions are mainly done in python. One script, difumo-connectivity prepares parquet files for analysis (as a SLURM array job with 3418 elements). This script will generate an arrow dataset (cpm-difumo2) which can be aggregated into a single parquet file with gather-difumo.py, which generates cpm-difumo.parquet
. That file contains the model predictors. The predicted values come from the unrestricted and restricted portions of the HCP YA dataset, and they are grouped by bundle-hcp.py into a parquet file called hcp.parquet
. Finally, the modeling is done by act_preds, which uses the features from cpm-difumo.parquet
to predict the outputs in hcp.parquet
(as a SLURM array job with 63 elements). The outputs of these scripts should be placed in the data-raw folder:
- data-raw/out-perm-cpm-preds-sametest
- data-raw/out-perm-cpm-sametest
- data-raw/out-perm-gold-cpm-preds-sametest
- data-raw/out-perm-gold-cpm-sametest
Analyses are structured with the targets package. To reproduce the analyses, run
Sys.setenv(TAR_PROJECT = "hcp_ptfce")
targets::tar_make()
Note that these analyses are embarrassingly parallel, so if multiple cores are available then it may be beneficial to use crew. The _targets.R script has examples of doing so (commented out).
Figures (tex files) are generated by the targets workflow and deposited into analyses/figures.