This repository contains analysis code for the following paper:
Ian C. Ballard, Anthony D. Wager, Samuel M. McClure. Hippocampal Pattern Separation Supports Reinforcement Learning, 2019. Nature Communications.
Raw behavioral and MRI data for this study can be accessed at: https://openneuro.org/datasets/ds001590
The code is contained within several IPython notebooks that performed the analyses and generated all figures used in the manuscript.
The following software were used:
- FSL 5.0.8
- ANTS 1.9
- Lyman 0.0.10
- Freesurfer 5.3.3
- R 3.3.1
First, the anatomical image for each subject was processed using Freesurfer's recon-all tool to generate the cortical surface models.
Next, we prepare fieldmap images from two images taken with opposite phase encoding directions. Details can be found here: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/topup. The code for this analysis can be found in prepare_fieldmaps.ipynb.
Next, the functional data were preproccesed with FSL, Freesurfer, and Nipype using lyman. The processing used the experiment parameters in the sim.py and loc.py files included in this repository. This was performed with the following command line executions:
run_fmri.py -e sim -s subjects.txt -w preproc
run_fmri.py -e loc -s subjects.txt -w preproc
Next, we conducted an ICA decomposition (run_melodic.ipynb) and automatically classified and removed noise components (run_fix.ipynb). Details can be found at http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FIX/UserGuide.
Next, first-level models were fit to each run, registered to the space of the first functional run, and a fixed effects analysis was conducted.
run_fmri.py -e sim -altmodel PE -s subjects.txt -w model reg ffx -regspace epi
For the localizer experiment, data were registered to the first run of the SIM experment by using the following command:
run_fmri.py -e loc -s subjects.txt -w model reg ffx -regspace epi -regexp sim
Runs model-free analysis of behavioral data
Fits RL models to reaction time data, analyzes with leave-one-subject-out approach, and simulates values for Figure 2
RT_model_bayesian_model_comparison.ipynb
Compares RL models of reaction time data with Bayesian model comparison
Reaction time data
Warp ROIs from group space to individual subject sufaces and write binary masks in functional space.
Create images with opposite phase encoding directions for topup field correction.
Main analysis code for ROI analysis of the striatal feedback response.
Run’s FSL’s automatic ICA denoising algorithm.
Run’s FSL’s ICA decomposition on pre-processed data.
This notebook generates the ROI mask figure in the Supplement.
Compute PSA matrices and conduct mixed-effects analysis on them
Conduct permutation and control tests of regressions on PSA matrices
pattern_content_analysis.ipynb
Analysis for Figure 6. Uses localizer data to probe content of task representations.
The following scripts specify the analyses run by the Lyman ecosystem.
The lyman project file that defines general parameters for both the localizer and SIM experiments
The lyman experiment file for preprocessing and modeling the fMRI data.
contrasts for model of prediction errors
The lyman experiment file for first-level beta series modeling the fMRI data.
The subject codes used in the processing.
All code is freely available under the BSD (3-clause) license.