OSCR

Cortical-limbic circuit dynamics of approach-avoidance conflict in humans.

Code ↔ Paper

10 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 10 matches
  1. [1] § Results › Behavioral Results ↔ analysis/behavior/figure_1_behave_plots.Rmd, lines 436–497 · score 0.69 · face validity, anger, boredom, disinterest, excitement, frustration
  2. [2] § Results › Theta coherence increases over the approach period and falls during avoidance ↔ analysis/coherence/create_sig_theta_coherence_csv.Rmd, lines 240–315 · score 0.66 · Pairwise Phase, connectivity metrics, theta coherence, 1.5 seconds, bins, Sig
  3. [3] § Results › Behavioral Results ↔ analysis/behavior/figure_1_behave_plots.Rmd, lines 285–339 · score 0.61 · risk tolerance, iEEG, turning distance, Variability, game, Figure 1
  4. [4] § Methods › Behavioral task ↔ R/clean_behavioral_data.R, lines 102–186 · score 0.60 · death animation, lost, corridor, caught, exit, game
  5. [5] § Results › Network circuit reorganization after decision to avoid ↔ analysis/attack/fig5_right_mfg_models_and_figures.Rmd, lines 252–283 · score 0.59 · strike trials, chase trials, right MFG, attack, locked, power
  6. [6] § Results › Network circuit reorganization after decision to avoid ↔ analysis/attack/fig5_right_mfg_models_and_figures.Rmd, lines 252–283 · score 0.56 · Strike trial, Chase trials, right MFG, stacks, Attack, locked
  7. [7] § Results › Pairwise synchrony during approach behavior correlates with choice to avoid ↔ analysis/turnaround_time_correlations/turntime_threshold_model_comparison.Rmd, lines 91–158 · score 0.56 · theta coherence thresholds, OFC ACC, HFA synchrony, OFC MFG, predictive, correlated
  8. [8] § Methods › Data preprocessing ↔ across_subject_analyses/scripts/average_tfr_functions.py, lines 49–157 · score 0.56 · trial onset, MNE, channels, preprocessing, epochs, log
  9. [9] § Results › Behavioral Results ↔ analysis/behavior/brms_behavioral_modeling.Rmd, lines 211–258 · score 0.56 · behavioral model, large reward, Male, sex, online, away
  10. [10] § Methods › Bayesian linear mixed effects models ↔ analysis/freq_power_analyses/all_roi_theta_app_av.Rmd, lines 334–460 · score 0.51 · standard deviation, brms, warmup, chains, fit, linear

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R Markdown · 497 lines · 19 KB · no license · 2 matches

  1. ---
  2. title: "Figure 1 Behavioral Data"
  3. output: html_document
  4. date: "2024-10-14"
  5. ---
  6. ```{r setup, include=FALSE}
  7. knitr::opts_chunk$set(
  8. echo <- FALSE, # don't print the code chunk
  9. warning <- FALSE, # don't print warnings
  10. message <- FALSE, # don't print messages
  11. fig.width <- 5, # set default width of figures
  12. fig.height <- 8, # set default height of figures
  13. fig.align <- "center", # always align figure in center
  14. fig.pos <- "H", # always plot figure at the exact location of the code chunk
  15. cache <- FALSE) # cache results
  16. ## libraries ##
  17. library(tidyverse)
  18. library(ggplot2)
  19. library(magrittr)
  20. library(ggthemr)
  21. library(grid)
  22. library(gtable)
  23. library(gridExtra)
  24. library(wesanderson)
  25. library(ggsci)
  26. library(zoo)
  27. library(kableExtra)
  28. library(lme4)
  29. library(RColorBrewer)
  30. library(doParallel)
  31. library(parallel)
  32. library(foreach)
  33. library(here)
  34. library(fs)
  35. library(ggcorrplot)
  36. library(viridis)
  37. library(lmtest)
  38. library(gt)
  39. library(survminer)
  40. library(survival)
  41. library(effectsize)
  42. library(scales)
  43. library(rcartocolor)
  44. library(brms)
  45. ## hand written functions ##
  46. source(path(here(), "R", 'mutate_cond.R'))
  47. source(path(here(), "R", "clean_behavioral_data.R"))
  48. source(path(here(), "R", "create_distance_df.R"))
  49. ## plotting helpers ##
  50. ggthemr("light")
  51. getPalette = colorRampPalette(brewer.pal(17, "Set1"))
  52. c25 <- c(
  53. "dodgerblue2", "#E31A1C", # red
  54. "green4",
  55. "#6A3D9A", # purple
  56. "#FF7F00", # orange
  57. "black", "gold1",
  58. "skyblue2", "#FB9A99", # lt pink
  59. "palegreen2",
  60. "#CAB2D6", # lt purple
  61. "#FDBF6F", # lt orange
  62. "gray70", "khaki2",
  63. "maroon", "orchid1", "deeppink1", "blue1", "steelblue4",
  64. "darkturquoise", "green1", "yellow4", "yellow3",
  65. "darkorange4", "brown"
  66. )
  67. # ## parallelization ##
  68. # nCores <- 2
  69. # registerDoParallel(nCores)
  70. ```
  71. ## Behavioral Plots (Figure 1)
  72. This script compares the behavior between iEEG and prolific participants and shows the normative behavior in the task.
  73. It requires:
  74. * `all_subs_complete_distance_df.csv` and `all_subs_complete_behavior_df.csv` which are outputs of `analysis/cleaning_ieeg_behavior/combine_ieeg_subs_behavior.Rmd`.
  75. * `cleaned_pilot_behavior.csv`, `cleaned_pilot_game_data.csv`, `cleaned_pilot_distance_data.csv`, and `cleaned_pilot_across_trial_data.csv` which are outputs of `analysis/behavior/normative_behavior.Rmd`.
  76. * `cleaned_pilot_behavior_newsample.csv`, `cleaned_pilot_game_data_newsample.csv`, `cleaned_pilot_distance_data_newsample.csv`, and `cleaned_pilot_across_trial_data_newsample.csv` which are outputs of `analysis/behavior/normative_behavior_newsample.Rmd`.
  77. It produces:
  78. * `figure1_dots_plot.png` in the `figures/behavior` folder
  79. * `figure1_last_away_plot.png` in the `figures/behavior` folder
  80. * `figure1_turnaround_reward_plot.png` in the `figures/behavior` folder
  81. * `figure1_experienced_emotions_plot.png` in the `figures/behavior` folder
  82. * `behave_turn_distance_reward_model.RData`in the `results` folder
  83. ```{r load-pilot-data}
  84. # load data #
  85. behave_data_pilot <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_behavior.csv"))
  86. game_data_clean_pilot <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_game_data.csv"))
  87. game_data_distance_pilot <- read_csv( path(here(), "munge", "prolific", "cleaned_pilot_distance_data.csv"))
  88. all_vars_df_pilot <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_across_trial_data.csv"))
  89. # add case #
  90. behave_data_pilot <- behave_data_pilot %>% mutate(case = "pilot")
  91. game_data_clean_pilot <- game_data_clean_pilot %>% mutate(case = "pilot")
  92. game_data_distance_pilot <- game_data_distance_pilot %>% mutate(case = "pilot")
  93. all_vars_df_pilot <- all_vars_df_pilot %>% mutate(case = "pilot")
  94. ```
  95. ```{r load-newsample-data}
  96. # load data #
  97. behave_data_ns <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_behavior_newsample.csv"))
  98. game_data_clean_ns <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_game_data_newsample.csv"))
  99. game_data_distance_ns <- read_csv( path(here(), "munge", "prolific", "cleaned_pilot_distance_data_newsample.csv"))
  100. all_vars_df_ns <- read_csv(path(here(), "munge", "prolific", "cleaned_pilot_across_trial_data_newsample.csv"))
  101. # add case
  102. clinical_ids <- behave_data_ns %>% filter(case == "clinical") %>% pull(subject)
  103. all_vars_df_ns <- all_vars_df_ns %>% mutate(case = if_else(subject %in% clinical_ids, "clinical", "nonclinical"))
  104. ```
  105. ```{r load-ieeg-data}
  106. # load ieeg data
  107. all_subs_g_dist <- read_csv(path(here(), "munge", "all_subs_complete_distance_df.csv"))
  108. ieeg_clean_df <- read_csv(path(here(), "munge", "all_subs_complete_behavior_df.csv"))
  109. # add case
  110. all_subs_g_dist <- all_subs_g_dist %>% mutate(case = "ieeg")
  111. ieeg_clean_df <- ieeg_clean_df %>% mutate(case = "ieeg")
  112. ```
  113. ```{r ieeg_all_vars_df}
  114. ieeg_all_vars_df <- ieeg_clean_df %>%
  115. group_by(subject) %>%
  116. filter(!is.na(Score)) %>%
  117. filter(Trial != "ITI") %>%
  118. # calculate number of deaths
  119. mutate(death_check = as.numeric(c(diff(Lives) < 0, FALSE))) %>%
  120. mutate(total_deaths = sum(death_check)) %>%
  121. mutate(max_trial = max(trial_numeric)) %>%
  122. mutate(trial_in_block = trial_numeric %% 20) %>%
  123. mutate(trial_in_block = if_else(trial_in_block == 0, 20, trial_in_block)) %>%
  124. # new minigame
  125. mutate(lives_check = as.numeric(c(diff(Lives) > 0, FALSE))) %>%
  126. mutate(total_games = sum(lives_check) + 1) %>%
  127. group_by(subject, Trial) %>%
  128. mutate(dots_eaten = max(Eaten)) %>%
  129. mutate(max_score = max(Score, na.rm = T)) %>%
  130. filter(trial_length < 5) %>%
  131. mutate(chase_trial = any(Chase)) %>%
  132. mutate(attack_trial = any(Attack)) %>%
  133. mutate(trial_died = sum(death_check)) %>%
  134. mutate(last_trial_in_minigame = sum(lives_check)) %>% # if lose all lives, mark as last trial
  135. mutate(last_trial_in_minigame = if_else(trial_in_block == 20, 1, last_trial_in_minigame)) %>% # 20 is always last trial
  136. group_by(subject) %>%
  137. mutate(average_score = mean(max_score)) %>%
  138. mutate(max_time = max(Time)) %>%
  139. select(subject, Trial, trial_numeric, trial_in_block, TrialType, trial_length,
  140. trial_died, last_trial_in_minigame, Lives, dots_eaten,
  141. chase_trial, attack_trial,
  142. max_trial, total_deaths, average_score, max_time) %>%
  143. distinct()
  144. # get trials in minigame
  145. round <- 1
  146. game <- 1
  147. ieeg_all_vars_df$trial_in_minigame <- 0
  148. ieeg_all_vars_df$minigame <- 0
  149. for(idx in 1:nrow(ieeg_all_vars_df)){
  150. # add to df
  151. ieeg_all_vars_df$trial_in_minigame[idx] <- round
  152. ieeg_all_vars_df$minigame[idx] <- game
  153. if(ieeg_all_vars_df$last_trial_in_minigame[idx] == 1){
  154. round <- 1
  155. game <- game + 1
  156. } else {
  157. round <- round + 1
  158. }
  159. if(ieeg_all_vars_df$subject[idx + 1] != ieeg_all_vars_df$subject[idx] & idx != nrow(ieeg_all_vars_df)) {
  160. round <- 1
  161. game <- 1
  162. }
  163. }
  164. # max trials in minigame and such
  165. ieeg_all_vars_df <- ieeg_all_vars_df %>%
  166. group_by(subject) %>%
  167. mutate(longest_minigame = max(trial_in_minigame)) %>%
  168. mutate(longest_minigame_under20 = max(trial_in_minigame[trial_in_minigame < 20])) %>%
  169. mutate(number_of_minigames = max(minigame)) %>%
  170. mutate(block = ceiling(trial_numeric/20)) %>%
  171. group_by(subject, block) %>%
  172. mutate(block_deaths = sum(trial_died)) %>%
  173. mutate(average_dots_per_block = mean(dots_eaten))
  174. ```
  175. ```{r merge-samples}
  176. behave_data <- bind_rows(behave_data_pilot, behave_data_ns %>% mutate(comp_7 = as.logical(comp_7)))
  177. game_data_clean <- bind_rows(game_data_clean_pilot, game_data_clean_ns)
  178. all_vars_df <- bind_rows(all_vars_df_pilot %>% select(-Trial),
  179. all_vars_df_ns %>% select(-Trial),
  180. ieeg_all_vars_df%>% select(-Trial))
  181. # distance df
  182. game_data_distance <- bind_rows(game_data_distance_pilot, game_data_distance_ns)
  183. good_cols <- colnames(all_subs_g_dist)[colnames(all_subs_g_dist) %in% colnames(game_data_distance)]
  184. game_data_distance <- bind_rows(game_data_distance %>% select(all_of(good_cols), -Trial),
  185. all_subs_g_dist %>% select(all_of(good_cols), -Trial))
  186. ```
  187. ## Dot Plot
  188. ```{r game-level-time, echo = F, fig.width=9, fig.height=4.5}
  189. ieeg_dot_df <- ieeg_all_vars_df %>%
  190. filter(block <= 12)
  191. prolific_dots_df <- bind_rows(all_vars_df_pilot %>% select(-Trial),
  192. all_vars_df_ns %>% select(-Trial)) %>%
  193. filter(block <= 12) %>%
  194. group_by(subject) %>%
  195. mutate(avg_sub_dots = mean(dots_eaten)) %>%
  196. distinct(subject, avg_sub_dots) %>%
  197. ungroup() %>%
  198. summarise(avg_dots = mean(avg_sub_dots), sd_dots = sd(avg_sub_dots))
  199. prolific_dots_df <- bind_rows(all_vars_df_pilot %>% select(-Trial),
  200. all_vars_df_ns %>% select(-Trial)) %>%
  201. filter(block <= 12) %>%
  202. group_by(subject) %>%
  203. mutate(avg_sub_dots = mean(dots_eaten)) %>%
  204. distinct(subject, avg_sub_dots) %>%
  205. ungroup() %>%
  206. summarise(avg_dots = mean(avg_sub_dots), sd_dots = sd(avg_sub_dots))
  207. dots_plot <- all_vars_df %>%
  208. filter(block <= 12) %>%
  209. ggplot(., aes(x = factor(block), y = average_dots_per_block, fill = 'f')) +
  210. geom_violin(alpha = .7, fill = "#FB6087") +
  211. geom_boxplot(notch = T, width =.2, fill = "#FB6087") +
  212. geom_point(data = ieeg_dot_df, aes(x = factor(block), y = average_dots_per_block), color = "#FB6087", fill = 'darkgrey', size = 2, shape = 23) +
  213. theme(panel.background = element_rect(fill = "white"),
  214. legend.position = "none",
  215. axis.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  216. axis.title = element_text(family = "Gill Sans", color = "#2D2327", size = 11),
  217. legend.title = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  218. legend.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  219. strip.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  220. plot.title = element_text(family = "Gill Sans", color = "#2D2327", size = 12, margin = margin(b = 5)),
  221. plot.subtitle = element_text(family = "Gill Sans", color = "#2D2327", size = 11, margin = margin(b = 0))) +
  222. labs(subtitle = "Participants balanced the rewards against the risks by\ncollecting most, but not all, of the reward on a given trial",
  223. x = "Block (each block consists of twenty trials)", y = "Average dots collected\n") +
  224. ggtitle("Average reward collected across blocks")
  225. ggsave(path(here(), "figures", "behavior", "figure1_dots_plot.png"),
  226. plot = dots_plot, width = 4.5, height = 4, dpi = 600)
  227. ```
  228. ## Turning Distance Plot
  229. ```{r last_away_min_dist, warning=F, fig.width=9, fig.height=4.5, echo = F}
  230. # last away #
  231. last_away_df_prolific <- game_data_distance %>%
  232. # filters #
  233. filter(case != "ieeg") %>%
  234. filter(number_of_runs > 0) %>%
  235. # distinct #
  236. select(trial_numeric, subject, last_away, case) %>%
  237. distinct() %>%
  238. filter(subject %in% sample(subject, 15))
  239. last_away_df_ieeg <- game_data_distance %>%
  240. # filters #
  241. filter(case == "ieeg") %>%
  242. filter(number_of_runs > 0) %>%
  243. # distinct #
  244. select(trial_numeric, subject, last_away, case) %>%
  245. distinct() %>%
  246. filter(subject %in% sample(subject, 4))
  247. last_away_df <- bind_rows(last_away_df_prolific, last_away_df_ieeg)
  248. last_away_plot <- last_away_df %>%
  249. mutate(ieeg = if_else(case == "ieeg", "iEEG", "Prolific")) %>%
  250. arrange(desc(case)) %>%
  251. mutate(subject = factor(subject)) %>%
  252. ggplot(., aes(x = subject, y = last_away)) +
  253. geom_jitter(alpha = .5, color = "grey", size = 1) +
  254. geom_boxplot(aes(fill = ieeg), notch = T, show.legend = F) +
  255. geom_vline(xintercept = 4.5, color = "darkgrey") +
  256. ylab("Distance to ghost at turnaround (game units, max = 180)") + xlab("\n") +
  257. theme(panel.background = element_rect(fill = "white"),
  258. legend.position = "top",
  259. axis.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  260. axis.title = element_text(family = "Gill Sans", color = "#2D2327", size = 11),
  261. legend.title = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  262. legend.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  263. strip.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  264. plot.title = element_text(family = "Gill Sans", color = "#2D2327", size = 12, margin = margin(b = 5)),
  265. plot.subtitle = element_text(family = "Gill Sans", color = "#2D2327", size = 11, margin = margin(b = 0)),
  266. axis.ticks.x = element_blank(),
  267. axis.text.x = element_blank()) +
  268. scale_fill_manual(values = c("#B9DFD5", "#61BBA5")) +
  269. ggtitle("Variability in risk tolerance", subtitle = "Random sample of 20 participants shows across- and within- subject\nvariability in the degree of risk incurred on a given trial")
  270. last_away_plot
  271. ggsave(path(here(), "figures", "behavior", "figure1_last_away_plot.png"),
  272. plot = last_away_plot, width = 4.5, height = 4, dpi = 600)
  273. ```
  274. ## Turning Distance vs Last Reward Plot
  275. ```{r df-reward-turning-distance}
  276. turn_reward_df <- game_data_distance %>%
  277. select(reward_groups, last_away, trial_numeric, subject, case) %>%
  278. filter(last_away != 0) %>%
  279. mutate(large_reward = if_else(reward_groups %in% c(3, 4), "Large", "Small")) %>%
  280. select(-reward_groups) %>%
  281. distinct() %>%
  282. group_by(large_reward, subject) %>%
  283. mutate(avg_last_away = mean(last_away)) %>%
  284. ungroup() %>%
  285. mutate(last_away = scale(last_away)) %>%
  286. mutate(avg_last_away = scale(avg_last_away)) %>%
  287. mutate(ieeg = if_else(case == "ieeg", "iEEG", "Online"))
  288. ```
  289. ```{r}
  290. # Set the number of cores for parallel processing
  291. options(mc.cores = parallel::detectCores(), backend = "cmdstanr")
  292. # set the priors #
  293. priors <- c(
  294. prior(normal(0, 5), class = "Intercept"), # Prior for the intercept
  295. prior(normal(0, 2), class = "b"), # Prior for fixed effects
  296. prior(exponential(1), class = "sd"), # Prior for random effects standard deviations
  297. prior(lkj(2), class = "cor") # Prior for random effects correlations
  298. )
  299. # Fit the model
  300. behave_model <- brm(
  301. formula = last_away ~ large_reward + (1 + large_reward | subject),
  302. data = turn_reward_df,
  303. prior = priors,
  304. family = gaussian(),
  305. iter = 4000,
  306. warmup = 1000,
  307. chains = 4,
  308. control = list(adapt_delta = 0.99),
  309. seed = 1234
  310. )
  311. summary(behave_model)
  312. save(behave_model, file = path(here(), "results", "behave_turn_distance_reward_model.RData"))
  313. ```
  314. ```{r plot-reward-turning-dist, fig.height = 7, fig.width = 9}
  315. turn_reward_plot <- turn_reward_df %>%
  316. select(avg_last_away, subject, large_reward, ieeg) %>%
  317. distinct() %>%
  318. ggplot(., aes(x = large_reward, y = avg_last_away)) +
  319. geom_hline(yintercept = 0, color = "#2D2327", linetype = "dashed", size = 1) +
  320. geom_point(aes(color = ieeg)) +
  321. geom_line(aes(alpha = ieeg, group = subject, color = ieeg, size = ieeg)) +
  322. geom_boxplot(aes(fill = large_reward), notch = T, show.legend = F, color = "#2D2327", alpha = .9) +
  323. ylim(-1.25, 1.25) +
  324. coord_flip() +
  325. theme(panel.background = element_rect(fill = "white"),
  326. legend.position = c(.85, 1),
  327. legend.direction = 'horizontal',
  328. axis.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  329. axis.title = element_text(family = "Gill Sans", color = "#2D2327", size = 12),
  330. legend.title = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  331. legend.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  332. strip.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  333. plot.title = element_text(family = "Gill Sans", color = "#2D2327", size = 12, margin = margin(b = 5)),
  334. plot.subtitle = element_text(family = "Gill Sans", color = "#2D2327", size = 11, margin = margin(b = 0))) +
  335. scale_fill_manual(values = c("#31ABED", "#A1D9F7")) +
  336. scale_color_manual(values = c("black", "darkgrey")) +
  337. scale_alpha_manual(values = c(1, 0.75), guide = F) +
  338. scale_size_manual(values = c(1, .25), guide = F) +
  339. labs(x = "Last Reward", y = "\nDistance to ghost at turnaround, scaled (a.u.)", color = "", title = "Turnaround Distance by Reward Groups", subtitle =
  340. "Participants were willing to get closer to the ghost when the\nlast reward was large")
  341. turn_reward_plot
  342. ggsave(path(here(), "figures", "behavior", "figure1_turnaround_reward_plot.png"),
  343. plot = turn_reward_plot, width = 5, height = 3.9, dpi = 600)
  344. ```
  345. ## Face Validity Plot
  346. ```{r plot-phenom}
  347. expected_options <- c("Stress", "Hope", "Bordeom", "Anxiety", "Excitement", "Disinterest", "Anger", "Suspense", "Frustration", "Other")
  348. reported_options <- behave_data %>%
  349. select(subject, starts_with("pilot_5")) %>%
  350. pivot_longer(cols = starts_with("pilot"), values_to = "experienced", names_to = "emotion") %>%
  351. pull(experienced) %>%
  352. unique()
  353. other_options <- reported_options[(!reported_options %in% expected_options) & !grepl(",", reported_options)]
  354. phenom_df <- behave_data %>%
  355. select(subject, starts_with("pilot_5")) %>%
  356. pivot_longer(cols = starts_with("pilot"), values_to = "experienced", names_to = "emotion") %>%
  357. group_by(subject) %>%
  358. mutate(stress = if_else(any(grepl("Stress", experienced)), 1, 0)) %>%
  359. mutate(hope = if_else(any(grepl("Hope", experienced)), 1, 0)) %>%
  360. mutate(boredom = if_else(any(grepl("Boredom", experienced)), 1, 0)) %>%
  361. mutate(anxiety = if_else(any(grepl("Anxiety", experienced)), 1, 0)) %>%
  362. mutate(excited = if_else(any(grepl("Excitement", experienced)), 1, 0)) %>%
  363. mutate(disinterest = if_else(any(grepl("Disinterest", experienced)), 1, 0)) %>%
  364. mutate(anger = if_else(any(grepl("Anger", experienced)), 1, 0)) %>%
  365. mutate(suspense = if_else(any(grepl("Suspense", experienced)), 1, 0)) %>%
  366. mutate(frustration = if_else(any(grepl("Frustration", experienced)), 1, 0)) %>%
  367. mutate(fear = if_else(any(grepl("fear", experienced, ignore.case = T)), 1, 0)) %>%
  368. mutate(nostalgia = if_else(any(grepl("nostalgia", experienced, ignore.case = T)), 1, 0)) %>%
  369. select(-emotion, -experienced) %>%
  370. distinct() %>%
  371. ungroup()
  372. experienced_plot <- phenom_df %>%
  373. pivot_longer(cols = -subject, values_to = "experienced", names_to = "emotion") %>%
  374. group_by(emotion) %>%
  375. summarize(count = sum(experienced)) %>%
  376. mutate(count = 100 * count / length(unique(behave_data$subject))) %>%
  377. ggplot(., aes(x = emotion, y = count, fill = emotion)) +
  378. geom_col(alpha = .8, color = "black") +
  379. xlab("") +
  380. ylab("Percent of Online Participants (n = 191)") +
  381. theme(panel.background = element_rect(fill = "white"),
  382. legend.position = "none",
  383. plot.margin = margin(t = 1, r = 1, b = 1, l = 1),
  384. axis.title = element_text(family = "Gill Sans", color = "#2D2327", size = 11),
  385. legend.title = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  386. legend.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  387. strip.text = element_text(family = "Gill Sans", color = "#2D2327", size = 10),
  388. plot.subtitle = element_text(family = "Gill Sans", color = "#2D2327", size = 11, margin = margin(b = 0)),
  389. plot.title = element_text(family = "Gill Sans", color = "#2D2327", size = 12, margin = margin(b = 5)),
  390. axis.text = element_text(family = "Gill Sans", color = '#2D2327', size = 11, angle = 45, vjust = 1, hjust = 1)) +
  391. ggtitle("Emotional experience during the task", subtitle = "Responses to: 'What did you experience when the ghost was\nclose to catching you?'") +
  392. scale_fill_carto_d(palette = "Prism")
  393. experienced_plot
  394. ggsave(path(here(), "figures", "behavior", "figure1_experienced_emotions_plot.png"),
  395. plot = experienced_plot, width = 4.5, height = 3.9, dpi = 600)
  396. ```

