OSCR

Do You Match What I Match? A Systematic Review of Over 20 Years of the Emotional Face Matching Task Reveals Vast Inconsistencies in Design and Implementation.

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] § Method ↔ A_P_Activated_Regions_PgtC.Rmd, lines 55 to 69 · score 0.96 · Autism Spectrum Disorder, Borderline Personality Disorder, anxiety related disorders, Bipolar Disorder, Body, clinically · Report a mismatch
  2. [2] § Method ↔ D_Age_Sex_Sample_Size.Rmd, lines 541 to 592 · score 0.81 · mood disorders, anxiety related, PMDD, ASD, BDD, BPD · Report a mismatch
  3. [3] § Results › Study Samples › Sex/Gender ↔ D_Age_Sex_Sample_Size.Rmd, lines 541 to 592 · score 0.65 · mood disorders, anxiety related, log, neurodivergent, Age, Sex · Report a mismatch
  4. [4] § Results › Study Samples › Sex/Gender ↔ A_P_Activated_Regions_PgtC.Rmd, lines 55 to 69 · score 0.63 · Borderline Personality Disorder, anxiety related disorders, Body, Gender, schizophrenia · Report a mismatch
  5. [5] § Method › Data Extraction › Data Synthesis ↔ T_Task_Parameters.Rmd, lines 258 to 321 · score 0.63 · stimuli expressions, contempt, disgust, fearful, happy, sad · Report a mismatch
  6. [6] § Results › Brain Regions Activated › Regions Activated—Control Samples › Frontal Regions ↔ A_C_Activated_Regions_C.Rmd, lines 1337 to 1439 · score 0.60 · ventrolateral prefrontal cortex, dorsolateral prefrontal cortex, ventromedial, cingulate, brain, activated · Report a mismatch
  7. [7] § Results › Brain Regions Activated › Regions Activated—Control Samples › Frontal Regions ↔ A_P_Activated_Regions_PgtC.Rmd, lines 1451 to 1551 · score 0.60 · ventrolateral prefrontal cortex, dorsolateral prefrontal cortex, ventromedial, cingulate, brain, activated · Report a mismatch
  8. [8] § Results › Brain Regions Activated › Regions Activated—Control Samples › Occipital Regions ↔ A_C_Activated_Regions_C.Rmd, lines 1337 to 1439 · score 0.53 · occipital lobe, cuneus, lingual, gyrus, cortex, brain · Report a mismatch
  9. [9] § Results › Brain Regions Activated › Regions Activated—Control Samples › Occipital Regions ↔ A_P_Activated_Regions_PgtC.Rmd, lines 1451 to 1551 · score 0.53 · occipital lobe, cuneus, lingual, gyrus, cortex, brain · Report a mismatch
  10. [10] § Results › Task Parameters › Face Stimuli—Expressions ↔ T_Task_Parameters.Rmd, lines 258 to 321 · score 0.52 · anger, contempt, disgust, fearful, happy, surprise · 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 Markdown · 1,592 lines · 79 KB · GPL-3.0 · 4 matches

  1. ---
  2. title: "Activation_Patients_Controls"
  3. author: "HannahSavage"
  4. date: "2023-05-31"
  5. output: html_document
  6. ---
  7. ```{r setup, include=FALSE}
  8. knitr::opts_chunk$set(echo = TRUE)
  9. ```
  10. #Set env
  11. ```{r, include = FALSE}
  12. library(readxl)
  13. library(dplyr)
  14. library(tidyverse)
  15. library(ggplot2)
  16. library(grid)
  17. library(reshape)
  18. library(scales)
  19. library(sjmisc)
  20. library(scatterpie)
  21. library(showtext)
  22. library(psych)
  23. #library('qgraph')
  24. library('data.table')
  25. library('reshape2')
  26. library('ade4')
  27. library('viridis')
  28. library(extrafont)
  29. library(ggalluvial)
  30. ```
  31. ```{r}
  32. #Select the columns that will be used
  33. FgtC_P_Activated <- read_excel("/project/3022054.01/projects/linschl/efmt/review_update_2026/Data_extraction_update_2026_clean_contrasts.xlsx")
  34. #colnames(FgtC_P_Activated)[143:150] = c( "FgtC_PgtC", "WB_Th", "ROI_Th")
  35. FgtC_P_Activated <- FgtC_P_Activated %>%
  36. dplyr:: rename(
  37. FgtC_PgtC = `Patients_>_Controls:_Faces_>_Control_clean_ROI`,
  38. WB_Th = `Whole_brain_threshold_coded...145`,
  39. ROI_Th = `ROI_threshold_coded...146`
  40. )
  41. #FgtC_P_Activated_LONG <- gather(FgtC_P_Activated, Diagnosis, Present, c(6:16,18:28, 30:40) , factor_key=TRUE)
  42. #FgtC_P_Activated <- filter(FgtC_P_Activated_LONG, Present==1)
  43. ```
  44. ```{r}
  45. #How many samples have which clinical groups
  46. print(paste0("ADHD: ", nrow(subset(FgtC_P_Activated, PG1_ADHD == 1 | PG2_ADHD == 1 | PG3_ADHD == 1))))
  47. print(paste0("Anxiety Related Disorder: ", nrow(subset(FgtC_P_Activated, PG1_ARD == 1 | PG2_ARD == 1 | PG3_ARD == 1))))
  48. print(paste0("Autism Spectrum Disorder: ", nrow(subset(FgtC_P_Activated, PG1_ASD == 1 | PG2_ASD == 1 | PG3_ASD == 1))))
  49. print(paste0("Bipolar Disorder: ", nrow(subset(FgtC_P_Activated, PG1_BP == 1 | PG2_BP == 1 | PG3_BP == 1))))
  50. print(paste0("Body Dismorphic Disorder: ", nrow(subset(FgtC_P_Activated, PG1_BDD == 1 | PG2_BDD == 1 | PG3_BDD == 1))))
  51. print(paste0("Borderline Personality Disorder: ", nrow(subset(FgtC_P_Activated, PG1_BPD == 1 | PG2_BPD == 1 | PG3_BPD == 1))))
  52. print(paste0("Gender Dyshoria: ", nrow(subset(FgtC_P_Activated, PG1_GD == 1 | PG2_GD == 1 | PG3_GD == 1))))
  53. print(paste0("MDD: ", nrow(subset(FgtC_P_Activated, PG1_MDD == 1 | PG2_MDD == 1 | PG3_MDD == 1))))
  54. print(paste0("OCD: ", nrow(subset(FgtC_P_Activated, PG1_OCD == 1 | PG2_OCD == 1 | PG3_OCD == 1))))
  55. print(paste0("Schizophrenia: ", nrow(subset(FgtC_P_Activated, PG1_Schizophrenia == 1 | PG2_Schizophrenia == 1 | PG3_Schizophrenia == 1))))
  56. print(paste0("SUD: ", nrow(subset(FgtC_P_Activated, PG1_SUD == 1 | PG2_SUD == 1 | PG3_SUD == 1))))
  57. print(paste0("PMDD: ", nrow(subset(FgtC_P_Activated, PG1_PMDD == 1 | PG2_PMDD == 1 | PG3_PMDD == 1))))
  58. ```
  59. ```{r}
  60. ##SET DIAGNOSIS:
  61. #Diagnosis <- 'ADHD'
  62. #Diagnosis <- 'ARD'
  63. #Diagnosis <- 'ASD'
  64. #Diagnosis <- 'BP'
  65. #Diagnosis <- 'BDD' ##NO STUDIES
  66. #Diagnosis <- 'BPD'
  67. #Diagnosis <- 'GD'
  68. #Diagnosis <- 'MDD'
  69. #Diagnosis <- 'OCD'
  70. #Diagnosis <- 'Schizophrenia'
  71. #Diagnosis <- 'SUD'
  72. Diagnosis <- 'PMDD'
  73. ```
  74. ```{r}
  75. if (Diagnosis == 'ADHD') {
  76. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_ADHD == 1 | PG2_ADHD == 1 | PG3_ADHD == 1)
  77. } else if (Diagnosis == 'ARD') {
  78. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_ARD == 1 | PG2_ARD == 1 | PG3_ARD == 1)
  79. } else if (Diagnosis == 'ASD') {
  80. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_ASD == 1 | PG2_ASD == 1 | PG3_ASD == 1)
  81. } else if (Diagnosis == 'BDD') {
  82. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_BDD == 1 | PG2_BDD == 1 | PG3_BDD == 1)
  83. } else if (Diagnosis == 'BP') {
  84. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_BP == 1 | PG2_BP == 1 | PG3_BP == 1)
  85. } else if (Diagnosis == 'BPD') {
  86. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_BPD == 1 | PG2_BPD == 1 | PG3_BPD == 1)
  87. } else if (Diagnosis == 'GD') {
  88. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_GD == 1 | PG2_GD == 1 | PG3_GD == 1)
  89. } else if (Diagnosis == 'MDD') {
  90. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_MDD == 1 | PG2_MDD == 1 | PG3_MDD == 1)
  91. } else if (Diagnosis == 'OCD') {
  92. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_OCD == 1 | PG2_OCD == 1 | PG3_OCD == 1)
  93. } else if (Diagnosis == 'PMDD') {
  94. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_PMDD == 1 | PG2_PMDD == 1 | PG3_SUD == 1)
  95. } else if (Diagnosis == 'Schizophrenia') {
  96. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_Schizophrenia == 1 | PG2_Schizophrenia == 1 | PG3_Schizophrenia == 1)
  97. } else if (Diagnosis == 'SUD') {
  98. FgtC_P_Activated <- subset(FgtC_P_Activated, PG1_SUD == 1 | PG2_SUD == 1 | PG3_SUD == 1)
  99. }
  100. ```
  101. #Select the columns that will be used
  102. ```{r}
  103. FgtC_P_Activated <- select(FgtC_P_Activated, c('Article_Num','Publication_Year',
  104. "ROI_regions",
  105. "FgtC_PgtC",
  106. "WB_Th",
  107. "ROI_Th"))
  108. colnames(FgtC_P_Activated) <- c("Article_Num", "Publication_Year", "ROI_regions", "FgtC_PgtC", "WB_Th", "ROI_Th")
  109. ```
  110. #Remove extra strings and make all lower case
  111. ```{r}
  112. FgtC_P_Activated[FgtC_P_Activated == "NA"] <- NA
  113. FgtC_P_Activated <- FgtC_P_Activated %>%
  114. mutate_at("ROI_regions", str_replace, "a priori: ", "")
  115. FgtC_P_Activated <- FgtC_P_Activated %>%
  116. mutate_at("ROI_regions", str_replace, "post hoc: ", "")
  117. FgtC_P_Activated <- FgtC_P_Activated %>%
  118. mutate_at("ROI_regions", str_replace, "data driven: ", "")
  119. FgtC_P_Activated$ROI_regions <- tolower(FgtC_P_Activated$ROI_regions)
  120. FgtC_P_Activated$FgtC_PgtC <- tolower(FgtC_P_Activated$FgtC_PgtC)
  121. #Select the rows that will be used (only ones with patient groups)
  122. #FgtC_P_Activated <- filter(FgtC_P_Activated, !is.na(PG1_Diagnosis_stand))
  123. ```
  124. ```{r}
  125. #Create empty vector to store the total number of contrasts using each threshold:
  126. Th_Counts <- vector(mode = "numeric", length = 9)
  127. ```
  128. ###THRESHOLD 1: ROI/SVC --> UNCORRECTED
  129. #Th1: Get complete list of ROIs that were used
  130. ```{r}
  131. #ROI Threshold 1: ROI/SVC - P uncorrected
  132. FgtC_P_Specified_ROI1 <- filter(FgtC_P_Activated, ROI_Th == 1)
  133. Th1_ID <- FgtC_P_Specified_ROI1[,c("Article_Num", "Publication_Year")]
  134. Th_Counts[1] <- nrow(Th1_ID)
  135. ###GET ROIs THAT STUDIES SPECIFIED:
  136. #make columns based on the ROIs specified
  137. FgtC_P_Specified_ROI1 <- separate(FgtC_P_Specified_ROI1, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10"), sep = ',')
  138. #make into long format
  139. Headings <- melt(FgtC_P_Specified_ROI1[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  140. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  141. #make list of unique ROIs for the headings string matching columns/counts
  142. ROI_list <- sort(unique(Headings$value))
  143. ```
  144. #Th1: Split the reported activation
  145. ```{r}
  146. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  147. FgtC_P_Activated_ROI1 <- filter(FgtC_P_Activated, ROI_Th == 1)
  148. FgtC_P_Activated_ROI1 <- separate(FgtC_P_Activated_ROI1, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  149. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  150. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  151. FgtC_P_Activated_ROI1 <- FgtC_P_Activated_ROI1 %>% mutate(across(where(is.character), str_trim))
  152. ```
  153. #Th1: Code if an ROI was selected (Searched_ROI_Th1) and if it was reported as activated (Counts_ROI_Th1)
  154. ```{r}
  155. #Remove extra columns from Specified + Activated
  156. FgtC_P_Specified_ROI1 <- select(FgtC_P_Specified_ROI1, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  157. FgtC_P_Activated_ROI1 <- select(FgtC_P_Activated_ROI1, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  158. GroupList = ROI_list
  159. #Create empty dataframe to store the counts
  160. Counts_ROI_Th1 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI1)))
  161. Searched_ROI_Th1 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI1)))
  162. colnames(Counts_ROI_Th1) <- c(ROI_list)
  163. colnames(Searched_ROI_Th1) <- c(ROI_list)
  164. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  165. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  166. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")
  167. for (n in 1:nrow(FgtC_P_Activated_ROI1)){ #for each row of the ROI_1 df
  168. #print(as.integer(n))
  169. ColList <- names(FgtC_P_Specified_ROI1)[!is.na(FgtC_P_Specified_ROI1[n,])] #only select the ROIs that they said they were interested in
  170. ROIs_Specified <- as.character(FgtC_P_Specified_ROI1[n, ColList])
  171. for (c in ROIs_Specified){ #for the ROIs that they said they were interested in
  172. #print(c)
  173. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  174. #print(group)
  175. if (grepl(GroupList[which(GroupList == group)], c)) { #If they searched for it, add a 1 to the the column in the df
  176. #print(group)
  177. Searched_ROI_Th1[n,group] <- (1)
  178. if (sum(grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI1[n,AllActivatedCols])) >= 1){ #if they reported it was active, add a 1 to the column in the df
  179. Counts_ROI_Th1[n,group] <- (1)}
  180. }
  181. }
  182. }
  183. }
  184. #Mutate and put into a neat df (Th1)
  185. Searched_ROI_Th1 <- mutate_all(Searched_ROI_Th1, function(x) as.numeric(as.character(x)))
  186. Counts_ROI_Th1 <- mutate_all(Counts_ROI_Th1, function(x) as.numeric(as.character(x)))
  187. Counts_ROI_Th1[,c("Article_Num", "Publication_Year")] <- Th1_ID[,c("Article_Num", "Publication_Year")]
  188. Searched_ROI_Th1[,c("Article_Num", "Publication_Year")] <- Th1_ID[,c("Article_Num", "Publication_Year")]
  189. Th1 <- data.frame(matrix(ncol = length(ROI_list), nrow = 2))
  190. colnames(Th1) <- c(ROI_list)
  191. row.names(Th1) <- c("Searched", "Activated")
  192. Th1[1,] <- colSums(Searched_ROI_Th1, na.rm = TRUE)
  193. Th1[2,] <- colSums(Counts_ROI_Th1, na.rm = TRUE)
  194. Th1[3,] <- Th1[2,]/Th1[1,] * 100
  195. #write.csv(Th1, "M:/Documents/Hariri_review/Data_Vis/Th1.csv", row.names=TRUE)
  196. ```
  197. ```{r}
  198. #Clean the workspace:
  199. rm(Headings)
  200. rm(GroupList)
  201. rm(ColList)
  202. rm(ROIs_Specified)
  203. rm(Th1_ID)
  204. #rm(Headings_Active)
  205. ```
  206. ###THRESHOLD 2: ROI/SVC --> FDR corrected
  207. #Th2: Get complete list of ROIs that were used
  208. ```{r}
  209. #ROI Threshold 2: ROI/SVC --> FDR corrected
  210. FgtC_P_Specified_ROI2 <- filter(FgtC_P_Activated, ROI_Th == 2)
  211. Th2_ID <- FgtC_P_Specified_ROI2[,c("Article_Num", "Publication_Year")]
  212. Th_Counts[2] <- nrow(Th2_ID)
  213. ###GET ROIs THAT STUDIES SPECIFIED:
  214. #make columns based on the ROIs specified
  215. FgtC_P_Specified_ROI2 <- separate(FgtC_P_Specified_ROI2, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  216. #make into long format
  217. Headings <- melt(FgtC_P_Specified_ROI2[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  218. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  219. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  220. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  221. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  222. #make list of unique ROIs for the headings string matching columns/counts
  223. ROI_list <- sort(unique(Headings$value))
  224. ```
  225. #Th2: Split the reported activation
  226. ```{r}
  227. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  228. FgtC_P_Activated_ROI2 <- filter(FgtC_P_Activated, ROI_Th == 2)
  229. FgtC_P_Activated_ROI2 <- separate(FgtC_P_Activated_ROI2, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  230. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  231. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  232. FgtC_P_Activated_ROI2 <- FgtC_P_Activated_ROI2 %>% mutate(across(where(is.character), str_trim))
  233. ```
  234. #Th2: Code if an ROI was selected (Searched_ROI_Th1) and if it was reported as activated (Counts_ROI_Th1)
  235. ```{r}
  236. #Remove extra columns from Specified + Activated
  237. FgtC_P_Specified_ROI2 <- select(FgtC_P_Specified_ROI2, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  238. FgtC_P_Activated_ROI2 <- select(FgtC_P_Activated_ROI2, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  239. GroupList = ROI_list
  240. #Create empty dataframe to store the counts
  241. Counts_ROI_Th2 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI2)))
  242. Searched_ROI_Th2 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI2)))
  243. colnames(Counts_ROI_Th2) <- c(ROI_list)
  244. colnames(Searched_ROI_Th2) <- c(ROI_list)
  245. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  246. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  247. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")
  248. for (n in 1:nrow(FgtC_P_Specified_ROI2)){ #for each row of the ROI_1 df
  249. #print(as.integer(n))
  250. ColList <- names(FgtC_P_Specified_ROI2)[!is.na(FgtC_P_Specified_ROI2[n,])] #only select the ROIs that they said they were interested in
  251. ROIs_Specified <- as.character(FgtC_P_Specified_ROI2[n, ColList])
  252. for (c in ROIs_Specified){ #for the ROIs that they said they were interested in
  253. #print(c)
  254. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  255. #print(group)
  256. if (grepl(GroupList[which(GroupList == group)], c)) { #If they searched for it, add a 1 to the the column in the df
  257. #print(group)
  258. Searched_ROI_Th2[n,group] <- (1)
  259. if (sum(grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI2[n,AllActivatedCols])) >= 1){ #if they reported it was active, add a 1 to the column in the df
  260. Counts_ROI_Th2[n,group] <- (1)}
  261. }
  262. }
  263. }
  264. }
  265. #Mutate and put into a neat df (Th1)
  266. Searched_ROI_Th2 <- mutate_all(Searched_ROI_Th2, function(x) as.numeric(as.character(x)))
  267. Counts_ROI_Th2 <- mutate_all(Counts_ROI_Th2, function(x) as.numeric(as.character(x)))
  268. Counts_ROI_Th2[,c("Article_Num", "Publication_Year")] <- Th2_ID[,c("Article_Num", "Publication_Year")]
  269. Searched_ROI_Th2[,c("Article_Num", "Publication_Year")] <- Th2_ID[,c("Article_Num", "Publication_Year")]
  270. Th2 <- data.frame(matrix(ncol = length(ROI_list), nrow = 2))
  271. colnames(Th2) <- c(ROI_list)
  272. row.names(Th2) <- c("Searched", "Activated")
  273. Th2[1,] <- colSums(Searched_ROI_Th2, na.rm = TRUE)
  274. Th2[2,] <- colSums(Counts_ROI_Th2, na.rm = TRUE)
  275. Th2[3,] <- Th2[2,]/Th2[1,] * 100
  276. #write.csv(Th2, "M:/Documents/Hariri_review/Data_Vis/Th2.csv", row.names=TRUE)
  277. ```
  278. ```{r}
  279. #Clean the workspace:
  280. rm(Headings)
  281. rm(GroupList)
  282. rm(ColList)
  283. rm(ROIs_Specified)
  284. rm(Th2_ID)
  285. #rm(Headings_Active)
  286. ```
  287. ###THRESHOLD 3: ROI/SVC --> FWE corrected + Simulation
  288. #Th3: Get complete list of ROIs that were used
  289. ```{r}
  290. #ROI Threshold 3: ROI/SVC --> FWE corrected + Simulation
  291. FgtC_P_Specified_ROI3 <- filter(FgtC_P_Activated, ROI_Th == 3)
  292. Th3_ID <- FgtC_P_Specified_ROI3[,c("Article_Num", "Publication_Year")]
  293. Th_Counts[3] <- nrow(Th3_ID)
  294. ###GET ROIs THAT STUDIES SPECIFIED:
  295. #make columns based on the ROIs specified
  296. FgtC_P_Specified_ROI3 <- separate(FgtC_P_Specified_ROI3, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  297. #make into long format
  298. Headings <- melt(FgtC_P_Specified_ROI3[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  299. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  300. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  301. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  302. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  303. #make list of unique ROIs for the headings string matching columns/counts
  304. ROI_list <- sort(unique(Headings$value))
  305. ```
  306. #Th3: Split the reported activation
  307. ```{r}
  308. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  309. FgtC_P_Activated_ROI3 <- filter(FgtC_P_Activated, ROI_Th == 3)
  310. FgtC_P_Activated_ROI3 <- separate(FgtC_P_Activated_ROI3, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  311. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  312. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  313. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40",
  314. "Region41", "Region42", "Region43", "Region44", "Region45"), sep = ',')
  315. FgtC_P_Activated_ROI3 <- FgtC_P_Activated_ROI3 %>% mutate(across(where(is.character), str_trim))
  316. ```
  317. #Th3: Code if an ROI was selected (Searched_ROI_Th1) and if it was reported as activated (Counts_ROI_Th1)
  318. ```{r}
  319. #Remove extra columns from Specified + Activated
  320. FgtC_P_Specified_ROI3 <- select(FgtC_P_Specified_ROI3, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  321. FgtC_P_Activated_ROI3 <- select(FgtC_P_Activated_ROI3, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  322. GroupList = ROI_list
  323. #Create empty dataframe to store the counts
  324. Counts_ROI_Th3 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI3)))
  325. Searched_ROI_Th3 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI3)))
  326. colnames(Counts_ROI_Th3) <- c(ROI_list)
  327. colnames(Searched_ROI_Th3) <- c(ROI_list)
  328. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  329. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  330. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  331. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40",
  332. "Region41", "Region42", "Region43", "Region44", "Region45")
  333. for (n in 1:nrow(FgtC_P_Specified_ROI3)){ #for each row of the ROI_1 df
  334. #print(as.integer(n))
  335. ColList <- names(FgtC_P_Specified_ROI3)[!is.na(FgtC_P_Specified_ROI3[n,])] #only select the ROIs that they said they were interested in
  336. ROIs_Specified <- as.character(FgtC_P_Specified_ROI3[n, ColList])
  337. for (c in ROIs_Specified){ #for the ROIs that they said they were interested in
  338. #print(c)
  339. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  340. #print(group)
  341. if (grepl(GroupList[which(GroupList == group)], c)) { #If they searched for it, add a 1 to the the column in the df
  342. #print(group)
  343. Searched_ROI_Th3[n,group] <- (1)
  344. if (sum(grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI3[n,AllActivatedCols])) >= 1){ #if they reported it was active, add a 1 to the column in the df
  345. Counts_ROI_Th3[n,group] <- (1)}
  346. }
  347. }
  348. }
  349. }
  350. #Mutate and put into a neat df (Th1)
  351. Searched_ROI_Th3 <- mutate_all(Searched_ROI_Th3, function(x) as.numeric(as.character(x)))
  352. Counts_ROI_Th3 <- mutate_all(Counts_ROI_Th3, function(x) as.numeric(as.character(x)))
  353. Counts_ROI_Th3[,c("Article_Num", "Publication_Year")] <- Th3_ID[,c("Article_Num", "Publication_Year")]
  354. Searched_ROI_Th3[,c("Article_Num", "Publication_Year")] <- Th3_ID[,c("Article_Num", "Publication_Year")]
  355. Th3 <- data.frame(matrix(ncol = length(ROI_list), nrow = 2))
  356. colnames(Th3) <- c(ROI_list)
  357. row.names(Th3) <- c("Searched", "Activated")
  358. Th3[1,] <- colSums(Searched_ROI_Th3, na.rm = TRUE)
  359. Th3[2,] <- colSums(Counts_ROI_Th3, na.rm = TRUE)
  360. Th3[3,] <- Th3[2,]/Th3[1,] * 100
  361. #write.csv(Th3, "M:/Documents/Hariri_review/Data_Vis/Th3.csv", row.names=TRUE)
  362. ```
  363. ```{r}
  364. #Clean the workspace:
  365. rm(Headings)
  366. rm(GroupList)
  367. rm(ColList)
  368. rm(ROIs_Specified)
  369. rm(Th3_ID)
  370. #rm(Headings_Active)
  371. ```
  372. ###THRESHOLD 4: ROI/SVC --> Other (unspecified multiple corrections)
  373. #Th4: Get complete list of ROIs that were used
  374. ```{r}
  375. #ROI Threshold 4: ROI/SVC --> Other (unspecified multiple corrections)
  376. FgtC_P_Specified_ROI4 <- filter(FgtC_P_Activated, ROI_Th == 4)
  377. Th4_ID <- FgtC_P_Specified_ROI4[,c("Article_Num", "Publication_Year")]
  378. Th_Counts[4] <- nrow(Th4_ID)
  379. ###GET ROIs THAT STUDIES SPECIFIED:
  380. #make columns based on the ROIs specified
  381. FgtC_P_Specified_ROI4 <- separate(FgtC_P_Specified_ROI4, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  382. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  383. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  384. #make into long format
  385. Headings <- melt(FgtC_P_Specified_ROI4[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  386. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  387. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  388. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  389. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  390. #make list of unique ROIs for the headings string matching columns/counts
  391. ROI_list <- sort(unique(Headings$value))
  392. ```
  393. #Th4: Split the reported activation
  394. ```{r}
  395. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  396. FgtC_P_Activated_ROI4 <- filter(FgtC_P_Activated, ROI_Th == 4)
  397. FgtC_P_Activated_ROI4 <- separate(FgtC_P_Activated_ROI4, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  398. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  399. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  400. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40"), sep = ',')
  401. FgtC_P_Activated_ROI4 <- FgtC_P_Activated_ROI4 %>% mutate(across(where(is.character), str_trim))
  402. ```
  403. #Th4: Code if an ROI was selected (Searched_ROI_Th4) and if it was reported as activated (Counts_ROI_Th4)
  404. ```{r}
  405. #Remove extra columns from Specified + Activated
  406. FgtC_P_Specified_ROI4 <- select(FgtC_P_Specified_ROI4, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  407. FgtC_P_Activated_ROI4 <- select(FgtC_P_Activated_ROI4, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  408. GroupList = ROI_list
  409. #Create empty dataframe to store the counts
  410. Counts_ROI_Th4 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI4)))
  411. Searched_ROI_Th4 <- data.frame(matrix(ncol = length(ROI_list), nrow = nrow(FgtC_P_Activated_ROI4)))
  412. colnames(Counts_ROI_Th4) <- c(ROI_list)
  413. colnames(Searched_ROI_Th4) <- c(ROI_list)
  414. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  415. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  416. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  417. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  418. for (n in 1:nrow(FgtC_P_Specified_ROI4)){ #for each row of the ROI_1 df
  419. #print(as.integer(n))
  420. ColList <- names(FgtC_P_Specified_ROI4)[!is.na(FgtC_P_Specified_ROI4[n,])] #only select the ROIs that they said they were interested in
  421. ROIs_Specified <- as.character(FgtC_P_Specified_ROI4[n, ColList])
  422. for (c in ROIs_Specified){ #for the ROIs that they said they were interested in
  423. #print(c)
  424. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  425. #print(group)
  426. if (grepl(GroupList[which(GroupList == group)], c)) { #If they searched for it, add a 1 to the the column in the df
  427. #print(group)
  428. Searched_ROI_Th4[n,group] <- (1)
  429. if (sum(grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI4[n,AllActivatedCols])) >= 1){ #if they reported it was active, add a 1 to the column in the df
  430. Counts_ROI_Th4[n,group] <- (1)}
  431. }
  432. }
  433. }
  434. }
  435. #Mutate and put into a neat df (Th1)
  436. Searched_ROI_Th4 <- mutate_all(Searched_ROI_Th4, function(x) as.numeric(as.character(x)))
  437. Counts_ROI_Th4 <- mutate_all(Counts_ROI_Th4, function(x) as.numeric(as.character(x)))
  438. Counts_ROI_Th4[,c("Article_Num", "Publication_Year")] <- Th4_ID[,c("Article_Num", "Publication_Year")]
  439. Searched_ROI_Th4[,c("Article_Num", "Publication_Year")] <- Th4_ID[,c("Article_Num", "Publication_Year")]
  440. Th4 <- data.frame(matrix(ncol = length(ROI_list), nrow = 2))
  441. colnames(Th4) <- c(ROI_list)
  442. row.names(Th4) <- c("Searched", "Activated")
  443. Th4[1,] <- colSums(Searched_ROI_Th4, na.rm = TRUE)
  444. Th4[2,] <- colSums(Counts_ROI_Th4, na.rm = TRUE)
  445. Th4[3,] <- Th4[2,]/Th4[1,] * 100
  446. #write.csv(Th4, "M:/Documents/Hariri_review/Data_Vis/Th4.csv", row.names=TRUE)
  447. ```
  448. ```{r}
  449. #Clean the workspace:
  450. rm(Headings)
  451. rm(GroupList)
  452. rm(ColList)
  453. rm(ROIs_Specified)
  454. rm(Th4_ID)
  455. #rm(Headings_Active)
  456. ```
  457. #Create a combined ROI count file to remove from whole brain results.
  458. ```{r}
  459. Combined_ROIs <- bind_rows(Searched_ROI_Th1,Searched_ROI_Th2,Searched_ROI_Th3,Searched_ROI_Th4)
  460. ```
  461. ###THRESHOLD 5: WHOLE BRAIN --> Uncorrected
  462. #Th5: Get complete list of ROIs that were used
  463. ```{r}
  464. #ROI Threshold 5: WHOLE BRAIN --> Uncorrected
  465. FgtC_P_Specified_ROI5 <- filter(FgtC_P_Activated, WB_Th == 5)
  466. Th5_ID <- FgtC_P_Specified_ROI5[,c("Article_Num", "Publication_Year")]
  467. Th_Counts[5] <- nrow(Th5_ID)
  468. ###GET ROIs THAT STUDIES SPECIFIED:
  469. #make columns based on the ROIs specified
  470. FgtC_P_Specified_ROI5 <- separate(FgtC_P_Specified_ROI5, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  471. #make into long format
  472. Headings <- melt(FgtC_P_Specified_ROI5[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  473. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  474. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  475. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  476. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  477. #make list of unique ROIs for the headings string matching columns/counts
  478. ROI_list <- sort(unique(Headings$value))
  479. ```
  480. #Th5: Split the reported activation
  481. ```{r}
  482. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  483. FgtC_P_Activated_ROI5 <- filter(FgtC_P_Activated, WB_Th == 5)
  484. FgtC_P_Activated_ROI5 <- separate(FgtC_P_Activated_ROI5, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  485. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  486. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  487. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40",
  488. "Region41", "Region42", "Region43", "Region44", "Region45"), sep = ',')
  489. FgtC_P_Activated_ROI5 <- FgtC_P_Activated_ROI5 %>% mutate(across(where(is.character), str_trim))
  490. #make into long format
  491. Headings_Active <- melt(FgtC_P_Activated_ROI5[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  492. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  493. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  494. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40",
  495. "Region41", "Region42", "Region43", "Region44", "Region45")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  496. Headings_Active$value <- str_trim(Headings_Active$value, side = c("both", "left", "right"))
  497. Active_List <- sort(unique(Headings_Active$value))
  498. ```
  499. #Th5: Code which regions were reported as activated (Counts_ROI_Th5)
  500. ```{r}
  501. #Remove extra columns from Specified + Activated
  502. FgtC_P_Specified_ROI5 <- select(FgtC_P_Specified_ROI5, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  503. FgtC_P_Activated_ROI5 <- select(FgtC_P_Activated_ROI5, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  504. GroupList = Active_List #Instead of searching within the Regions that were
  505. #Create empty data frame to store the counts
  506. Counts_ROI_Th5 <- data.frame(matrix(ncol = length(Active_List), nrow = nrow(FgtC_P_Activated_ROI5)))
  507. colnames(Counts_ROI_Th5) <- c(Active_List)
  508. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  509. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  510. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  511. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  512. for (n in 1:nrow(FgtC_P_Activated_ROI5)){ #for each row of the Activated df
  513. #print(as.integer(n))
  514. ColList <- names(FgtC_P_Activated_ROI5)[!is.na(FgtC_P_Activated_ROI5[n,])] #only select the Activated columns that have
  515. for (c in ColList){ #for the ROIs that they said they were interested in
  516. #print(c)
  517. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  518. #print(group)
  519. if (grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI5[n,c])) { #If they said it was activated add a 1 to the the column in the df
  520. #print(group)
  521. Counts_ROI_Th5[n,group] <- (1)
  522. #if (sum(grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI5[n,AllActivatedCols])) >= 1){ #if they reported it was active, add a 1 to the column in the df
  523. # Counts_ROI_Th5[n,group] <- (1)}
  524. }
  525. }
  526. }
  527. }
  528. #Mutate and put into a neat df (Th5)
  529. Counts_ROI_Th5 <- mutate_all(Counts_ROI_Th5, function(x) as.numeric(as.character(x)))
  530. Counts_ROI_Th5[,c("Article_Num", "Publication_Year")] <- Th5_ID[,c("Article_Num", "Publication_Year")]
  531. ```
  532. #Th5: Remove activated regions if they were from an ROI analysis (Combined_ROIs)
  533. ```{r}
  534. Article_Nums <- Counts_ROI_Th5[,c("Article_Num")]
  535. for (a in Article_Nums){
  536. #print(paste0("Article_Num =", a))
  537. if (a %in% Combined_ROIs$Article_Num){
  538. r = which(Combined_ROIs$Article_Num %in% a)
  539. q = which(Counts_ROI_Th5$Article_Num %in% a)
  540. #print(paste0("It is row ", r, " of the Combined ROI file, and row ", q, "of the Th5 Counts"))
  541. for (c in colnames(Combined_ROIs)){
  542. if(is.na(Combined_ROIs[r,c])){ #If it is not empty in the ROI or the Counts list (i.e. they searched for it and found it)
  543. next #Code as ROI
  544. }
  545. else {
  546. #print(paste0(c, " is where they have searched for"))
  547. Counts_ROI_Th5[q,c] <- "ROI"}
  548. }
  549. }
  550. else {
  551. #print("This study did not use an ROI")
  552. }
  553. }
  554. #Save version with ROIs indicated
  555. Counts_ROI_Th5_wROI <- Counts_ROI_Th5
  556. #Remove ROIs and count
  557. Counts_ROI_Th5[Counts_ROI_Th5 == "ROI"] <- NA
  558. Counts_ROI_Th5<- mutate_all(Counts_ROI_Th5, function(x) as.numeric(as.character(x)))
  559. Counts_ROI_Th5[,c("Article_Num", "Publication_Year")] <- Th5_ID[,c("Article_Num", "Publication_Year")] #Re-fill this in as some got removed during "ROI" removing
  560. Th5 <- data.frame(matrix(ncol = length(Active_List), nrow = 2))
  561. colnames(Th5) <- c(Active_List)
  562. row.names(Th5) <- c("Applied", "Activated")
  563. Th5[1,] <- nrow(FgtC_P_Specified_ROI5)
  564. Th5[2,] <- colSums(Counts_ROI_Th5, na.rm = TRUE)
  565. #Th5[2,] <- 1
  566. Th5[3,] <- Th5[1,]/nrow(Counts_ROI_Th5) * 100
  567. #write.csv(Th5, "M:/Documents/Hariri_review/Data_Vis/Th5.csv", row.names=TRUE)
  568. ```
  569. ```{r}
  570. #Clean the workspace:
  571. rm(Headings)
  572. rm(GroupList)
  573. rm(ColList)
  574. rm(Th5_ID)
  575. rm(Headings_Active)
  576. ```
  577. ###THRESHOLD 6: WHOLE BRAIN --> FDR corrected
  578. #Th6: Get complete list of ROIs that were used
  579. ```{r}
  580. #ROI Threshold 6: WHOLE BRAIN --> Uncorrected
  581. FgtC_P_Specified_ROI6 <- filter(FgtC_P_Activated, WB_Th == 6)
  582. Th6_ID <- FgtC_P_Specified_ROI6[,c("Article_Num", "Publication_Year")]
  583. Th_Counts[6] <- nrow(Th6_ID)
  584. ###GET ROIs THAT STUDIES SPECIFIED:
  585. #make columns based on the ROIs specified
  586. FgtC_P_Specified_ROI6 <- separate(FgtC_P_Specified_ROI6, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  587. #make into long format
  588. Headings <- melt(FgtC_P_Specified_ROI6[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  589. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  590. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  591. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  592. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  593. #make list of unique ROIs for the headings string matching columns/counts
  594. ROI_list <- sort(unique(Headings$value))
  595. ```
  596. #Th6: Split the reported activation
  597. ```{r}
  598. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  599. FgtC_P_Activated_ROI6 <- filter(FgtC_P_Activated, WB_Th == 6)
  600. FgtC_P_Activated_ROI6 <- separate(FgtC_P_Activated_ROI6, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  601. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  602. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  603. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40"), sep = ',')
  604. FgtC_P_Activated_ROI6 <- FgtC_P_Activated_ROI6 %>% mutate(across(where(is.character), str_trim))
  605. #make into long format
  606. Headings_Active <- melt(FgtC_P_Activated_ROI6[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  607. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  608. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  609. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  610. Headings_Active$value <- str_trim(Headings_Active$value, side = c("both", "left", "right"))
  611. Active_List <- sort(unique(Headings_Active$value))
  612. ```
  613. #Th6: Code which regions were reported as activated (Counts_ROI_Th5)
  614. ```{r}
  615. #Remove extra columns from Specified + Activated
  616. FgtC_P_Specified_ROI6 <- select(FgtC_P_Specified_ROI6, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  617. FgtC_P_Activated_ROI6 <- select(FgtC_P_Activated_ROI6, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  618. GroupList = ROI_list
  619. GroupList = Active_List #Instead of searching within the Regions that were
  620. #Create empty data frame to store the counts
  621. Counts_ROI_Th6 <- data.frame(matrix(ncol = length(Active_List), nrow = nrow(FgtC_P_Activated_ROI6)))
  622. colnames(Counts_ROI_Th6) <- c(Active_List)
  623. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  624. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  625. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  626. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  627. for (n in 1:nrow(FgtC_P_Activated_ROI6)){ #for each row of the Activated df
  628. #print(as.integer(n))
  629. ColList <- names(FgtC_P_Activated_ROI6)[!is.na(FgtC_P_Activated_ROI6[n,])] #only select the Activated columns that have
  630. for (c in ColList){ #for the ROIs that they said they were interested in
  631. #print(c)
  632. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  633. #print(group)
  634. if (grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI6[n,c])) { #If they said it was activated add a 1 to the the column in the df
  635. #print(group)
  636. Counts_ROI_Th6[n,group] <- (1)
  637. }
  638. }
  639. }
  640. }
  641. #Mutate and put into a neat df (Th5)
  642. Counts_ROI_Th6 <- mutate_all(Counts_ROI_Th6, function(x) as.numeric(as.character(x)))
  643. Counts_ROI_Th6[,c("Article_Num", "Publication_Year")] <- Th6_ID[,c("Article_Num", "Publication_Year")]
  644. ```
  645. #Th6: Remove activated regions if they were from an ROI analysis (Combined_ROIs)
  646. ```{r}
  647. Article_Nums <- Counts_ROI_Th6[,c("Article_Num")]
  648. for (a in Article_Nums){
  649. #print(paste0("Article_Num =", a))
  650. if (a %in% Combined_ROIs$Article_Num){
  651. r = which(Combined_ROIs$Article_Num %in% a)
  652. q = which(Counts_ROI_Th6$Article_Num %in% a)
  653. #print(paste0("It is row ", r, " of the Combined ROI file, and row ", q, "of the Th6 Counts"))
  654. for (c in colnames(Combined_ROIs)){
  655. if(is.na(Combined_ROIs[r,c])){ #If it is not empty in the ROI or the Counts list (i.e. they searched for it and found it)
  656. next #Code as ROI
  657. }
  658. else {
  659. #print(paste0(c, " is where they have searched for"))
  660. Counts_ROI_Th6[q,c] <- "ROI"}
  661. }
  662. }
  663. else {
  664. #print("This study did not use an ROI")
  665. }
  666. }
  667. #Save version with ROIs indicated
  668. Counts_ROI_Th6_wROI <- Counts_ROI_Th6
  669. #Remove ROIs and count
  670. Counts_ROI_Th6[Counts_ROI_Th6 == "ROI"] <- NA
  671. Counts_ROI_Th6<- mutate_all(Counts_ROI_Th6, function(x) as.numeric(as.character(x)))
  672. Counts_ROI_Th6[,c("Article_Num", "Publication_Year")] <- Th6_ID[,c("Article_Num", "Publication_Year")] #Re-fill this in as some got removed during "ROI" removing
  673. Th6 <- data.frame(matrix(ncol = length(Active_List), nrow = 2))
  674. colnames(Th6) <- c(Active_List)
  675. row.names(Th6) <- c("Applied", "Activated")
  676. Th6[1,] <- nrow(FgtC_P_Specified_ROI6)
  677. Th6[2,] <- colSums(Counts_ROI_Th6, na.rm = TRUE)
  678. #Th6[2,] <- 2
  679. Th6[3,] <- Th6[1,]/nrow(Counts_ROI_Th6) * 100
  680. #write.csv(Th6, "M:/Documents/Hariri_review/Data_Vis/Th6.csv", row.names=TRUE)
  681. ```
  682. ```{r}
  683. #Clean the workspace:
  684. rm(Headings)
  685. rm(GroupList)
  686. rm(ColList)
  687. rm(Th6_ID)
  688. rm(Headings_Active)
  689. ```
  690. ###THRESHOLD 7: Whole brain --> FWE corrected + Simulation
  691. #Th7: Get complete list of ROIs that were used
  692. ```{r}
  693. #ROI Threshold 5: WHOLE BRAIN --> Uncorrected
  694. FgtC_P_Specified_ROI7 <- filter(FgtC_P_Activated, WB_Th == 7)
  695. Th7_ID <- FgtC_P_Specified_ROI7[,c("Article_Num", "Publication_Year")]
  696. Th_Counts[7] <- nrow(Th7_ID)
  697. ###GET ROIs THAT STUDIES SPECIFIED:
  698. #make columns based on the ROIs specified
  699. FgtC_P_Specified_ROI7 <- separate(FgtC_P_Specified_ROI7, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  700. #make into long format
  701. Headings <- melt(FgtC_P_Specified_ROI7[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  702. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  703. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  704. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  705. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  706. #make list of unique ROIs for the headings string matching columns/counts
  707. ROI_list <- sort(unique(Headings$value))
  708. ```
  709. #Th7: Split the reported activation
  710. ```{r}
  711. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  712. FgtC_P_Activated_ROI7 <- filter(FgtC_P_Activated, WB_Th == 7)
  713. FgtC_P_Activated_ROI7 <- separate(FgtC_P_Activated_ROI7, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  714. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  715. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  716. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40"), sep = ',')
  717. FgtC_P_Activated_ROI7 <- FgtC_P_Activated_ROI7 %>% mutate(across(where(is.character), str_trim))
  718. #make into long format
  719. Headings_Active <- melt(FgtC_P_Activated_ROI7[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  720. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  721. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  722. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  723. Headings_Active$value <- str_trim(Headings_Active$value, side = c("both", "left", "right"))
  724. Active_List <- sort(unique(Headings_Active$value))
  725. ```
  726. #Th7: Code which regions were reported as activated (Counts_ROI_Th5)
  727. ```{r}
  728. #Remove extra columns from Specified + Activated
  729. FgtC_P_Specified_ROI7 <- select(FgtC_P_Specified_ROI7, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  730. FgtC_P_Activated_ROI7 <- select(FgtC_P_Activated_ROI7, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  731. GroupList = ROI_list
  732. GroupList = Active_List #Instead of searching within the Regions that were
  733. #Create empty data frame to store the counts
  734. Counts_ROI_Th7 <- data.frame(matrix(ncol = length(Active_List), nrow = nrow(FgtC_P_Activated_ROI7)))
  735. colnames(Counts_ROI_Th7) <- c(Active_List)
  736. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  737. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  738. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  739. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  740. for (n in 1:nrow(FgtC_P_Activated_ROI7)){ #for each row of the Activated df
  741. #print(as.integer(n))
  742. ColList <- names(FgtC_P_Activated_ROI7)[!is.na(FgtC_P_Activated_ROI7[n,])] #only select the Activated columns that have
  743. for (c in ColList){ #for the ROIs that they said they were interested in
  744. #print(c)
  745. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  746. #print(group)
  747. if (grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI7[n,c])) { #If they said it was activated add a 1 to the the column in the df
  748. #print(group)
  749. Counts_ROI_Th7[n,group] <- (1)
  750. }
  751. }
  752. }
  753. }
  754. #Mutate and put into a neat df (Th5)
  755. Counts_ROI_Th7 <- mutate_all(Counts_ROI_Th7, function(x) as.numeric(as.character(x)))
  756. Counts_ROI_Th7[,c("Article_Num", "Publication_Year")] <- Th7_ID[,c("Article_Num", "Publication_Year")]
  757. ```
  758. #Th7: Remove activated regions if they were from an ROI analysis (Combined_ROIs)
  759. ```{r}
  760. Article_Nums <- Counts_ROI_Th7[,c("Article_Num")]
  761. for (a in Article_Nums){
  762. #print(paste0("Article_Num =", a))
  763. if (a %in% Combined_ROIs$Article_Num){
  764. r = which(Combined_ROIs$Article_Num %in% a)
  765. q = which(Counts_ROI_Th7$Article_Num %in% a)
  766. #print(paste0("It is row ", r, " of the Combined ROI file, and row ", q, "of the Th7 Counts"))
  767. for (c in colnames(Combined_ROIs)){
  768. if(is.na(Combined_ROIs[r,c])){ #If it is not empty in the ROI or the Counts list (i.e. they searched for it and found it)
  769. next #Code as ROI
  770. }
  771. else {
  772. #print(paste0(c, " is where they have searched for"))
  773. Counts_ROI_Th7[q,c] <- "ROI"}
  774. }
  775. }
  776. else {
  777. #print("This study did not use an ROI")
  778. }
  779. }
  780. #Save version with ROIs indicated
  781. Counts_ROI_Th7_wROI <- Counts_ROI_Th7
  782. #Remove ROIs and count
  783. Counts_ROI_Th7[Counts_ROI_Th7 == "ROI"] <- NA
  784. Counts_ROI_Th7<- mutate_all(Counts_ROI_Th7, function(x) as.numeric(as.character(x)))
  785. Counts_ROI_Th7[,c("Article_Num", "Publication_Year")] <- Th7_ID[,c("Article_Num", "Publication_Year")] #Re-fill this in as some got removed during "ROI" removing
  786. Th7 <- data.frame(matrix(ncol = length(Active_List), nrow = 2))
  787. colnames(Th7) <- c(Active_List)
  788. row.names(Th7) <- c("Applied", "Activated")
  789. Th7[1,] <- nrow(FgtC_P_Specified_ROI7)
  790. Th7[2,] <- colSums(Counts_ROI_Th7, na.rm = TRUE)
  791. #Th7[2,] <- 2
  792. Th7[3,] <- Th7[1,]/nrow(Counts_ROI_Th7) * 100
  793. #write.csv(Th7, "M:/Documents/Hariri_review/Data_Vis/Th7.csv", row.names=TRUE)
  794. ```
  795. ```{r}
  796. #Clean the workspace:
  797. rm(Headings)
  798. rm(GroupList)
  799. rm(ColList)
  800. rm(Th7_ID)
  801. rm(Headings_Active)
  802. ```
  803. ###THRESHOLD 8: Whole brain --> Other (unspecified multiple corrections)
  804. #Th8: Get complete list of ROIs that were used
  805. ```{r}
  806. #ROI Threshold 5: WHOLE BRAIN --> Uncorrected
  807. FgtC_P_Specified_ROI8 <- filter(FgtC_P_Activated, WB_Th == 8)
  808. Th8_ID <- FgtC_P_Specified_ROI8[,c("Article_Num", "Publication_Year")]
  809. Th_Counts[8] <- nrow(Th8_ID)
  810. ###GET ROIs THAT STUDIES SPECIFIED:
  811. #make columns based on the ROIs specified
  812. FgtC_P_Specified_ROI8 <- separate(FgtC_P_Specified_ROI8, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  813. #make into long format
  814. Headings <- melt(FgtC_P_Specified_ROI8[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  815. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  816. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  817. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  818. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  819. #make list of unique ROIs for the headings string matching columns/counts
  820. ROI_list <- sort(unique(Headings$value))
  821. ```
  822. #Th8: Split the reported activation
  823. ```{r}
  824. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  825. FgtC_P_Activated_ROI8 <- filter(FgtC_P_Activated, WB_Th == 8)
  826. FgtC_P_Activated_ROI8 <- separate(FgtC_P_Activated_ROI8, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  827. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  828. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  829. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40"), sep = ',')
  830. FgtC_P_Activated_ROI8 <- FgtC_P_Activated_ROI8 %>% mutate(across(where(is.character), str_trim))
  831. #make into long format
  832. Headings_Active <- melt(FgtC_P_Activated_ROI8[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  833. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  834. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  835. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  836. Headings_Active$value <- str_trim(Headings_Active$value, side = c("both", "left", "right"))
  837. Active_List <- sort(unique(Headings_Active$value))
  838. ```
  839. #Th8: Code which regions were reported as activated (Counts_ROI_Th5)
  840. ```{r}
  841. #Remove extra columns from Specified + Activated
  842. FgtC_P_Specified_ROI8 <- select(FgtC_P_Specified_ROI8, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  843. FgtC_P_Activated_ROI8 <- select(FgtC_P_Activated_ROI8, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  844. GroupList = ROI_list
  845. GroupList = Active_List #Instead of searching within the Regions that were
  846. #Create empty data frame to store the counts
  847. Counts_ROI_Th8 <- data.frame(matrix(ncol = length(Active_List), nrow = nrow(FgtC_P_Activated_ROI8)))
  848. colnames(Counts_ROI_Th8) <- c(Active_List)
  849. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  850. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  851. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  852. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  853. for (n in 1:nrow(FgtC_P_Activated_ROI8)){ #for each row of the Activated df
  854. #print(as.integer(n))
  855. ColList <- names(FgtC_P_Activated_ROI8)[!is.na(FgtC_P_Activated_ROI8[n,])] #only select the Activated columns that have
  856. for (c in ColList){ #for the ROIs that they said they were interested in
  857. #print(c)
  858. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  859. #print(group)
  860. if (grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI8[n,c])) { #If they said it was activated add a 1 to the the column in the df
  861. #print(group)
  862. Counts_ROI_Th8[n,group] <- (1)
  863. }
  864. }
  865. }
  866. }
  867. #Mutate and put into a neat df (Th5)
  868. Counts_ROI_Th8 <- mutate_all(Counts_ROI_Th8, function(x) as.numeric(as.character(x)))
  869. Counts_ROI_Th8[,c("Article_Num", "Publication_Year")] <- Th8_ID[,c("Article_Num", "Publication_Year")]
  870. ```
  871. #Th8: Remove activated regions if they were from an ROI analysis (Combined_ROIs)
  872. ```{r}
  873. Article_Nums <- Counts_ROI_Th8[,c("Article_Num")]
  874. for (a in Article_Nums){
  875. #print(paste0("Article_Num =", a))
  876. if (a %in% Combined_ROIs$Article_Num){
  877. r = which(Combined_ROIs$Article_Num %in% a)
  878. q = which(Counts_ROI_Th8$Article_Num %in% a)
  879. #print(paste0("It is row ", r, " of the Combined ROI file, and row ", q, "of the Th8 Counts"))
  880. for (c in colnames(Combined_ROIs)){
  881. if(is.na(Combined_ROIs[r,c])){ #If it is not empty in the ROI or the Counts list (i.e. they searched for it and found it)
  882. next #Code as ROI
  883. }
  884. else {
  885. #print(paste0(c, " is where they have searched for"))
  886. Counts_ROI_Th8[q,c] <- "ROI"}
  887. }
  888. }
  889. else {
  890. #print("This study did not use an ROI")
  891. }
  892. }
  893. #Save version with ROIs indicated
  894. Counts_ROI_Th8_wROI <- Counts_ROI_Th8
  895. #Remove ROIs and count
  896. Counts_ROI_Th8[Counts_ROI_Th8 == "ROI"] <- NA
  897. Counts_ROI_Th8<- mutate_all(Counts_ROI_Th8, function(x) as.numeric(as.character(x)))
  898. Counts_ROI_Th8[,c("Article_Num", "Publication_Year")] <- Th8_ID[,c("Article_Num", "Publication_Year")] #Re-fill this in as some got removed during "ROI" removing
  899. Th8 <- data.frame(matrix(ncol = length(Active_List), nrow = 2))
  900. colnames(Th8) <- c(Active_List)
  901. row.names(Th8) <- c("Applied", "Activated")
  902. Th8[1,] <- nrow(FgtC_P_Activated_ROI8)
  903. Th8[2,] <- colSums(Counts_ROI_Th8, na.rm = TRUE)
  904. #Th8[2,] <- 2
  905. Th8[3,] <- Th8[1,]/nrow(Counts_ROI_Th8) * 100
  906. #write.csv(Th8, "M:/Documents/Hariri_review/Data_Vis/Th8.csv", row.names=TRUE)
  907. ```
  908. ```{r}
  909. #Clean the workspace:
  910. rm(Headings)
  911. rm(GroupList)
  912. rm(ColList)
  913. rm(Th8_ID)
  914. rm(Headings_Active)
  915. ```
  916. ###THRESHOLD 9: Other
  917. #Th9: Get complete list of ROIs that were used
  918. ```{r}
  919. #ROI Threshold 9: WHOLE BRAIN --> Uncorrected
  920. FgtC_P_Specified_ROI9 <- filter(FgtC_P_Activated, WB_Th == 9)
  921. Th9_ID <- FgtC_P_Specified_ROI9[,c("Article_Num", "Publication_Year")]
  922. Th_Counts[9] <- nrow(Th9_ID)
  923. ###GET ROIs THAT STUDIES SPECIFIED:
  924. #make columns based on the ROIs specified
  925. FgtC_P_Specified_ROI9 <- separate(FgtC_P_Specified_ROI9, c(ROI_regions), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10","Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20", "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30"), sep = ',')
  926. #make into long format
  927. Headings <- melt(FgtC_P_Specified_ROI9[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  928. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  929. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30")],
  930. id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  931. Headings$value <- str_trim(Headings$value, side = c("both", "left", "right"))
  932. #make list of unique ROIs for the headings string matching columns/counts
  933. ROI_list <- sort(unique(Headings$value))
  934. ```
  935. #Th9: Split the reported activation
  936. ```{r}
  937. ###GET ROIs THAT STUDIES REPORTED AS ACTIVATED:
  938. FgtC_P_Activated_ROI9 <- filter(FgtC_P_Activated, WB_Th == 9)
  939. FgtC_P_Activated_ROI9 <- separate(FgtC_P_Activated_ROI9, c(FgtC_PgtC), into = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  940. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  941. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  942. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40"), sep = ',')
  943. FgtC_P_Activated_ROI9 <- FgtC_P_Activated_ROI9 %>% mutate(across(where(is.character), str_trim))
  944. #make into long format
  945. Headings_Active <- melt(FgtC_P_Activated_ROI9[,c('Article_Num','Publication_Year',"Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  946. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  947. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  948. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")], id.vars=c('Article_Num','Publication_Year'), var='ROI_specified')
  949. Headings_Active$value <- str_trim(Headings_Active$value, side = c("both", "left", "right"))
  950. Active_List <- sort(unique(Headings_Active$value))
  951. ```
  952. #Th9: Code which regions were reported as activated (Counts_ROI_Th5)
  953. ```{r}
  954. #Remove extra columns from Specified + Activated
  955. FgtC_P_Specified_ROI9 <- select(FgtC_P_Specified_ROI9, -c(Article_Num, Publication_Year, FgtC_PgtC, WB_Th, ROI_Th))
  956. FgtC_P_Activated_ROI9 <- select(FgtC_P_Activated_ROI9, -c(Article_Num, Publication_Year, ROI_regions, WB_Th, ROI_Th))
  957. GroupList = ROI_list
  958. GroupList = Active_List #Instead of searching within the Regions that were
  959. #Create empty data frame to store the counts
  960. Counts_ROI_Th9 <- data.frame(matrix(ncol = length(Active_List), nrow = nrow(FgtC_P_Activated_ROI9)))
  961. colnames(Counts_ROI_Th9) <- c(Active_List)
  962. AllActivatedCols = c("Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Region10",
  963. "Region11", "Region12", "Region13", "Region14", "Region15", "Region16", "Region17", "Region18", "Region19", "Region20",
  964. "Region21", "Region22", "Region23", "Region24", "Region25", "Region26", "Region27", "Region28", "Region29", "Region30",
  965. "Region31", "Region32", "Region33", "Region34", "Region35", "Region36", "Region37", "Region38", "Region39", "Region40")
  966. for (n in 1:nrow(FgtC_P_Activated_ROI9)){ #for each row of the Activated df
  967. #print(as.integer(n))
  968. ColList <- names(FgtC_P_Activated_ROI9)[!is.na(FgtC_P_Activated_ROI9[n,])] #only select the Activated columns that have
  969. for (c in ColList){ #for the ROIs that they said they were interested in
  970. #print(c)
  971. for (group in GroupList){ #find the string match (column names based on all ROIs mentioned)
  972. #print(group)
  973. if (grepl(GroupList[which(GroupList == group)], FgtC_P_Activated_ROI9[n,c])) { #If they said it was activated add a 1 to the the column in the df
  974. #print(group)
  975. Counts_ROI_Th9[n,group] <- (1)
  976. }
  977. }
  978. }
  979. }
  980. #Mutate and put into a neat df (Th5)
  981. Counts_ROI_Th9 <- mutate_all(Counts_ROI_Th9, function(x) as.numeric(as.character(x)))
  982. Counts_ROI_Th9[,c("Article_Num", "Publication_Year")] <- Th9_ID[,c("Article_Num", "Publication_Year")]
  983. ```
  984. #Th9: Remove activated regions if they were from an ROI analysis (Combined_ROIs)
  985. ```{r}
  986. Article_Nums <- Counts_ROI_Th9[,c("Article_Num")]
  987. for (a in Article_Nums){
  988. #print(paste0("Article_Num =", a))
  989. if (a %in% Combined_ROIs$Article_Num){
  990. r = which(Combined_ROIs$Article_Num %in% a)
  991. q = which(Counts_ROI_Th9$Article_Num %in% a)
  992. #print(paste0("It is row ", r, " of the Combined ROI file, and row ", q, "of the Th9 Counts"))
  993. for (c in colnames(Combined_ROIs)){
  994. if(is.na(Combined_ROIs[r,c])){ #If it is not empty in the ROI or the Counts list (i.e. they searched for it and found it)
  995. next #Code as ROI
  996. }
  997. else {
  998. #print(paste0(c, " is where they have searched for"))
  999. Counts_ROI_Th9[q,c] <- "ROI"}
  1000. }
  1001. }
  1002. else {
  1003. #print("This study did not use an ROI")
  1004. }
  1005. }
  1006. #Save version with ROIs indicated
  1007. Counts_ROI_Th9_wROI <- Counts_ROI_Th9
  1008. #Remove ROIs and count
  1009. Counts_ROI_Th9[Counts_ROI_Th9 == "ROI"] <- NA
  1010. Counts_ROI_Th9<- mutate_all(Counts_ROI_Th9, function(x) as.numeric(as.character(x)))
  1011. Counts_ROI_Th9[,c("Article_Num", "Publication_Year")] <- Th9_ID[,c("Article_Num", "Publication_Year")] #Re-fill this in as some got removed during "ROI" removing
  1012. Th9 <- data.frame(matrix(ncol = length(Active_List), nrow = 2))
  1013. colnames(Th9) <- c(Active_List)
  1014. row.names(Th9) <- c("Applied", "Activated")
  1015. Th9[1,] <- nrow(FgtC_P_Activated_ROI9)
  1016. Th9[2,] <- colSums(Counts_ROI_Th9, na.rm = TRUE)
  1017. #Th9[2,] <- 1
  1018. Th9[3,] <- Th9[1,]/nrow(Counts_ROI_Th9) * 100
  1019. #write.csv(Th9, "M:/Documents/Hariri_review/Data_Vis/Th9.csv", row.names=TRUE)
  1020. ```
  1021. ```{r}
  1022. #Clean the workspace:
  1023. # Save the vector to a text file
  1024. write.table(Th_Counts, file = paste0("/project/3022054.01/projects/linschl/efmt/review_update_2026/02_results/patients_pgtc/Th_Counts_", Diagnosis ,".txt"), col.names = FALSE)
  1025. rm(Th_Counts)
  1026. rm(Headings)
  1027. rm(GroupList)
  1028. rm(ColList)
  1029. rm(Th9_ID)
  1030. rm(Headings_Active)
  1031. rm(Active_List)
  1032. ```
  1033. ```{r}
  1034. #Transform all ThX dataframes
  1035. Th1_t <- as.data.frame(t(Th1))
  1036. Th1_t$names <- rownames(Th1_t)
  1037. Th1_t <- Th1_t[order(Th1_t$Searched, Th1_t$Activated, decreasing=TRUE),]
  1038. Th1_t$names <- factor(Th1_t$names, levels = Th1_t$names)
  1039. names(Th1_t) <- c("Th1_Searched", "Th1_Activated", "Th1_Perc", "names")
  1040. Th2_t <- as.data.frame(t(Th2))
  1041. Th2_t$names <- rownames(Th2_t)
  1042. Th2_t <- Th2_t[order(Th2_t$Searched, Th2_t$Activated, decreasing=TRUE),]
  1043. Th2_t$names <- factor(Th2_t$names, levels = Th2_t$names)
  1044. names(Th2_t) <- c("Th2_Searched", "Th2_Activated", "Th2_Perc", "names")
  1045. Th3_t <- as.data.frame(t(Th3))
  1046. Th3_t$names <- rownames(Th3_t)
  1047. Th3_t <- Th3_t[order(Th3_t$Searched, Th3_t$Activated, decreasing=TRUE),]
  1048. Th3_t$names <- factor(Th3_t$names, levels = Th3_t$names)
  1049. names(Th3_t) <- c("Th3_Searched", "Th3_Activated", "Th3_Perc", "names")
  1050. Th4_t <- as.data.frame(t(Th4))
  1051. Th4_t$names <- rownames(Th4_t)
  1052. Th4_t <- Th4_t[order(Th4_t$Searched, Th4_t$Activated, decreasing=TRUE),]
  1053. Th4_t$names <- factor(Th4_t$names, levels = Th4_t$names)
  1054. names(Th4_t) <- c("Th4_Searched", "Th4_Activated", "Th4_Perc", "names")
  1055. Th5_t <- as.data.frame(t(Th5))
  1056. Th5_t$names <- rownames(Th5_t)
  1057. Th5_t <- Th5_t[order(Th5_t$Activated, decreasing=TRUE),]
  1058. Th5_t$names <- factor(Th5_t$names, levels = Th5_t$names)
  1059. names(Th5_t) <- c("Th5_Applied", "Th5_Activated", "Th5_Perc", "names")
  1060. Th6_t <- as.data.frame(t(Th6))
  1061. Th6_t$names <- rownames(Th6_t)
  1062. Th6_t <- Th6_t[order(Th6_t$Activated, decreasing=TRUE),]
  1063. Th6_t$names <- factor(Th6_t$names, levels = Th6_t$names)
  1064. names(Th6_t) <- c("Th6_Applied", "Th6_Activated", "Th6_Perc", "names")
  1065. Th7_t <- as.data.frame(t(Th7))
  1066. Th7_t$names <- rownames(Th7_t)
  1067. Th7_t <- Th7_t[order(Th7_t$Activated, decreasing=TRUE),]
  1068. Th7_t$names <- factor(Th7_t$names, levels = Th7_t$names)
  1069. names(Th7_t) <- c("Th7_Applied","Th7_Activated", "Th7_Perc", "names")
  1070. Th8_t <- as.data.frame(t(Th8))
  1071. Th8_t$names <- rownames(Th8_t)
  1072. Th8_t <- Th8_t[order(Th8_t$Activated, decreasing=TRUE),]
  1073. Th8_t$names <- factor(Th8_t$names, levels = Th8_t$names)
  1074. names(Th8_t) <- c("Th8_Applied","Th8_Activated", "Th8_Perc", "names")
  1075. Th9_t <- as.data.frame(t(Th9))
  1076. Th9_t$names <- rownames(Th9_t)
  1077. Th9_t <- Th9_t[order(Th9_t$Activated, decreasing=TRUE),]
  1078. Th9_t$names <- factor(Th9_t$names, levels = Th9_t$names)
  1079. names(Th9_t) <- c("Th9_Applied","Th9_Activated", "Th9_Perc", "names")
  1080. ```
  1081. ```{r}
  1082. #Merge them all together
  1083. list_df = list(Th1_t, Th2_t, Th3_t, Th4_t, Th5_t, Th6_t, Th7_t, Th8_t, Th9_t)
  1084. Total_counts <- list_df %>% reduce(full_join, by='names')
  1085. Total_counts <- Total_counts %>%
  1086. select(names, everything())
  1087. Total_counts <- Total_counts[order(Total_counts$names),]
  1088. Total_counts$names <- as.character(Total_counts$names)
  1089. write.csv(Total_counts, paste0("/project/3022054.01/projects/linschl/efmt/review_update_2026/02_results/patients_pgtc/Total_Counts_",Diagnosis,".csv"), row.names=TRUE)
  1090. ```
  1091. ```{r}
  1092. rm(list=(ls()[ls()!="Total_counts"]))
  1093. #rm(list = ls()[!ls() %in% c("Total_counts", "Diagnosis")])
  1094. #Diagnosis <- 'ADHD'
  1095. ```
  1096. #Synthesising similar regions
  1097. ```{r}
  1098. ##SUBCORTICAL:
  1099. Amygdala <- as.data.frame(dplyr::filter(Total_counts, grepl('amygdala', names)))
  1100. #AAL 41+42
  1101. Thalamus <- as.data.frame(dplyr::filter(Total_counts, (grepl('thalamus', names) & !grepl('hypo', names)) | grepl('geniculate', names)))
  1102. #AAL 77 + 78 + lateral geniculate
  1103. Hypothalamus <- as.data.frame(dplyr::filter(Total_counts, grepl('thalamus', names) & grepl('hypo', names)))
  1104. #AAL NA
  1105. Hippocampus <- as.data.frame(dplyr::filter(Total_counts, grepl('hippocamp', names) & !grepl('para', names)))
  1106. #AAL 37 +38
  1107. Parahippocampus <- as.data.frame(dplyr::filter(Total_counts, grepl('hippocamp', names) & grepl('para', names)))
  1108. #AAL 39 + 40
  1109. Basal_Ganglia <- as.data.frame(dplyr::filter(Total_counts, grepl('basal ganglia', names) | grepl('lentiform', names)| grepl('pallidus', names ) | grepl('putamen', names) | grepl('accumbens', names) | grepl('substantia', names) | grepl('caudate', names) | grepl('pallidum', names)))
  1110. #AAL 73+79 75+76 71 + 72 (Putamen, pallidum, caudate, lentiform gyrus, nucleus accumbens)
  1111. #Cerebellum/Brain stem
  1112. Cerebellum <- as.data.frame(dplyr::filter(Total_counts, grepl('cerebel', names) | grepl('vermis', names) | grepl('declive', names)))
  1113. #AAL 91-116
  1114. Brain_stem <- as.data.frame(dplyr::filter(Total_counts, grepl('stem', names) | grepl('pons', names) | grepl('midbrain', names)))
  1115. #AAL NA
  1116. #OCCIPITAL:
  1117. Occipital_V1 <- as.data.frame(dplyr::filter(Total_counts, (grepl('occipital', names) & (grepl('pole', names)) | (grepl('visual', names)& !grepl('extra',names))| grepl('calcarine', names)) | (grepl('striate', names) & !grepl('extra',names))))
  1118. Occipital_V1 <- rbind(Occipital_V1, subset(Total_counts, names =="occipital lobe" | names == "l occipital"| names == "r occipital"| names == "l occipital cortex"| names == "r occipital cortex"| names == "l occipital lobe"| names == "r occipital lobe" | names == "r occipital gyrus"| names == "l occipital gyrus") )
  1119. #AAL 43 + 44
  1120. Occipital_Secondary <- as.data.frame(dplyr::filter(Total_counts, (grepl('occipital', names) & grepl('superior', names)) | (grepl('occipital', names) & (grepl('medial', names) | grepl('middle', names) | grepl('lateral', names))) | (grepl('occipital', names) & (grepl('inferior', names) | grepl('face', names)))| grepl('extra', names)))
  1121. #AAL 49 + 50 #AAL 51 + 52 #AAL 53 + 54
  1122. Occipital_Secondary <- rbind(Occipital_Secondary, subset(Total_counts, names =="occipital lobe" | names == "l occipital"| names == "r occipital"| names == "l occipital cortex"| names == "r occipital cortex"| names == "l occipital lobe"| names == "r occipital lobe") )
  1123. Occipital_Cuneus <- as.data.frame(dplyr::filter(Total_counts, grepl('cune', names) & !grepl('pre',names)))
  1124. #AAL 51 + 52
  1125. Lingual <- as.data.frame(dplyr::filter(Total_counts, grepl('lingual', names)))
  1126. #AAL 47 + 48
  1127. #Occipital_TOTAL <- as.data.frame(dplyr::filter(Total_counts, (grepl('occipital', names) | grepl('visual', names) | ((grepl('cune', names)) & !grepl('pre', names)) | grepl('striate', names))))
  1128. #TEMPORAL: ##CHECKED 31/5
  1129. Temporal_Superior <- as.data.frame(dplyr::filter(Total_counts, grepl('temporal', names) & grepl('superior', names) & !grepl('pole',names)))
  1130. #AAL 81 + 82
  1131. Temporal_Superior <- rbind(Temporal_Superior, subset(Total_counts, names == "r temporal lobe" | names == "l temporal lobe" | names == "r temporal gyrus"))
  1132. #Add unspecific terms
  1133. Temporal_Pole <- as.data.frame(dplyr::filter(Total_counts, grepl('temporal', names) & grepl('pole',names)))
  1134. #AAL 83 + 84
  1135. Temporal_Middle <- as.data.frame(dplyr::filter(Total_counts, (grepl('temporal', names) & (grepl('medial', names) | grepl('middle', names)) | grepl('entorhinal', names) )))
  1136. #AAL 85 + 86 + Entorhinal
  1137. Temporal_Middle <- rbind(Temporal_Middle, subset(Total_counts, names == "r temporal lobe" | names == "l temporal lobe" | names == "r temporal gyrus"))
  1138. Temporal_Inferior <- as.data.frame(dplyr::filter(Total_counts, grepl('temporal', names) & grepl('inferior', names)))
  1139. #AAL 89 + 90
  1140. Temporal_Inferior <- rbind(Temporal_Inferior, subset(Total_counts, names == "r temporal lobe" | names == "l temporal lobe" | names == "r temporal gyrus"))
  1141. #Temporal_TOTAL <- as.data.frame(dplyr::filter(Total_counts, grepl('temporal', names)))
  1142. Fusiform <- as.data.frame(dplyr::filter(Total_counts, grepl('fusiform', names)))
  1143. #AAL 55 + 56
  1144. #PARIETAL:
  1145. Parietal_Superior <- as.data.frame(dplyr::filter(Total_counts, grepl('parietal', names) & grepl('superior', names)))
  1146. #AAL 59 + 60
  1147. Parietal_Inferior <- as.data.frame(dplyr::filter(Total_counts, grepl('parietal', names) & grepl('inferior', names)| grepl('angular ', names)))
  1148. #AAL 65 + 66 (Angular Gyrus) + 61 + 62 (Inf. Parietal Gyrus)
  1149. Parietal_Precuneus <- as.data.frame(dplyr::filter(Total_counts, grepl('cune', names) & grepl('pre',names)))
  1150. #AAL 67 + 68
  1151. #INSULA
  1152. Insula <- as.data.frame(dplyr::filter(Total_counts, grepl('insula', names)))
  1153. #AAL 29 + 30
  1154. Claustrum <- as.data.frame(dplyr::filter(Total_counts, grepl('claustrum', names)))
  1155. #AAL NA
  1156. #FRONTAL:
  1157. Frontal_dlPFC <- as.data.frame(dplyr::filter(Total_counts, (grepl('frontal', names) & grepl('superior', names) & !grepl('orbi', names) & !grepl('medi', names)) | (grepl('frontal', names) & (grepl('middle', names) & !grepl('orbi', names)) & !grepl('vent', names) | grepl('dorsolateral', names) | grepl('eye',names))))
  1158. #AAL 3 + 4 7 + 8 (frontal eye fields, dorsolateral prefrontal cortex, medial frontal gyrus)
  1159. Frontal_dlPFC <- rbind(Frontal_dlPFC, subset(Total_counts, names == "l anterior prefrontal cortex" | names == "r anterior prefrontal cortex" | names == "l frontal cortex" | names == "r frontal cortex" | names == "l prefrontal cortex" | names == "r prefrontal cortex"))
  1160. #Add unspecific terms
  1161. Frontal_vlPFC <- as.data.frame(dplyr::filter(Total_counts, grepl('frontal', names) & ((grepl('inferior', names) & !grepl('orbito', names) | grepl('ventrolateral', names)))))
  1162. #AAL 11-16 (ventrolateral prefrontal cortex, inferior frontal gyrus)
  1163. Frontal_vlPFC <- rbind(Frontal_vlPFC, subset(Total_counts, names == "l anterior prefrontal cortex" | names == "r anterior prefrontal cortex" | names == "l frontal cortex" | names == "r frontal cortex" | names == "l prefrontal cortex" | names == "r prefrontal cortex"))
  1164. Frontal_dmPFC <- as.data.frame(dplyr::filter(Total_counts, (grepl('frontal', names) & ((grepl('superior', names) & !grepl('orbi', names) & grepl('medial', names))|(grepl('dors', names) & !grepl('lateral', names))) | (grepl('supplementary', names) & grepl('pre', names)))|grepl('premotor', names) | grepl('precentral', names)))
  1165. #AAL 23 + 24 (frontal superior medial, presupplementary motor area, #AAL 19 + 20 - supplementary motor area, precentral gyrus, premotor cortex)
  1166. Frontal_dmPFC <- rbind(Frontal_dmPFC, subset(Total_counts, names == "l anterior prefrontal cortex" | names == "r anterior prefrontal cortex" | names == "l frontal cortex" | names == "r frontal cortex" | names == "l prefrontal cortex" | names == "r prefrontal cortex"| names == "l medial frontal cortex" | names == "r medial frontal cortex" | names == "medial frontal cortex" | names == "r medial prefrontal cortex" | names == "l medial prefrontal cortex" ))
  1167. Frontal_vmPFC <- as.data.frame(dplyr::filter(Total_counts, (grepl('frontal', names) & ((grepl('vent', names) & grepl('medi', names)) | grepl('pole', names)) | grepl('rectal', names)) | (grepl('cingul', names) & grepl("genu", names)) | grepl('subcallosal', names)))
  1168. #AAL ventromedial pfc and subgenual cingulate
  1169. Frontal_vmPFC <- rbind(Frontal_vmPFC, subset(Total_counts, names == "l anterior prefrontal cortex" | names == "r anterior prefrontal cortex" | names == "l frontal cortex" | names == "r frontal cortex" | names == "l prefrontal cortex" | names == "r prefrontal cortex"| names == "l medial frontal cortex" | names == "r medial frontal cortex" | names == "medial frontal cortex" | names == "r medial prefrontal cortex" | names == "l medial prefrontal cortex" ))
  1170. #Subgenual_Cingulate <- as.data.frame(dplyr::filter(Total_counts, (grepl('cingul', names) & grepl("genu", names)) | grepl('subcallosal', names)))
  1171. Cingulate<- as.data.frame(dplyr::filter(Total_counts, grepl('cingul', names) & !grepl("genu", names)))
  1172. #AAL 31 - 36 (All regions - acc, mcc, pcc)
  1173. Orbito_Frontal_TOTAL <- as.data.frame(dplyr::filter(Total_counts, grepl('orbito', names)))
  1174. NOSIGDIF <- as.data.frame(dplyr::filter(Total_counts, grepl('nsd', names)))
  1175. ```
  1176. ```{r}
  1177. REGIONS <- (setdiff(ls(), c("Total_counts", "REGIONS","r", "df","df2", "df2L", "df2R", "Regions_Activated", "Regions_Activated_L", "Regions_Activated_R")))
  1178. #CHECKING_counts <- REGIONS %>% reduce(full_join, by='names')
  1179. ```
  1180. ```{r}
  1181. #COMBINED LEFT AND RIGHT
  1182. Regions_Activated <- data.frame()
  1183. r = 1 #increasing row numbers
  1184. usednames <- c()
  1185. for (df in REGIONS){
  1186. #print(df)
  1187. #Get the DF
  1188. .val <- get(df)
  1189. df2 <- as.data.frame(.val)
  1190. #Add the colSum to the new DF
  1191. Regions_Activated[r,1] <- as.character(df)
  1192. Regions_Activated[r,2:28] <- colSums(df2[,2:28], na.rm = TRUE)
  1193. r= r+1
  1194. usednames <- c(usednames, df2$names)
  1195. }
  1196. colnames(Regions_Activated) <- c("Region", "Th1_Searched", "Th1_Activated", "Th1_Perc", "Th2_Searched", "Th2_Activated", "Th2_Perc","Th3_Searched", "Th3_Activated", "Th3_Perc", "Th4_Searched", "Th4_Activated", "Th4_Perc", "Th5_Applied", "Th5_Activated", "Th5_Perc","Th6_Applied", "Th6_Activated", "Th6_Perc", "Th7_Applied","Th7_Activated", "Th7_Perc", "Th8_Applied","Th8_Activated", "Th8_Perc", "Th9_Applied","Th9_Activated", "Th9_Perc")
  1197. write.csv(Regions_Activated, paste0("/project/3022054.01/projects/linschl/efmt/review_update_2026/02_results/patients_pgtc/Regions_Activated_PMDD.csv"), row.names=TRUE) # BP
  1198. ```
  1199. ```{r}
  1200. UNUSED_names <- setdiff(usednames, Total_counts$names)
  1201. ```

