This is the repository for code and data to generate results and analysis for the following paper:
"The rat frontal orienting field dynamically encodes value for economic decisions under risk". Bao, C.†, Zhu, X.†, Moller-Mara, J., Li, J., Dubroqua, S., & Erlich, J. C. (2023). https://www.nature.com/articles/s41593-023-01461-x
† These authors contributed equally to the work.
The repository comprises:
- Behavioral data (including muscimol and optogenetic perturbation data) in the CSV files (in
CSV
folder). - Electrophysiological data in Matlab ".mat" files (in
matlab
folder). - R code for generating the plots and statistics for the behavior and the three-agent model (in
R
folder) - Matlab (R2022a) code and analysis for electrophysiological recording (in
matlab
folder). - Julia code to generate the plots for the dynamical model, alternative dynamical models and pseudopopulation decoding of lottery magnitude from FOF electrophysiological data (in
julia
folder).
Clone this reposistory
cd
git clone https://github.com/erlichlab/risk-fof-ppc-2023
Download the model fits from the following link: https://rdr.ucl.ac.uk/ndownloader/files/42774595
Move the brms_model_fits.RData
file to the risk-fof-ppc-2023
root directory
Create the R enviroment using conda:
First install Miniconda and mamba. (Note: mamba isn't required but it is faster than using the base conda setup.)
then in a terminal run:
cd ~/risk-fof-ppc-2023
mamba install -f environment.yml
In your R enviroment, set your working directory: setwd('~/risk-fof-ppc-2023')
.
Load all the library and source code for generating the plots and analysis: source('R/init.R')
Then, generate all the R plots for the paper: source('R/main.R')
Install elutils and add to the path
bash> git clone https://github.com/erlichlab/elutils.git
matlab> addpath ~/elutils
matlab> cd risk-fof-pcc-2023/matlab
matlab> main_ephys_plots
matlab> lottery_sound_control
If you don't have julia, then first install julia (recommended way is to use juliaup).
Go into the julia
folder of this project and run julia like this:
julia --project=. -tauto
import Pkg
Pkg.instantiate() # This gets the dependcies
using Pluto
Pluto.run(notebook="fof_lottery_decode.jl")
Note: each Pluto notebook is its own environment. The first time you run the notebook, it will download and precompile a lot of dependecies, so it can take quite a while.
Follow the instructions above but run Pluto.run(notebook="julia/dynamical.jl")