figure_1_behave_plots.Rmd at commit fff4ed4, no license · at the source

Overview

14 affiliations
  1. Helen Wills Neuroscience Institute, University of California, Berkeley, CA USA
  2. Departments of Psychology and Neuroscience, University of California, Berkeley, CA USA
  3. Department of Psychology, Harvard University, Cambridge, MA USA
  4. School of Psychological Sciences, Victoria University of Wellington, Wellington, New Zealand
  5. Department of Neurosciences, University of California, San Diego, CA USA
  6. Division of Neurology, Rady Children’s Hospital, San Diego, CA USA
  7. Department of Neurosurgery, Washington University School of Medicine, St. Louis, MO USA
  8. National Center for Adaptive Neurotechnologies, Albany, NY USA
  9. Department of Neurology, Loma Linda University, Loma Linda, CA USA
  10. Department of Neurology, University of California, Davis, CA USA
  11. Center for Mind and Brain, University of California, Davis, CA USA
  12. Departments of Medical Social Sciences, Pediatrics, and Psychology, Northwestern University, Evanston, IL USA
  13. Department of Neurological Surgery, University of California, Irvine, CA USA
  14. Haas School of Business, University of California, Berkeley, CA USA
Journal: Nature communications, volume 17, issue 1, article 3867
Dates: received 18 March 2025; accepted 24 February 2026; published online 12 March 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41467-026-70287-5 · PMID 41820348 · PMCID PMC13125241 · OpenAlex W7135061359
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: EEG (modality), human (organism), epilepsy (population)
Methods: Spectral & time-frequency, Preprocessing, Connectivity, Statistics, Machine learning, Physiology & signal measures
Keywords: Cognitive control, Motivation, Neural circuits, Limbic system, Prefrontal cortex
MeSH: Avoidance Learning*, Conflict, Psychological*, Limbic System*, Prefrontal Cortex*, Adult, Amygdala, Decision Making, Electroencephalography, Epilepsy, Female, Gyrus Cinguli, Hippocampus, Humans, Male, Theta Rhythm, Young Adult (* major topic)
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: U.S. Department of Health & Human Services | NIH | National Institute of Neurological Disorders and Stroke (NINDS) (R01 NS-021135); U.S. Department of Health &amp; Human Services | NIH | National Institute of Neurological Disorders and Stroke (R01 NS-021135); National Science Foundation (GRFP)
Citations: not cited yet (Europe PMC); 82 references in the paper

