OSCR

Functional specialization of angular gyrus and precuneus subregions for perspective-guided autobiographical memory retrieval.

Code ↔ Paper

1 match 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.

One block of code here has a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 1 match
  1. [1] § Materials and Methods › fMRI analysis › Region of interest (ROI) analysis ↔ DataScripts/PosteriorParietalROISubregions_RetrievalOrientation.R, lines 1 to 58 · score 0.59 · JuBrain, posterior parietal, signal change, subregions, ROI, hemispheres · block oscr:b:VTFG57FBBXPZV-J · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 1,111 lines · 37 KB · no license · 1 match

  1. #Load libraries
  2. library(readxl)
  3. library(tidyverse)
  4. library(stringr)
  5. library(afex)
  6. library(emmeans)
  7. library(DescTools)
  8. library(patchwork)
  9. library(ggsignif)
  10. library(effectsize)
  11. library(grid)
  12. # STEP 1: Load the new data file
  13. df_wide <- read_excel("~/Library/CloudStorage/[email hidden]/Shared drives/MELab/Projects/RetrievalOrientation/Results/ROI/JuBrain/PosteriorParietalSubregionROISignalChange_RetrievalOrientation.xlsx")
  14. # STEP 2: Convert wide to long format and extract variables
  15. df_long <- df_wide %>%
  16. pivot_longer(
  17. cols = -ID,
  18. names_to = "Condition",
  19. values_to = "Activation"
  20. ) %>%
  21. mutate(
  22. ID = as.factor(ID),
  23. Phase = case_when(
  24. str_detect(Condition, "^Cue") ~ "Cue",
  25. str_detect(Condition, "^Probe") ~ "Probe",
  26. TRUE ~ NA_character_
  27. ),
  28. RetrievalOrientation = case_when(
  29. str_detect(Condition, "OE") ~ "OwnEyes",
  30. str_detect(Condition, "OB") ~ "Observer",
  31. str_detect(Condition, "Ret") ~ "Retrieve",
  32. TRUE ~ NA_character_
  33. ),
  34. Hemisphere = case_when(
  35. str_detect(Condition, "Left") ~ "Left",
  36. str_detect(Condition, "Right") ~ "Right",
  37. TRUE ~ NA_character_
  38. ),
  39. Region = case_when(
  40. str_detect(Condition, "PGa") ~ "PGa",
  41. str_detect(Condition, "PGp") ~ "PGp",
  42. str_detect(Condition, "7A") ~ "7A",
  43. str_detect(Condition, "7M") ~ "7M",
  44. str_detect(Condition, "7P") ~ "7P",
  45. TRUE ~ NA_character_
  46. )
  47. ) %>%
  48. filter(!is.na(Phase)) %>%
  49. mutate(
  50. RetrievalOrientation = factor(RetrievalOrientation, levels = c("OwnEyes", "Observer", "Retrieve")),
  51. Hemisphere = factor(Hemisphere),
  52. Region = factor(Region),
  53. Phase = factor(Phase, levels = c("Cue", "Probe"))
  54. )
  55. view(df_long)
  56. # NEW FUNCTION
  57. run_roi_orientation_interaction <- function(df, hemisphere, phase, roi_group) {
  58. message("\n===== ", hemisphere, " Hemisphere — ", phase, " Phase — ROIs: ", paste(roi_group, collapse = ", "), " =====")
  59. df_subset <- df %>%
  60. filter(Hemisphere == hemisphere, Phase == phase, Region %in% roi_group)
  61. aov_model <- aov_ez(
  62. id = "ID",
  63. dv = "Activation",
  64. within = c("RetrievalOrientation", "Region"),
  65. data = df_subset,
  66. anova_table = list(correction = "GG", es = "pes")
  67. )
  68. print(summary(aov_model))
  69. # Optional: Post hoc for RetrievalOrientation within Region
  70. em <- emmeans(aov_model, ~ RetrievalOrientation | Region)
  71. print("\nEstimated marginal means for RetrievalOrientation:")
  72. print(summary(em))
  73. return(aov_model)
  74. }
  75. ################# Angular Gyrus ############################################
  76. ##### CUE PHASE ##########
  77. ###LEFT AG###
  78. results_left_cue_AG <- run_roi_orientation_interaction(df_long, "Left", "Cue", c("PGp", "PGa"))
  79. eta_squared(results_left_cue_AG, partial = TRUE)
  80. # Region x Retrieval Orientation Interaction
  81. em_intrxn <- emmeans(results_left_cue_AG, ~ RetrievalOrientation | Region)
  82. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  83. print(contrast_results)
  84. em_summary <- summary(em_intrxn)
  85. em_summary$SD <- em_summary$SE * sqrt(30)
  86. print(em_summary)
  87. ### RIGHT AG###
  88. results_right_cue_AG <- run_roi_orientation_interaction(df_long, "Right", "Cue", c("PGp", "PGa"))
  89. eta_squared(results_right_cue_AG, partial = TRUE)
  90. # Region x Retrieval Orientation Interaction
  91. em_intrxn <- emmeans(results_right_cue_AG, ~ RetrievalOrientation | Region)
  92. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  93. print(contrast_results)
  94. em_summary <- summary(em_intrxn)
  95. em_summary$SD <- em_summary$SE * sqrt(30)
  96. print(em_summary)
  97. #Main effect of Region
  98. em_region <- emmeans(results_right_cue_AG, ~ Region)
  99. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  100. print(contrast_region)
  101. em_summary <- summary(em_region)
  102. em_summary$SD <- em_summary$SE * sqrt(30)
  103. print(em_summary)
  104. ##### Probe PHASE ##########
  105. ###LEFT AG###
  106. results_left_probe_AG <- run_roi_orientation_interaction(df_long, "Left", "Probe", c("PGp", "PGa"))
  107. eta_squared(results_left_probe_AG, partial = TRUE)
  108. #Main effect of Region
  109. em_region <- emmeans(results_left_probe_AG, ~ Region)
  110. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  111. print(contrast_region)
  112. em_summary <- summary(em_region)
  113. em_summary$SD <- em_summary$SE * sqrt(30)
  114. print(em_summary)
  115. #Main effect of Retrieval Orientation
  116. em_retorient <- emmeans(results_left_probe_AG, ~ RetrievalOrientation)
  117. contrast_retorient <- contrast(em_retorient, method = "pairwise", adjust = "holm")
  118. print(contrast_retorient)
  119. em_summary <- summary(em_retorient)
  120. em_summary$SD <- em_summary$SE * sqrt(30)
  121. print(em_summary)
  122. # Region x Retrieval Orientation Interaction
  123. em_intrxn <- emmeans(results_left_probe_AG, ~ RetrievalOrientation | Region)
  124. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  125. print(contrast_results)
  126. em_summary <- summary(em_intrxn)
  127. em_summary$SD <- em_summary$SE * sqrt(30)
  128. print(em_summary)
  129. ### RIGHT AG###
  130. results_right_probe_AG <- run_roi_orientation_interaction(df_long, "Right", "Probe", c("PGp", "PGa"))
  131. eta_squared(results_right_probe_AG, partial = TRUE)
  132. #Main effect of Region
  133. em_region <- emmeans(results_right_probe_AG, ~ Region)
  134. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  135. print(contrast_region)
  136. em_summary <- summary(em_region)
  137. em_summary$SD <- em_summary$SE * sqrt(30)
  138. print(em_summary)
  139. #Main effect of Retrieval Orientation
  140. em_retorient <- emmeans(results_right_probe_AG, ~ RetrievalOrientation)
  141. contrast_retorient <- contrast(em_retorient, method = "pairwise", adjust = "holm")
  142. print(contrast_retorient)
  143. em_summary <- summary(em_retorient)
  144. em_summary$SD <- em_summary$SE * sqrt(30)
  145. print(em_summary)
  146. ################# Precuneus ############################################
  147. ##### CUE PHASE ##########
  148. ###LEFT PRECUNEUS###
  149. results_left_cue_precuneus <- run_roi_orientation_interaction(df_long, "Left", "Cue", c("7A", "7M", "7P"))
  150. eta_squared(results_left_cue_precuneus, partial = TRUE)
  151. #Main Effect of Region
  152. em_region <- emmeans(results_left_cue_precuneus, ~ Region)
  153. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  154. print(contrast_region)
  155. em_summary <- summary(em_region)
  156. em_summary$SD <- em_summary$SE * sqrt(30)
  157. print(em_summary)
  158. #Main effect of Retrieval Orientation
  159. em_retorient <- emmeans(results_left_cue_precuneus, ~ RetrievalOrientation)
  160. contrast_retorient <- contrast(em_retorient, method = "pairwise", adjust = "holm")
  161. print(contrast_retorient)
  162. em_summary <- summary(em_retorient)
  163. em_summary$SD <- em_summary$SE * sqrt(30)
  164. print(em_summary)
  165. ###RIGHT Precuneus###
  166. results_right_cue_precuneus <- run_roi_orientation_interaction(df_long, "Right", "Cue", c("7A", "7M", "7P"))
  167. eta_squared(results_right_cue_precuneus, partial = TRUE)
  168. #Main effect of Region
  169. em_region <- emmeans(results_right_cue_precuneus, ~ Region)
  170. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  171. print(contrast_region)
  172. em_summary <- summary(em_region)
  173. em_summary$SD <- em_summary$SE * sqrt(30)
  174. print(em_summary)
  175. #Main effect of Retrieval Orientation
  176. em_retorient <- emmeans(results_right_cue_precuneus, ~ RetrievalOrientation)
  177. contrast_retorient <- contrast(em_retorient, method = "pairwise", adjust = "holm")
  178. print(contrast_retorient)
  179. em_summary <- summary(em_retorient)
  180. em_summary$SD <- em_summary$SE * sqrt(30)
  181. print(em_summary)
  182. ############################################
  183. ###################### PROBE PHASE ##########
  184. ###LEFT PRECUNEUS###
  185. results_left_probe_precuneus <- run_roi_orientation_interaction(df_long, "Left", "Probe", c("7A", "7M", "7P"))
  186. eta_squared(results_left_probe_precuneus, partial = TRUE)
  187. #Main effect of Region
  188. em_region <- emmeans(results_left_probe_precuneus, ~ Region)
  189. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  190. print(contrast_region)
  191. em_summary <- summary(em_region)
  192. em_summary$SD <- em_summary$SE * sqrt(30)
  193. print(em_summary)
  194. #Main effect of Retrieval Orientation
  195. em_retorient <- emmeans(results_left_probe_precuneus, ~ RetrievalOrientation)
  196. contrast_retorient <- contrast(em_retorient, method = "pairwise", adjust = "holm")
  197. print(contrast_retorient)
  198. em_summary <- summary(em_retorient)
  199. em_summary$SD <- em_summary$SE * sqrt(30)
  200. print(em_summary)
  201. # Region x Retrieval Orientation Interaction
  202. em_intrxn <- emmeans(results_left_probe_precuneus, ~ RetrievalOrientation | Region)
  203. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  204. print(contrast_results)
  205. em_summary <- summary(em_intrxn)
  206. em_summary$SD <- em_summary$SE * sqrt(30)
  207. print(em_summary)
  208. ###RIGHT PRECUNEUS###
  209. results_right_probe_precuneus <- run_roi_orientation_interaction(df_long, "Right", "Probe", c("7A", "7M", "7P"))
  210. eta_squared(results_right_probe_precuneus, partial = TRUE)
  211. #Main effect of Region
  212. em_region <- emmeans(results_right_probe_precuneus, ~ Region)
  213. contrast_region <- contrast(em_region, method = "pairwise", adjust = "holm")
  214. print(contrast_region)
  215. em_summary <- summary(em_region)
  216. em_summary$SD <- em_summary$SE * sqrt(30)
  217. print(em_summary)
  218. # Region x Retrieval Orientation Interaction
  219. em_intrxn <- emmeans(results_right_probe_precuneus, ~ RetrievalOrientation | Region)
  220. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  221. print(contrast_results)
  222. em_summary <- summary(em_intrxn)
  223. em_summary$SD <- em_summary$SE * sqrt(30)
  224. print(em_summary)
  225. em_intrxn <- emmeans(results_right_probe_precuneus, ~ Region | RetrievalOrientation)
  226. contrast_results <- contrast(em_intrxn, method = "pairwise", adjust = "holm")
  227. print(contrast_results)
  228. ########################################
  229. ######### Figures ################
  230. palette_by_orientation <- c(
  231. "OwnEyes" = "#1F78B4",
  232. "Observer" = "#A6CEE3",
  233. "Retrieve" = "gray45"
  234. )
  235. #### Angular Gyrus #######
  236. plot_AG_by_region_phase <- function(df, region_name, phase_name, title_text, pal, show_y_label = TRUE, y_limits, y_breaks, y_expand) {
  237. df_sub <- df %>%
  238. filter(
  239. Phase == phase_name,
  240. Hemisphere == "Left",
  241. Region == region_name,
  242. RetrievalOrientation %in% c("OwnEyes", "Observer", "Retrieve")
  243. ) %>%
  244. mutate(
  245. Orientation = factor(RetrievalOrientation, levels = c("OwnEyes", "Observer", "Retrieve"))
  246. )
  247. # summary_df <- df_sub %>%
  248. # group_by(Orientation) %>%
  249. # summarise(
  250. # mean = mean(Activation, na.rm = TRUE),
  251. # se = sd(Activation, na.rm = TRUE) / sqrt(n()),
  252. # n = n(),
  253. # .groups = "drop"
  254. # ) %>%
  255. # mutate(
  256. # ci_lower = mean - 1.96 * se,
  257. # ci_upper = mean + 1.96 * se
  258. # )
  259. # Use your within-subjects variables
  260. df_summary <- Rmisc::summarySEwithin(
  261. data = df_sub,
  262. measurevar = "Activation",
  263. withinvars = "Orientation",
  264. idvar = "ID", # change to your actual subject ID column
  265. na.rm = TRUE,
  266. conf.interval = .95
  267. )
  268. plot <- ggplot(df_summary, aes(x = Orientation, y = Activation, fill = Orientation)) +
  269. geom_col(width = 0.7, color = "black") +
  270. geom_errorbar(
  271. #aes(ymin = ci_lower, ymax = ci_upper),
  272. aes(ymin = Activation - ci, ymax = Activation + ci),
  273. width = 0.2,
  274. size = 0.8,
  275. color = "black"
  276. ) +
  277. geom_hline(yintercept = 0, color = "black", linewidth = 0.8) +
  278. scale_fill_manual(values = pal) +
  279. scale_x_discrete(labels = c("OwnEyes" = "Own Eyes", "Observer" = "Observer", "Retrieve" = "Retrieve")) +
  280. scale_y_continuous(
  281. limits = y_limits,
  282. breaks = y_breaks,
  283. labels = function(x) sprintf("%.2f", x),
  284. expand = y_expand
  285. ) +
  286. labs(
  287. title = title_text,
  288. x = NULL,
  289. y = if (show_y_label) "% Signal Change" else NULL
  290. ) +
  291. theme(
  292. plot.background = element_rect(fill = "white"),
  293. panel.background = element_rect(fill = "white"),
  294. axis.line = element_line(color = "black"),
  295. axis.ticks = element_line(size = 1),
  296. axis.ticks.length = unit(0.25, "cm"),
  297. panel.border = element_rect(colour = "black", fill = NA, size = 1.25),
  298. legend.position = "none",
  299. text = element_text(size = 24, colour = "black", family = "Arial"),
  300. axis.text = element_text(size = 20, colour = "black"),
  301. axis.text.x = element_text(size = 20),
  302. axis.title.x = element_blank(),
  303. strip.text = element_text(size = 26, face = "bold"),
  304. strip.background = element_rect(fill = "white", color = NA),
  305. plot.title = element_text(size = 26, hjust = 0.5),
  306. plot.tag.position = c(0, 0.98), # top-left corner (x = 0 [left], y = 1 [top])
  307. plot.tag = element_text(size = 26), # customize style
  308. plot.margin = unit(c(0.25, 0.25, 0.25, 0.25), "lines")
  309. )
  310. if (region_name == "PGp" & phase_name == "Cue") {
  311. plot <- plot +
  312. geom_signif(
  313. comparisons = list(c("OwnEyes", "Retrieve"), c("Observer", "Retrieve")),
  314. annotations = c("*", "*"),
  315. y_position = c(0.12, 0.09),
  316. tip_length = 0.04,
  317. textsize = 8
  318. )
  319. theme(
  320. axis.title.y = element_blank(),
  321. axis.text.y = element_blank(),
  322. axis.ticks.y = element_blank()
  323. )
  324. }
  325. if (region_name == "PGa") {
  326. plot <- plot +
  327. theme(plot.margin = unit(c(1, 0.25, 1, 1), "lines"))
  328. }
  329. if (region_name == "PGp") {
  330. plot <- plot +
  331. theme(
  332. plot.margin = unit(c(1, 1, 1, 0.1), "lines"),
  333. axis.title.y = element_blank(),
  334. axis.text.y = element_blank(),
  335. axis.ticks.y = element_blank()
  336. )
  337. }
  338. if (region_name == "PGp" & phase_name == "Probe") {
  339. plot <- plot +
  340. geom_signif(
  341. comparisons = list(c("OwnEyes", "Observer"), c("Observer", "Retrieve")),
  342. annotations = c("*", "*"),
  343. y_position = c(0.55, 0.60),
  344. tip_length = 0.04,
  345. textsize = 8
  346. )
  347. theme(
  348. axis.title.y = element_blank(),
  349. axis.text.y = element_blank(),
  350. axis.ticks.y = element_blank()
  351. )
  352. }
  353. # Return the final plot
  354. return(plot)
  355. }
  356. # Cue phase plots
  357. p_pga_cue <- plot_AG_by_region_phase(df_long, "PGa", "Cue", "Left PGa", palette_by_orientation,show_y_label = TRUE, y_limits = c(-0.06, 0.15), y_breaks = c(-0.06, -0.03, 0, 0.03, 0.06, 0.09, 0.12, 0.15), y_expand = c(0.01, 0.01))
  358. p_pgp_cue <- plot_AG_by_region_phase(df_long, "PGp", "Cue", "Left PGp", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.06, 0.15), y_breaks = c(-0.06, -0.03, 0, 0.03, 0.06, 0.09, 0.12, 0.15), y_expand = c(0.01, 0.01))
  359. # Probe phase plots
  360. p_pga_probe <- plot_AG_by_region_phase(df_long, "PGa", "Probe", "Left PGa", palette_by_orientation, show_y_label = TRUE, y_limits = c(0, 0.75), y_breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7), y_expand = c(0, 0))
  361. p_pgp_probe <- plot_AG_by_region_phase(df_long, "PGp", "Probe", "Left PGp", palette_by_orientation, show_y_label = FALSE, y_limits = c(0, 0.75), y_breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7), y_expand = c(0, 0))
  362. # Step 0: Add tags to each individual plot
  363. p_pga_cue <- p_pga_cue + labs(tag = "A")
  364. p_pgp_cue <- p_pgp_cue + labs(tag = "B")
  365. p_pga_probe <- p_pga_probe + labs(tag = "C")
  366. p_pgp_probe <- p_pgp_probe + labs(tag = "D")
  367. p_pga_cue <- p_pga_cue +
  368. theme(plot.tag.position = c(0.155, 0.98))
  369. p_pga_probe <- p_pga_probe +
  370. theme(plot.tag.position = c(0.155, 0.98))
  371. p_pgp_cue <- p_pgp_cue +
  372. theme(plot.tag.position = c(0.02, 0.98))
  373. p_pgp_probe <- p_pgp_probe +
  374. theme(plot.tag.position = c(0.02, 0.98))
  375. cue_annotation <- wrap_elements(
  376. full = grid::textGrob(
  377. "Cue Phase: Region x Retrieval Orientation Interaction",
  378. x = unit(0, "npc"), just = "left",
  379. gp = gpar(fontsize = 24, fontface = "italic")
  380. )
  381. )
  382. probe_annotation <- wrap_elements(
  383. full = grid::textGrob(
  384. "Probe Phase: Region x Retrieval Orientation Interaction",
  385. x = unit(0, "npc"), just = "left",
  386. gp = gpar(fontsize = 24, fontface = "italic")
  387. )
  388. )
  389. combined_plot <- wrap_plots(
  390. cue_annotation,
  391. (p_pga_cue | p_pgp_cue),
  392. probe_annotation,
  393. (p_pga_probe | p_pgp_probe),
  394. ncol = 1,
  395. heights = c(0.08, 1, 0.08, 1)
  396. )
  397. combined_plot
  398. ggsave(
  399. filename = "Figure_LeftAG_Subregions_Combined.png", # or .tiff, .pdf
  400. plot = combined_plot,
  401. path = "~/Library/CloudStorage/[email hidden]/Shared drives/MELab/Projects/RetrievalOrientation/Results/ROI/",
  402. width = 12, # in inches
  403. height = 12, # in inches
  404. dpi = 600 # high-res for publication
  405. )
  406. ### Right AG ########
  407. plot_AG_by_region_phase <- function(df, region_name, phase_name, title_text, pal, show_y_label = TRUE, y_limits, y_breaks, y_expand) {
  408. df_sub <- df %>%
  409. filter(
  410. Phase == phase_name,
  411. Hemisphere == "Right",
  412. Region == region_name,
  413. RetrievalOrientation %in% c("OwnEyes", "Observer", "Retrieve")
  414. ) %>%
  415. mutate(
  416. Orientation = factor(RetrievalOrientation, levels = c("OwnEyes", "Observer", "Retrieve"))
  417. )
  418. # summary_df <- df_sub %>%
  419. # group_by(Orientation) %>%
  420. # summarise(
  421. # mean = mean(Activation, na.rm = TRUE),
  422. # se = sd(Activation, na.rm = TRUE) / sqrt(n()),
  423. # n = n(),
  424. # .groups = "drop"
  425. # ) %>%
  426. # mutate(
  427. # ci_lower = mean - 1.96 * se,
  428. # ci_upper = mean + 1.96 * se
  429. # )
  430. # Use your within-subjects variables
  431. df_summary <- Rmisc::summarySEwithin(
  432. data = df_sub,
  433. measurevar = "Activation",
  434. withinvars = "Orientation",
  435. idvar = "ID", # change to your actual subject ID column
  436. na.rm = TRUE,
  437. conf.interval = .95
  438. )
  439. plot <- ggplot(df_summary, aes(x = Orientation, y = Activation, fill = Orientation)) +
  440. geom_col(width = 0.7, color = "black") +
  441. geom_errorbar(
  442. #aes(ymin = ci_lower, ymax = ci_upper),
  443. aes(ymin = Activation - ci, ymax = Activation + ci),
  444. width = 0.2,
  445. size = 0.8,
  446. color = "black"
  447. ) +
  448. geom_hline(yintercept = 0, color = "black", linewidth = 0.8) +
  449. scale_fill_manual(values = pal) +
  450. scale_x_discrete(labels = c("OwnEyes" = "Own Eyes", "Observer" = "Observer", "Retrieve" = "Retrieve")) +
  451. scale_y_continuous(
  452. limits = y_limits,
  453. breaks = y_breaks,
  454. labels = function(x) sprintf("%.2f", x),
  455. expand = y_expand
  456. ) +
  457. labs(
  458. title = title_text,
  459. x = NULL,
  460. y = if (show_y_label) "% Signal Change" else NULL
  461. ) +
  462. theme(
  463. plot.background = element_rect(fill = "white"),
  464. panel.background = element_rect(fill = "white"),
  465. axis.line = element_line(color = "black"),
  466. axis.ticks = element_line(size = 1),
  467. axis.ticks.length = unit(0.25, "cm"),
  468. panel.border = element_rect(colour = "black", fill = NA, size = 1.25),
  469. legend.position = "none",
  470. text = element_text(size = 24, colour = "black", family = "Arial"),
  471. axis.text = element_text(size = 20, colour = "black"),
  472. axis.text.x = element_text(size = 20),
  473. axis.title.x = element_blank(),
  474. strip.text = element_text(size = 26, face = "bold"),
  475. strip.background = element_rect(fill = "white", color = NA),
  476. plot.title = element_text(size = 26, hjust = 0.5),
  477. plot.tag.position = c(0, 0.98), # top-left corner (x = 0 [left], y = 1 [top])
  478. plot.tag = element_text(size = 26), # customize style
  479. plot.margin = unit(c(0.25, 0.25, 0.25, 0.25), "lines")
  480. )
  481. if (region_name == "PGp" & phase_name == "Cue") {
  482. plot <- plot +
  483. theme(
  484. axis.title.y = element_blank(),
  485. axis.text.y = element_blank(),
  486. axis.ticks.y = element_blank()
  487. )
  488. }
  489. if (region_name == "PGa") {
  490. plot <- plot +
  491. theme(plot.margin = unit(c(1, 0.25, 1, 1), "lines"))
  492. }
  493. if (region_name == "PGp") {
  494. plot <- plot +
  495. theme(
  496. plot.margin = unit(c(1, 1, 1, 0.1), "lines"),
  497. axis.title.y = element_blank(),
  498. axis.text.y = element_blank(),
  499. axis.ticks.y = element_blank()
  500. )
  501. }
  502. if (phase_name == "Probe") {
  503. ob_row <- df_summary[df_summary$Orientation == "Observer", ]
  504. if (nrow(ob_row) > 0) {
  505. y_value <- ob_row$Activation
  506. y_ci <- ob_row$ci
  507. # Place asterisk above or below depending on direction
  508. y_star <- if (y_value >= 0) y_value + y_ci + 0.03 else y_value - y_ci - 0.05
  509. plot <- plot +
  510. annotate("text", x = "Observer", y = y_star, label = "*", size = 10)
  511. }
  512. }
  513. # Return the final plot
  514. return(plot)
  515. }
  516. # Cue phase plots
  517. p_pga_cue <- plot_AG_by_region_phase(df_long, "PGa", "Cue", "Right PGa: Cue", palette_by_orientation,show_y_label = TRUE, y_limits = c(-0.09, 0.09), y_breaks = c(-0.09, -0.06, -0.03, 0, 0.03, 0.06, 0.09), y_expand = c(0.01, 0.01))
  518. p_pgp_cue <- plot_AG_by_region_phase(df_long, "PGp", "Cue", "Right PGp: Cue", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.09, 0.09), y_breaks = c(-0.09, -0.06, -0.03, 0, 0.03, 0.06, 0.09), y_expand = c(0.01, 0.01))
  519. # Probe phase plots
  520. p_pga_probe <- plot_AG_by_region_phase(df_long, "PGa", "Probe", "Right PGa: Probe", palette_by_orientation, show_y_label = TRUE, y_limits = c(-0.2, 0.4), y_breaks = c(-0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4), y_expand = c(0.01, 0.01))
  521. p_pgp_probe <- plot_AG_by_region_phase(df_long, "PGp", "Probe", "Right PGp: Probe", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.2, 0.4), y_breaks = c(-0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4), y_expand = c(0.01, 0.01))
  522. # Step 0: Add tags to each individual plot
  523. p_pga_cue <- p_pga_cue + labs(tag = "A")
  524. p_pgp_cue <- p_pgp_cue + labs(tag = "B")
  525. p_pga_probe <- p_pga_probe + labs(tag = "C")
  526. p_pgp_probe <- p_pgp_probe + labs(tag = "D")
  527. p_pga_cue <- p_pga_cue +
  528. theme(plot.tag.position = c(0.155, 0.98))
  529. p_pga_probe <- p_pga_probe +
  530. theme(plot.tag.position = c(0.155, 0.98))
  531. p_pgp_cue <- p_pgp_cue +
  532. theme(plot.tag.position = c(0.02, 0.98))
  533. p_pgp_probe <- p_pgp_probe +
  534. theme(plot.tag.position = c(0.02, 0.98))
  535. cue_annotation <- wrap_elements(
  536. full = grid::textGrob(
  537. "Cue Phase: Main Effect of Region (PGp > PGa)",
  538. x = unit(0, "npc"), just = "left",
  539. gp = gpar(fontsize = 24, fontface = "italic")
  540. )
  541. )
  542. probe_annotation <- wrap_elements(
  543. full = grid::textGrob(
  544. "Probe Phase: Main Effect of Retrieval Orientation (OB > OE & Retrieve)",
  545. x = unit(0, "npc"), just = "left",
  546. gp = gpar(fontsize = 24, fontface = "italic")
  547. )
  548. )
  549. combined_plot <- wrap_plots(
  550. cue_annotation,
  551. (p_pga_cue | p_pgp_cue),
  552. probe_annotation,
  553. (p_pga_probe | p_pgp_probe),
  554. ncol = 1,
  555. heights = c(0.08, 1, 0.08, 1)
  556. )
  557. combined_plot
  558. ggsave(
  559. filename = "Figure_RightAG_Subregions_Combined.png",
  560. plot = combined_plot,
  561. path = "~/Library/CloudStorage/[email hidden]/Shared drives/MELab/Projects/RetrievalOrientation/Results/ROI/",
  562. width = 12, # in inches
  563. height = 12, # in inches
  564. dpi = 600 # high-res for publication
  565. )
  566. ######## Precuneus #########
  567. plot_precuneus_by_region_phase <- function(df, region_name, phase_name, title_text, pal, show_y_label = TRUE, y_limits, y_breaks, y_expand) {
  568. df_sub <- df %>%
  569. filter(
  570. Phase == phase_name,
  571. Hemisphere == "Left",
  572. Region == region_name,
  573. RetrievalOrientation %in% c("OwnEyes", "Observer", "Retrieve")
  574. ) %>%
  575. mutate(
  576. Orientation = factor(RetrievalOrientation, levels = c("OwnEyes", "Observer", "Retrieve"))
  577. )
  578. # summary_df <- df_sub %>%
  579. # group_by(Orientation) %>%
  580. # summarise(
  581. # mean = mean(Activation, na.rm = TRUE),
  582. # se = sd(Activation, na.rm = TRUE) / sqrt(n()),
  583. # n = n(),
  584. # .groups = "drop"
  585. # ) %>%
  586. # mutate(
  587. # ci_lower = mean - 1.96 * se,
  588. # ci_upper = mean + 1.96 * se
  589. # )
  590. # Use your within-subjects variables
  591. df_summary <- Rmisc::summarySEwithin(
  592. data = df_sub,
  593. measurevar = "Activation",
  594. withinvars = "Orientation",
  595. idvar = "ID", # change to your actual subject ID column
  596. na.rm = TRUE,
  597. conf.interval = .95
  598. )
  599. plot <- ggplot(df_summary, aes(x = Orientation, y = Activation, fill = Orientation)) +
  600. geom_col(width = 0.7, color = "black") +
  601. geom_errorbar(
  602. #aes(ymin = ci_lower, ymax = ci_upper),
  603. aes(ymin = Activation - ci, ymax = Activation + ci),
  604. width = 0.2,
  605. size = 0.8,
  606. color = "black"
  607. ) +
  608. geom_hline(yintercept = 0, color = "black", linewidth = 0.8) +
  609. scale_fill_manual(values = pal) +
  610. scale_x_discrete(labels = c("OwnEyes" = "Own Eyes", "Observer" = "Observer", "Retrieve" = "Retrieve")) +
  611. scale_y_continuous(
  612. limits = y_limits,
  613. breaks = y_breaks,
  614. labels = function(x) sprintf("%.2f", x),
  615. expand = y_expand
  616. ) +
  617. labs(
  618. title = title_text,
  619. x = NULL,
  620. y = if (show_y_label) "% Signal Change" else NULL
  621. ) +
  622. theme(
  623. plot.background = element_rect(fill = "white"),
  624. panel.background = element_rect(fill = "white"),
  625. axis.line = element_line(color = "black"),
  626. axis.ticks = element_line(size = 1),
  627. axis.ticks.length = unit(0.25, "cm"),
  628. panel.border = element_rect(colour = "black", fill = NA, size = 1.25),
  629. legend.position = "none",
  630. text = element_text(size = 24, colour = "black", family = "Arial"),
  631. axis.text = element_text(size = 20, colour = "black"),
  632. axis.text.x = element_text(size = 20),
  633. axis.title.x = element_blank(),
  634. strip.text = element_text(size = 26, face = "bold"),
  635. strip.background = element_rect(fill = "white", color = NA),
  636. plot.title = element_text(size = 26, hjust = 0.5),
  637. plot.tag.position = c(0, 0.98), # top-left corner (x = 0 [left], y = 1 [top])
  638. plot.tag = element_text(size = 26), # customize style
  639. plot.margin = unit(c(0.25, 0.25, 0.25, 0.25), "lines")
  640. )
  641. if (region_name == "7P" & phase_name == "Probe") {
  642. plot <- plot +
  643. geom_signif(
  644. comparisons = list(c("Observer", "OwnEyes"), c("Observer", "Retrieve")),
  645. annotations = c("*", "*"),
  646. y_position = c(0.55, 0.48),
  647. tip_length = 0.04,
  648. textsize = 8
  649. )
  650. }
  651. if (region_name == "7M") {
  652. plot <- plot +
  653. theme(
  654. plot.margin = unit(c(1, 0.3, 1, 0.3), "lines"),
  655. axis.title.y = element_blank(),
  656. axis.text.y = element_blank(),
  657. axis.ticks.y = element_blank()
  658. )
  659. }
  660. if (region_name == "7P") {
  661. plot <- plot +
  662. theme(
  663. plot.margin = unit(c(1, 1, 1, 0.3), "lines"),
  664. axis.title.y = element_blank(),
  665. axis.text.y = element_blank(),
  666. axis.ticks.y = element_blank()
  667. )
  668. }
  669. if (region_name == "7P") {
  670. plot <- plot +
  671. theme(
  672. plot.margin = unit(c(1, 1, 1, 0.3), "lines"),
  673. axis.title.y = element_blank(),
  674. axis.text.y = element_blank(),
  675. axis.ticks.y = element_blank()
  676. )
  677. }
  678. if (phase_name == "Cue") {
  679. oe_row <- df_summary[df_summary$Orientation == "OwnEyes", ]
  680. if (nrow(oe_row) > 0) {
  681. y_value <- oe_row$Activation
  682. y_ci <- oe_row$ci
  683. # Place asterisk above or below depending on direction
  684. y_star <- if (y_value >= 0) y_value + y_ci + 0.03 else y_value - y_ci - 0.06
  685. plot <- plot +
  686. annotate("text", x = "OwnEyes", y = y_star, label = "*", size = 10)
  687. }
  688. }
  689. # Return the final plot
  690. return(plot)
  691. }
  692. # Cue phase plots
  693. p_7A_cue <- plot_precuneus_by_region_phase(df_long, "7A", "Cue", "Left 7A", palette_by_orientation, show_y_label = TRUE, y_limits = c(-0.3, 0.5), y_breaks = c(-0.30, -0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50), y_expand = c(0.01, 0.01))
  694. p_7M_cue <- plot_precuneus_by_region_phase(df_long, "7M", "Cue","Left 7M", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.3, 0.5), y_breaks = c(-0.30,-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50), y_expand = c(0.01, 0.01))
  695. p_7P_cue <- plot_precuneus_by_region_phase(df_long, "7P", "Cue","Left 7P", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.3, 0.5), y_breaks = c(-0.30,-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50), y_expand = c(0.01, 0.01))
  696. # Probe phase plots
  697. p_7A_probe <- plot_precuneus_by_region_phase(df_long, "7A","Probe", "Left 7A", palette_by_orientation, show_y_label = TRUE, y_limits = c(-0.2, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  698. p_7M_probe <- plot_precuneus_by_region_phase(df_long, "7M", "Probe","Left 7M", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.2, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  699. p_7P_probe <- plot_precuneus_by_region_phase(df_long, "7P", "Probe","Left 7P", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.2, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  700. # Step 0: Add tags to each individual plot
  701. p_7A_cue <- p_7A_cue + labs(tag = "A")
  702. p_7M_cue <- p_7M_cue + labs(tag = "B")
  703. p_7P_cue <- p_7P_cue + labs(tag = "C")
  704. p_7A_probe <- p_7A_probe + labs(tag = "D")
  705. p_7M_probe <- p_7M_probe + labs(tag = "E")
  706. p_7P_probe <- p_7P_probe + labs(tag = "F")
  707. p_7A_cue <- p_7A_cue +
  708. theme(plot.tag.position = c(0.18, 0.98))
  709. p_7A_probe <- p_7A_probe +
  710. theme(plot.tag.position = c(0.18, 0.98))
  711. p_7M_cue <- p_7M_cue +
  712. theme(plot.tag.position = c(0.02, 0.98))
  713. p_7M_probe <- p_7M_probe +
  714. theme(plot.tag.position = c(0.02, 0.98))
  715. p_7P_cue <- p_7P_cue +
  716. theme(plot.tag.position = c(0.02, 0.98))
  717. p_7P_probe <- p_7P_probe +
  718. theme(plot.tag.position = c(0.02, 0.98))
  719. cue_annotation <- wrap_elements(
  720. full = grid::textGrob(
  721. "Cue Phase: Main Effect of Retrieval Orientation (OE > Retrieve)",
  722. x = unit(0, "npc"), just = "left",
  723. gp = gpar(fontsize = 24, fontface = "italic")
  724. )
  725. )
  726. probe_annotation <- wrap_elements(
  727. full = grid::textGrob(
  728. "Probe Phase: Region x Retrieval Interaction",
  729. x = unit(0, "npc"), just = "left",
  730. gp = gpar(fontsize = 24, fontface = "italic")
  731. )
  732. )
  733. combined_plot <- wrap_plots(
  734. cue_annotation,
  735. (p_7A_cue | p_7M_cue | p_7P_cue),
  736. probe_annotation,
  737. (p_7A_probe | p_7M_probe | p_7P_probe),
  738. ncol = 1,
  739. heights = c(0.08, 1, 0.08, 1)
  740. )
  741. combined_plot
  742. ggsave(
  743. filename = "Figure_LeftPrecuneus_Subregions_Combined_barplot_nowinsorize.png", # or .tiff, .pdf
  744. plot = combined_plot,
  745. path = "~/Library/CloudStorage/[email hidden]/Shared drives/MELab/Projects/RetrievalOrientation/Results/ROI/",
  746. width = 16, # in inches
  747. height = 12, # in inches
  748. dpi = 600 # high-res for publication
  749. )
  750. ### Right Precuneus
  751. plot_precuneus_by_region_phase <- function(df, region_name, phase_name, title_text, pal, show_y_label = TRUE, y_limits, y_breaks, y_expand) {
  752. df_sub <- df %>%
  753. filter(
  754. Phase == phase_name,
  755. Hemisphere == "Right",
  756. Region == region_name,
  757. RetrievalOrientation %in% c("OwnEyes", "Observer", "Retrieve")
  758. ) %>%
  759. mutate(
  760. Orientation = factor(RetrievalOrientation, levels = c("OwnEyes", "Observer", "Retrieve"))
  761. )
  762. # summary_df <- df_sub %>%
  763. # group_by(Orientation) %>%
  764. # summarise(
  765. # mean = mean(Activation, na.rm = TRUE),
  766. # se = sd(Activation, na.rm = TRUE) / sqrt(n()),
  767. # n = n(),
  768. # .groups = "drop"
  769. # ) %>%
  770. # mutate(
  771. # ci_lower = mean - 1.96 * se,
  772. # ci_upper = mean + 1.96 * se
  773. # )
  774. # Use your within-subjects variables
  775. df_summary <- Rmisc::summarySEwithin(
  776. data = df_sub,
  777. measurevar = "Activation",
  778. withinvars = "Orientation",
  779. idvar = "ID", # change to your actual subject ID column
  780. na.rm = TRUE,
  781. conf.interval = .95
  782. )
  783. plot <- ggplot(df_summary, aes(x = Orientation, y = Activation, fill = Orientation)) +
  784. geom_col(width = 0.7, color = "black") +
  785. geom_errorbar(
  786. #aes(ymin = ci_lower, ymax = ci_upper),
  787. aes(ymin = Activation - ci, ymax = Activation + ci),
  788. width = 0.2,
  789. size = 0.8,
  790. color = "black"
  791. ) +
  792. geom_hline(yintercept = 0, color = "black", linewidth = 0.8) +
  793. scale_fill_manual(values = pal) +
  794. scale_x_discrete(labels = c("OwnEyes" = "Own Eyes", "Observer" = "Observer", "Retrieve" = "Retrieve")) +
  795. scale_y_continuous(
  796. limits = y_limits,
  797. breaks = y_breaks,
  798. labels = function(x) sprintf("%.2f", x),
  799. expand = y_expand
  800. ) +
  801. labs(
  802. title = title_text,
  803. x = NULL,
  804. y = if (show_y_label) "% Signal Change" else NULL
  805. ) +
  806. theme(
  807. plot.background = element_rect(fill = "white"),
  808. panel.background = element_rect(fill = "white"),
  809. axis.line = element_line(color = "black"),
  810. axis.ticks = element_line(size = 1),
  811. axis.ticks.length = unit(0.25, "cm"),
  812. panel.border = element_rect(colour = "black", fill = NA, size = 1.25),
  813. legend.position = "none",
  814. text = element_text(size = 24, colour = "black", family = "Arial"),
  815. axis.text = element_text(size = 20, colour = "black"),
  816. axis.text.x = element_text(size = 20),
  817. axis.title.x = element_blank(),
  818. strip.text = element_text(size = 26, face = "bold"),
  819. strip.background = element_rect(fill = "white", color = NA),
  820. plot.title = element_text(size = 26, hjust = 0.5),
  821. plot.tag.position = c(0, 0.98), # top-left corner (x = 0 [left], y = 1 [top])
  822. plot.tag = element_text(size = 26), # customize style
  823. plot.margin = unit(c(0.25, 0.25, 0.25, 0.25), "lines")
  824. )
  825. if (region_name == "7A") {
  826. plot <- plot +
  827. theme(plot.margin = unit(c(1, 0.3, 1, 1), "lines"))
  828. }
  829. if (region_name == "7M") {
  830. plot <- plot +
  831. theme(
  832. plot.margin = unit(c(1, 0.3, 1, 0.3), "lines"),
  833. axis.title.y = element_blank(),
  834. axis.text.y = element_blank(),
  835. axis.ticks.y = element_blank()
  836. )
  837. }
  838. if (region_name == "7P") {
  839. plot <- plot +
  840. theme(
  841. plot.margin = unit(c(1, 1, 1, 0.3), "lines"),
  842. axis.title.y = element_blank(),
  843. axis.text.y = element_blank(),
  844. axis.ticks.y = element_blank()
  845. )
  846. }
  847. if (phase_name == "Cue") {
  848. oe_row <- df_summary[df_summary$Orientation == "OwnEyes", ]
  849. if (nrow(oe_row) > 0) {
  850. y_value <- oe_row$Activation
  851. y_ci <- oe_row$ci
  852. # Place asterisk above or below depending on direction
  853. y_star <- if (y_value >= 0) y_value + y_ci + 0.03 else y_value - y_ci - 0.07
  854. plot <- plot +
  855. annotate("text", x = "OwnEyes", y = y_star, label = "*", size = 10)
  856. }
  857. }
  858. # Return the final plot
  859. return(plot)
  860. }
  861. # Cue phase plots
  862. p_7A_cue <- plot_precuneus_by_region_phase(df_long, "7A", "Cue", "Right 7A", palette_by_orientation, show_y_label = TRUE, y_limits = c(-0.20, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  863. p_7M_cue <- plot_precuneus_by_region_phase(df_long, "7M", "Cue","Right 7M", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.20, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  864. p_7P_cue <- plot_precuneus_by_region_phase(df_long, "7P", "Cue","Right 7P", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.20, 0.70), y_breaks = c(-0.20, -0.10, 0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70), y_expand = c(0.01, 0.01))
  865. # Probe phase plots
  866. p_7A_probe <- plot_precuneus_by_region_phase(df_long, "7A","Probe", "Right 7A", palette_by_orientation, show_y_label = TRUE, y_limits = c(-0.40, 0.80), y_breaks = c(-0.40, -0.20, 0, 0.20, 0.40, 0.60, 0.80), y_expand = c(0.01, 0.01))
  867. p_7M_probe <- plot_precuneus_by_region_phase(df_long, "7M", "Probe","Right 7M", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.40, 0.80), y_breaks = c(-0.40, -0.20, 0, 0.20, 0.40, 0.60, 0.80), y_expand = c(0.01, 0.01))
  868. p_7P_probe <- plot_precuneus_by_region_phase(df_long, "7P", "Probe","Right 7P", palette_by_orientation, show_y_label = FALSE, y_limits = c(-0.40, 0.80), y_breaks = c(-0.40, -0.20, 0, 0.20, 0.40, 0.60, 0.80), y_expand = c(0.01, 0.01))
  869. # Step 0: Add tags to each individual plot
  870. p_7A_cue <- p_7A_cue + labs(tag = "A")
  871. p_7M_cue <- p_7M_cue + labs(tag = "B")
  872. p_7P_cue <- p_7P_cue + labs(tag = "C")
  873. p_7A_probe <- p_7A_probe + labs(tag = "D")
  874. p_7M_probe <- p_7M_probe + labs(tag = "E")
  875. p_7P_probe <- p_7P_probe + labs(tag = "F")
  876. p_7A_cue <- p_7A_cue +
  877. theme(plot.tag.position = c(0.18, 0.98))
  878. p_7A_probe <- p_7A_probe +
  879. theme(plot.tag.position = c(0.18, 0.98))
  880. p_7M_cue <- p_7M_cue +
  881. theme(plot.tag.position = c(0.02, 0.98))
  882. p_7M_probe <- p_7M_probe +
  883. theme(plot.tag.position = c(0.02, 0.98))
  884. p_7P_cue <- p_7P_cue +
  885. theme(plot.tag.position = c(0.02, 0.98))
  886. p_7P_probe <- p_7P_probe +
  887. theme(plot.tag.position = c(0.02, 0.98))
  888. cue_annotation <- wrap_elements(
  889. full = grid::textGrob(
  890. "Cue Phase: Main Effect of Retrieval Orientation (Own Eyes > Retrieve)",
  891. x = unit(0, "npc"), just = "left",
  892. gp = gpar(fontsize = 24, fontface = "italic")
  893. )
  894. )
  895. probe_annotation <- wrap_elements(
  896. full = grid::textGrob(
  897. "Probe Phase: Main Effect of Region (7M > 7A & 7P)",
  898. x = unit(0, "npc"), just = "left",
  899. gp = gpar(fontsize = 24, fontface = "italic")
  900. )
  901. )
  902. combined_plot <- wrap_plots(
  903. cue_annotation,
  904. (p_7A_cue | p_7M_cue | p_7P_cue),
  905. probe_annotation,
  906. (p_7A_probe | p_7M_probe | p_7P_probe),
  907. ncol = 1,
  908. heights = c(0.08, 1, 0.08, 1)
  909. )
  910. combined_plot
  911. ggsave(
  912. filename = "Figure_RightPrecuneus_Subregions_Combined.png", # or .tiff, .pdf
  913. plot = combined_plot,
  914. path = "~/Library/CloudStorage/[email hidden]/Shared drives/MELab/Projects/RetrievalOrientation/Results/",
  915. height = 12, # in inches
  916. dpi = 600 # high-res for publication
  917. )

PosteriorParietalROISubregions_RetrievalOrientation.R, no license · at the source

Overview

  1. Department of Psychology, University of Alberta, Edmonton, AB, Canada
Institutions: University of Alberta (Canada)
Journal: Imaging neuroscience (Cambridge, Mass.), volume 4, article IMAG.a.1313
Dates: received 30 September 2025; accepted 27 June 2026; published online 27 July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1162/imag.a.1313 · PMID 42524184 · PMCID PMC13409283 · OpenAlex W4411509751
Open access: diamond, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: cognitive (subfield)
Methods: Statistics, fMRI & imaging
Keywords: angular gyrus, autobiographical memory, precuneus, retrieval orientation, visual perspective
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: University of Alberta; Canada Research Chairs (RGPIN-2019-06080); Natural Sciences and Engineering Research Council of Canada (rgpin-2019-06080, DGECR‐2019‐00407, RGPIN-2019)
Citations: not cited yet (Europe PMC); 63 references in the paper

Abstract

Autobiographical memory (AM) retrieval involves goal-directed and reconstructive processes that unfold over time. A key feature of this process is the visual perspective adopted during remembering, which shapes subjective memory experience. Using fMRI, we cued participants to retrieve AMs from an own eyes, observer, or natural perspective followed by an event probe. Our design temporally isolates preparatory (cue phase) and reconstructive (probe phase) mechanisms to identify the neural signatures of retrieval orientation, the strategic use of cues to optimize retrieval. Whole-brain and ROI analyses revealed that the angular gyrus (AG) and precuneus support perspective-guided retrieval in distinct ways. During the cue phase, PGp showed greater activity for instructed perspectives than natural retrieval, consistent with preparatory perspective selection. During the probe phase, observer-perspective retrieval elicited greater activity in AG and precuneus, supporting sustained perspective maintenance. Brain–behavior models linked PGp and 7P activity to greater vividness and perspective stability, while precuneus (7M) activity was negatively associated with emotional intensity, especially in the observer condition. These findings reveal phase- and subregion-specific contributions of posterior parietal cortex to the subjective qualities of memory. AG subregions support goal-directed perspective selection and implementation, while precuneus subregions flexibly modulate phenomenological features during memory reconstruction.

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

Repository

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

OSF 4785r

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: R (3)
Size: 12 files, 3 scripts
Software Heritage: not checked
Found in: “Data and Code Availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: emmeans (3 files), patchwork (3 files), tidyverse (3 files), afex (2 files), easystats (1 file), ggplot2 (1 file), ggpubr (1 file), lme4 (1 file), lmerTest (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
3 files
At the source: osf.io/4785r/

The paper's code and data availability statement is in the Data section.

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:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 3 scripts, each with its path and the digest of its content;
  • 1 match 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

No dataset and no data link were found in the paper.

Data and Code Availability

Data and code supporting the findings of this study are publicly available via the Open Science Framework: https://osf.io/4785r/.

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 2, 28 September 2026

  • Authors: added Selen Küçüktaş (0000-0001-5735-5302); removed Selen Küçüktaş
  • Funding: added University of Alberta; Canada Research Chairs: RGPIN-2019-06080; Natural Sciences and Engineering Research Council of Canada: rgpin-2019-06080, DGECR‐2019‐00407, RGPIN-2019

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 2 authors, 5 keywords, 62 references.

Cite

This paper

Küçüktaş, S., & St Jacques, P. L. (2026). Functional specialization of angular gyrus and precuneus subregions for perspective-guided autobiographical memory retrieval. Imaging neuroscience (Cambridge, Mass.), 4, IMAG.a.1313. https://doi.org/10.1162/imag.a.1313

BibTeX

@article{kucuktas2026functional,
author = {Küçüktaş, Selen and St Jacques, Peggy L},
title = {{Functional specialization of angular gyrus and precuneus subregions for perspective-guided autobiographical memory retrieval}},
journal = {Imaging neuroscience (Cambridge, Mass.)},
year = {2026},
month = jul,
volume = {4},
pages = {IMAG.a.1313},
publisher = {MIT Press},
issn = {2837-6056},
doi = {10.1162/imag.a.1313},
url = {https://doi.org/10.1162/imag.a.1313},
pmid = {42524184},
pmcid = {PMC13409283}
}

RIS

TY - JOUR
AU - Küçüktaş, Selen
AU - St Jacques, Peggy L
TI - Functional specialization of angular gyrus and precuneus subregions for perspective-guided autobiographical memory retrieval
T2 - Imaging neuroscience (Cambridge, Mass.)
J2 - Imaging Neurosci (Camb)
PY - 2026
DA - 2026/07/27
VL - 4
SP - IMAG.a.1313
SN - 2837-6056
PB - MIT Press
DO - 10.1162/imag.a.1313
UR - https://doi.org/10.1162/imag.a.1313
LA - en
ER -

CSL-JSON

{
"id": "10.1162/imag.a.1313",
"type": "article-journal",
"title": "Functional specialization of angular gyrus and precuneus subregions for perspective-guided autobiographical memory retrieval",
"container-title": "Imaging neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Küçüktaş",
"given": "Selen"
},
{
"family": "St Jacques",
"given": "Peggy L"
}
],
"container-title-short": "Imaging Neurosci (Camb)",
"volume": "4",
"page": "IMAG.a.1313",
"DOI": "10.1162/imag.a.1313",
"PMID": "42524184",
"PMCID": "PMC13409283",
"ISSN": "2837-6056",
"publisher": "MIT Press",
"URL": "https://doi.org/10.1162/imag.a.1313",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
27
]
]
}
}

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.1162/imag.a.93
An embodied perspective: Angular gyrus and precuneus decode selfhood in memories of naturalistic events.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: cognitive, 14 references
[2] doi:10.1007/s00429-022-02493-y [code]
The role of the angular gyrus in semantic cognition: a synthesis of five functional neuroimaging studies.
Journal: Brain structure & function
In common: easystats, emmeans, lmerTest, 2 other tools, cognitive, 8 references
[3] doi:10.1111/ejn.70194 [code]
The Effects of External Cue Overlap and Internal Goals on Selective Memory Retrieval as Revealed by Electroencephalographic (EEG) Neural Pattern Reinstatement.
Journal: The European journal of neuroscience
In common: afex, easystats, emmeans, 5 other tools, cognitive, 3 references
[4] doi:10.1038/s42003-024-06757-7 [code]
Embodiment in episodic memory through premotor-hippocampal coupling.
Journal: Communications biology
In common: lmerTest, lme4, ggpubr, 1 other tool, cognitive, 6 references
[5] doi:10.1038/s41598-023-48857-0 [code]
Experience sampling reveals the role that covert goal states play in task-relevant behavior.
Journal: Scientific reports
In common: easystats, emmeans, lmerTest, 5 other tools, cognitive, 4 references
[6] doi:10.1038/s42003-023-04953-5 [code]
Sulcal morphology of posteromedial cortex substantially differs between humans and chimpanzees.
Journal: Communications biology
In common: afex, easystats, emmeans, 6 other tools, cognitive, 2 references
[7] doi:10.1523/eneuro.0146-26.2026 [code]
Remembered Event Features Shape Default Mode Network Engagement during Emotional Memory Recall.
Journal: eNeuro
In common: emmeans, lmerTest, lme4, 4 other tools, cognitive, 4 references
[8] doi:10.1162/imag.a.1059 [code]
Subjective reliving of past events is modulated by premotor-hippocampal coupling and bodily self-consciousness during event encoding.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: easystats, lmerTest, lme4, 3 other tools, cognitive, 4 references
[9] doi:10.1093/cercor/bhad519 [code]
Representation of event and object concepts in ventral anterior temporal lobe and angular gyrus.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: afex, lme4, ggpubr, 1 other tool, 6 references
[10] doi:10.1038/s41467-025-63633-6 [code]
The intrinsic time tracker: temporal context is embedded in entorhinal and hippocampal functional connectivity patterns.
Journal: Nature communications
In common: emmeans, lmerTest, lme4, 2 other tools, 6 references

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.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1162/imag.a.1313.svg)](https://openscicode.org/badge/doi/10.1162/imag.a.1313)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1162/imag.a.1313.svg
   :target: https://openscicode.org/badge/doi/10.1162/imag.a.1313
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1162/imag.a.1313"><img src="https://openscicode.org/badge/doi/10.1162/imag.a.1313.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge 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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

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