A_P_Activated_Regions_PgtC.Rmd at commit 7873b81, under GPL-3.0 · at the source

Overview

Authors: Hannah S Savage1,2,3, Linda Schlüter1,2, Roberta Russo1, Imogen Leaning1,2, Christian F Beckmann1,2,4, Andre F Marquand1,2
  1. Donders Institute of Brain, Cognition and Behaviour, Radboud University, Nijmegen, the Netherlands
  2. Department of Medical Neuroscience, Radboud University Medical Centre, Nijmegen, the Netherlands
  3. Institute of Cognitive Neuroscience, University College London, London, UK
  4. Centre for Functional MRI of the Brain (FMRIB), Nuffield Department of Clinical Neurosciences, Wellcome Centre for Integrative Neuroimaging, University of Oxford, Oxford, UK
Journal: Human brain mapping, volume 47, issue 14, article e70636
Dates: received 6 May 2025; accepted 20 August 2026; published online 21 September 2026; in print October 2026
Type: Review · Language: English
License: CC BY
Identifiers: DOI 10.1002/hbm.70636 · PMID 42768741 · PMCID PMC13594551 · OpenAlex W7213986787
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), cognitive (subfield)
Methods: fMRI & imaging
MeSH: Brain*, Brain Mapping*, Emotions*, Facial Expression*, Facial Recognition*, Humans (* major topic)
Topic: Face Recognition and Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: European Research Council (101001118)
Citations: not cited yet (Europe PMC); 64 references in the paper