Abstract

Choosing to approach or avoid is common in everyday life and excessive avoidance is a cardinal feature of anxiety disorders. We use intracranial EEG to define a prefrontal-limbic circuit supporting approach and avoidance. Presurgical epilepsy patients (n = 20) performed an approach-avoidance conflict decision-making task inspired by the arcade game Pac-Man, where patients trade off rewards against losses from ghost attack. During approach, theta power increases across a limbic circuit including the hippocampus, amygdala, orbitofrontal cortex and anterior cingulate cortex, which drops during avoidance. Theta connectivity between this circuit and lateral prefrontal cortex increases during approach and falls during avoidance. Network connectivity tracks how long patients approach, with enhanced synchronicity extending approach times. During imminent threat, the system switches to sustained increase in high-frequency activity in the lateral prefrontal cortex. The results provide evidence of a distributed prefrontal-limbic circuit, mediated by theta oscillations and high frequency activity, underlying approach-avoidance conflict in humans.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 10 matches between paragraphs and lines of code.

Zenodo 17727554

License: CC-BY-4.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
At the source:

Zenodo 17727552

License: CC-BY-4.0
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (72 files), ggplot2 (67 files), survival (43 files), lme4 (41 files), easystats (39 files), brms (34 files), lmerTest (20 files), broom (15 files), caret (14 files)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
88 files
At the source:

Zenodo 22255210

License: MIT
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: DataCite
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (18 files), SciPy (14 files), Matplotlib (1 file), pandas (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
23 files

morrocwi/rrhm-open-lab

License: MIT
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 16b5e09acf62e8e39adb1d5d309be1065d1aef2a, 2 September 2026
Languages: Python (21)
Size: 62 files, 21 scripts
Software Heritage: not archived
Found in: DataCite
Holds: README, license file, documentation
Not found: CITATION.cff, environment file, tests, continuous integration
Tools: NumPy (18 files), SciPy (14 files), Matplotlib (1 file), pandas (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
23 files

Zenodo 22255211

License: MIT
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: DataCite
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (18 files), SciPy (14 files), Matplotlib (1 file), pandas (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
  • 30 September 2026: the link answers (HTTP 200)
23 files

bstavel/staveland_et_al_pacman_statistics_and_behavior

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: fff4ed4fa6739d03b0ce04b12ad81da44dc4bbd4, 23 September 2025
Languages: R (86), MATLAB (1)
Size: 101 files, 87 scripts
Software Heritage: not archived
Found in: the Zenodo archive record
Holds: README, 60 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (72 files), ggplot2 (67 files), survival (43 files), lme4 (41 files), easystats (39 files), brms (34 files), lmerTest (20 files), broom (15 files), caret (14 files)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
88 files

bstavel/staveland_et_al_pacman_neural_analyses

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: 771193ae616f6126aa58d4592dfca4fac893115f, 23 September 2025
Languages: Jupyter (237), Python (32), Shell (1)
Size: 276 files, 270 scripts
Software Heritage: not archived
Found in: the Zenodo archive record
Holds: README, environment (requirements.txt), 234 notebooks
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: Matplotlib (8 files), NumPy (8 files), pandas (8 files), MNE-Python (5 files), seaborn (5 files), statsmodels (5 files), SciPy (4 files), NiBabel (3 files), Nilearn (3 files), NeuroDSP (1 file), specparam (formerly FOOOF) (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
10 files

Code availability

Original code is deposited on Zenodo and for public download. Original code is comprised of two GitHub repos: Staveland_et_al_Pacman_Neural_Analyses (10.5281/zenodo.17727554) and Staveland_et_al_Pacman_Statistics_and_Behavior (10.5281/zenodo.17727552).

Reproduced under the paper's license (CC BY), from the paper cited above.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 7 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 246 scripts, each with its path and the digest of its content;
  • 10 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

The cleaned, minimally-processed, patient-level data generated in this study have been deposited in the Zenodo database under accession (https://zenodo.org/records/17726565). The data used to generate each figure in this study are provided in the Source Data file. Source data are provided with this paper.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 13 authors, 5 keywords, 16 MeSH terms, 3 funders, 74 references.

Cite

This paper

Staveland, B. R., Oberschulte, J., Berger, B., Minarik, T., Kim-McManus, O., Willie, J. T., Brunner, P., Dastjerdi, M., Lin, J. J., Johnson, E. L., Paff, M., Hsu, M., & Knight, R. T. (2026). Cortical-limbic circuit dynamics of approach-avoidance conflict in humans. Nature communications, 17(1), 3867. https://doi.org/10.1038/s41467-026-70287-5

BibTeX

@article{staveland2026cortical,
author = {Staveland, Brooke R and Oberschulte, Julia and Berger, Barbara and Minarik, Tamas and Kim-McManus, Olivia and Willie, Jon T and Brunner, Peter and Dastjerdi, Mohammad and Lin, Jack J and Johnson, Elizabeth L and Paff, Michelle and Hsu, Ming and Knight, Robert T},
title = {{Cortical-limbic circuit dynamics of approach-avoidance conflict in humans}},
journal = {Nature communications},
year = {2026},
month = mar,
volume = {17},
number = {1},
pages = {3867},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-70287-5},
url = {https://doi.org/10.1038/s41467-026-70287-5},
pmid = {41820348},
pmcid = {PMC13125241}
}

RIS

TY - JOUR
AU - Staveland, Brooke R
AU - Oberschulte, Julia
AU - Berger, Barbara
AU - Minarik, Tamas
AU - Kim-McManus, Olivia
AU - Willie, Jon T
AU - Brunner, Peter
AU - Dastjerdi, Mohammad
AU - Lin, Jack J
AU - Johnson, Elizabeth L
AU - Paff, Michelle
AU - Hsu, Ming
AU - Knight, Robert T
TI - Cortical-limbic circuit dynamics of approach-avoidance conflict in humans
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/03/12
VL - 17
IS - 1
SP - 3867
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-70287-5
UR - https://doi.org/10.1038/s41467-026-70287-5
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-70287-5",
"type": "article-journal",
"title": "Cortical-limbic circuit dynamics of approach-avoidance conflict in humans",
"container-title": "Nature communications",
"author": [
{
"family": "Staveland",
"given": "Brooke R"
},
{
"family": "Oberschulte",
"given": "Julia"
},
{
"family": "Berger",
"given": "Barbara"
},
{
"family": "Minarik",
"given": "Tamas"
},
{
"family": "Kim-McManus",
"given": "Olivia"
},
{
"family": "Willie",
"given": "Jon T"
},
{
"family": "Brunner",
"given": "Peter"
},
{
"family": "Dastjerdi",
"given": "Mohammad"
},
{
"family": "Lin",
"given": "Jack J"
},
{
"family": "Johnson",
"given": "Elizabeth L"
},
{
"family": "Paff",
"given": "Michelle"
},
{
"family": "Hsu",
"given": "Ming"
},
{
"family": "Knight",
"given": "Robert T"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "3867",
"DOI": "10.1038/s41467-026-70287-5",
"PMID": "41820348",
"PMCID": "PMC13125241",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-70287-5",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
12
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1093/cercor/bhag113 [code]
Long-term reliability and stability of parameterized resting state EEG: evidence from a five-year follow-up.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: NeuroDSP, specparam (formerly FOOOF), easystats, 11 other tools, EEG, 1 reference
[2] doi:10.1093/nc/niag029 [code]
A data-driven approach to identifying and evaluating connectivity-based neural correlates of conscious visual perception.
Journal: Neuroscience of consciousness
In common: easystats, broom, MNE-Python, 11 other tools, 1 reference
[3] doi:10.1038/s42003-026-10270-4 [code]
Direct electrical stimulation of the human amygdala enhances recognition memory for objects but not scenes.
Journal: Communications biology
In common: MNE-Python, seaborn, pandas, 3 other tools, 1 reference, 2 authors
[4] doi:10.1162/imag.a.1245 [code]
Towards precision EEG connectomics: Evaluating the benefits of dense sampling.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: MNE-Python, lmerTest, Nilearn, 10 other tools, EEG, 2 references
[5] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: brms, survival, caret, 10 other tools
[6] doi:10.1371/journal.pbio.3003666 [code]
Emotion regulation success involves systematic gradient-based reconfigurations of large-scale activation patterns in the human brain.
Journal: PLoS biology
In common: easystats, lmerTest, Nilearn, 10 other tools, 1 reference
[7] doi:10.1162/imag.a.1321 [code]
Phase similarity between similar objects indicates representational merging across retrieval training but not sleep.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: easystats, broom, MNE-Python, 10 other tools, EEG
[8] doi:10.1016/j.nicl.2026.104012 [code]
Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.
Journal: NeuroImage. Clinical
In common: specparam (formerly FOOOF), survival, lmerTest, 10 other tools
[9] doi:10.34133/csbj.0042 [code]
Using Steady-State Visual Evoked Potentials to Characterize Wide-Ranging Retinopathy Linked to &lt;i&gt;CRB1&lt;/i&gt;: Implications for Clinical Trials.
Journal: Computational and structural biotechnology journal
In common: easystats, MNE-Python, lmerTest, 9 other tools, EEG, 1 reference
[10] doi:10.1038/s41597-026-07350-9 [code]
An open multi-center MEG-EEG dataset for studying conscious visual perception.
Journal: Scientific data
In common: easystats, MNE-Python, lmerTest, 10 other tools, EEG

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.