Abstract

We performed a systematic review of over 20 years of literature that implemented a variant of the emotional face matching task (EFMT). We aimed to quantify the heterogeneity in tasks used across studies, and to summarise the regions reported as activated when participants match the target face stimuli, as compared to matching the control stimuli, within and between patients with a mental health diagnosis and unaffected controls. Our results highlight the vast heterogeneity in all aspects of task design and implementation across studies. Our high‐level synthesis of brain regions activated broadly confirms the involvement of the amygdala during emotional face matching, but shows that an increase in amygdala activation is inconsistent both within and across mental health conditions. We further highlight increased activation within the cingulate cortex as a transdiagnostic alteration (vs. controls) during emotional face matching. We introduce solutions to address the challenge of heterogeneity, including a standard version of the EFMT and applicable statistical methods, and provide recommendations for the field to progress our understanding of emotional face processing.

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.

predictive-clinical-neuroscience/EFMT_Review

License: GPL-3.0
State: the link answers, verified on 11 November 2026
Evidence: files inventoried
Commit: 7873b814b8f92e278a7a399351c3a3d6da4473cc, 22 July 2026
Languages: R (14)
Size: 21 files, 14 scripts
Software Heritage: not archived
Found in: “Data and Code Availability”
Holds: README, license file, 14 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: reshape2 (14 files), ggplot2 (13 files), psych (13 files), tidyverse (13 files), data.table (8 files), cowplot (2 files)
Availability: 2 checks, the latest on 11 November 2026: the link answers
  • 11 November 2026: the link answers
  • 1 October 2026: the link answers
16 files

Hannah-Savage/Standard_EFMT

License: none: the authors keep all their rights
State: the link answers, verified on 11 November 2026
Evidence: files inventoried
Commit: bcda5239ea616b5f691126336bc184a1cbb9b043, 22 November 2023
Languages: Python (7)
Size: 201 files, 7 scripts
Software Heritage: not archived
Found in: the text, “Recommendations”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: PsychoPy (5 files), NumPy (2 files)
Availability: 2 checks, the latest on 11 November 2026: the link answers
  • 11 November 2026: the link answers
  • 1 October 2026: the link answers
8 files

laureate-institute-for-brain-research/HARIRI-Task

License: none: the authors keep all their rights
State: the link answers, verified on 11 November 2026
Evidence: files inventoried
Commit: f7aa1d36d9a963762cc7ac56deafb985813b03ec, 11 February 2022
Languages: Python (7)
Size: 190 files, 7 scripts
Software Heritage: not archived
Found in: the acknowledgements
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: PsychoPy (5 files), NumPy (2 files)
Availability: 2 checks, the latest on 11 November 2026: the link answers
  • 11 November 2026: the link answers
  • 1 October 2026: the link answers
8 files

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:

  • 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 28 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

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

Data Availability Statement

The data extraction table and all code to run the analysis and generate the plots in the manuscript can be found at https://github.com/predictive‐clinical‐neuroscience/EFMT_Review (https://github.com/predictive-clinical-neuroscience/EFMT_Review). The standardised version of the EFMT is available at https://github.com/Hannah‐Savage/Standard_EFMT (https://github.com/Hannah-Savage/Standard_EFMT).

The data extraction table and all code to run the analysis and generate the plots in the manuscript can be found at https://github.com/predictive‐clinical‐neuroscience/EFMT_Review (https://github.com/predictive-clinical-neuroscience/EFMT_Review).

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, 1 October 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 6 MeSH terms, 1 funder, 59 references.

Cite

This paper

Savage, H. S., Schlüter, L., Russo, R., Leaning, I., Beckmann, C. F., & Marquand, A. F. (2026). Do You Match What I Match? A Systematic Review of Over 20 Years of the Emotional Face Matching Task Reveals Vast Inconsistencies in Design and Implementation. Human brain mapping, 47(14), e70636. https://doi.org/10.1002/hbm.70636

BibTeX

@article{savage2026do,
author = {Savage, Hannah S and Schlüter, Linda and Russo, Roberta and Leaning, Imogen and Beckmann, Christian F and Marquand, Andre F},
title = {{Do You Match What I Match? A Systematic Review of Over 20 Years of the Emotional Face Matching Task Reveals Vast Inconsistencies in Design and Implementation}},
journal = {Human brain mapping},
year = {2026},
month = oct,
volume = {47},
number = {14},
pages = {e70636},
publisher = {Wiley},
issn = {1065-9471},
doi = {10.1002/hbm.70636},
url = {https://doi.org/10.1002/hbm.70636},
pmid = {42768741},
pmcid = {PMC13594551}
}

RIS

TY - JOUR
AU - Savage, Hannah S
AU - Schlüter, Linda
AU - Russo, Roberta
AU - Leaning, Imogen
AU - Beckmann, Christian F
AU - Marquand, Andre F
TI - Do You Match What I Match? A Systematic Review of Over 20 Years of the Emotional Face Matching Task Reveals Vast Inconsistencies in Design and Implementation
T2 - Human brain mapping
J2 - Hum Brain Mapp
PY - 2026
DA - 2026/10/01
VL - 47
IS - 14
SP - e70636
SN - 1065-9471
PB - Wiley
DO - 10.1002/hbm.70636
UR - https://doi.org/10.1002/hbm.70636
LA - en
ER -

CSL-JSON

{
"id": "10.1002/hbm.70636",
"type": "article-journal",
"title": "Do You Match What I Match? A Systematic Review of Over 20 Years of the Emotional Face Matching Task Reveals Vast Inconsistencies in Design and Implementation",
"container-title": "Human brain mapping",
"author": [
{
"family": "Savage",
"given": "Hannah S"
},
{
"family": "Schlüter",
"given": "Linda"
},
{
"family": "Russo",
"given": "Roberta"
},
{
"family": "Leaning",
"given": "Imogen"
},
{
"family": "Beckmann",
"given": "Christian F"
},
{
"family": "Marquand",
"given": "Andre F"
}
],
"container-title-short": "Hum Brain Mapp",
"volume": "47",
"issue": "14",
"page": "e70636",
"DOI": "10.1002/hbm.70636",
"PMID": "42768741",
"PMCID": "PMC13594551",
"ISSN": "1065-9471",
"publisher": "Wiley",
"URL": "https://doi.org/10.1002/hbm.70636",
"language": "en",
"issued": {
"date-parts": [
[
2026,
10,
1
]
]
}
}

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.1038/s41597-025-04895-z [code]
The Transdiagnostic Connectome Project: an open dataset for studying brain-behavior relationships in psychiatry.
Journal: Scientific data
In common: psych, reshape2, data.table, 3 other tools, 3 references
[2] doi:10.1038/s41467-024-48015-8 [code]
Information-based TMS to mid-lateral prefrontal cortex disrupts action goals during emotional processing.
Journal: Nature communications
In common: PsychoPy, psych, reshape2, 3 other tools, 2 references
[3] doi:10.1038/s41467-026-74565-0 [code]
The functional neurobiology of dispositions towards negative emotions.
Journal: Nature communications
In common: psych, cowplot, reshape2, 3 other tools, cognitive, 2 references
[4] doi:10.1002/hbm.70512 [code]
Precision Imaging for Intraindividual Investigation of the Reward Response.
Journal: Human brain mapping
In common: PsychoPy, psych, ggplot2, 2 other tools, 2 references
[5] doi:10.1038/s42003-025-07646-3 [code]
Neural mechanisms of metacognitive improvement under speed pressure.
Journal: Communications biology
In common: PsychoPy, cowplot, reshape2, 3 other tools, cognitive, 1 reference
[6] doi:10.1016/j.dcn.2023.101337 [code]
A multi-sample evaluation of the measurement structure and function of the modified monetary incentive delay task in adolescents.
Journal: Developmental cognitive neuroscience
In common: psych, reshape2, data.table, 3 other tools, 2 references
[7] doi:10.1002/hbm.26535 [code]
How do tasks impact the reliability of fMRI functional connectivity?
Journal: Human brain mapping
In common: psych, cowplot, reshape2, 3 other tools, 2 references
[8] doi:10.1523/eneuro.0076-26.2026 [code]
Exogenously Driven Neural Reactivation of Spatially Matching Visual Working-Memory Contents.
Journal: eNeuro
In common: PsychoPy, cowplot, reshape2, 4 other tools, cognitive
[9] doi:10.3389/fpsyg.2025.1565274 [code]
Willingness to wait covaries with endogenous variation in cortisol.
Journal: Frontiers in psychology
In common: PsychoPy, cowplot, data.table, 3 other tools, cognitive, 1 reference
[10] doi:10.1038/s41514-026-00456-9 [code]
Exploring the link between body physiology and cognition: the role of the brain and aging.
Journal: npj aging
In common: psych, data.table, ggplot2, 2 other tools, cognitive, 2 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.1002/hbm.70636.svg)](https://openscicode.org/badge/doi/10.1002/hbm.70636)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1002/hbm.70636.svg
   :target: https://openscicode.org/badge/doi/10.1002/hbm.70636
   :alt: OSCR

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

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

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)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

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