OSCR

Robust but independent sex differences in human brain function, structure, and behavior.

Code ↔ Paper

22 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 22 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Participants and data preparation › Participants ↔ scripts/Script13_readUKBsMRIdata.R, lines 1–59 · score 0.93 · healthy UK Biobank, UK Biobank participant, youngest subset, closely match, 44–50, age range
  2. [2] § Methods › Participants and data preparation › Participants ↔ scripts/Script14_SexAnatomyUKB.R, lines 1–32 · score 0.81 · healthy UK Biobank, youngest subset, UK Biobank participant, 44–50, mm, anatomy
  3. [3] § Methods › Cross-validation of anatomical sex differences and sex prediction in the UK Biobank dataset ↔ scripts/Script14_SexAnatomyUKB.R, lines 1–32 · score 0.72 · UK Biobank, FreeSurfer, cortical thickness, surface area, Euler, GMV
  4. [4] § Methods › Cross-validation of anatomical sex differences and sex prediction in the UK Biobank dataset ↔ scripts/Script13_readUKBsMRIdata.R, lines 1–59 · score 0.72 · UK Biobank, FreeSurfer, cortical thickness, surface area, Euler, GMV
  5. [5] § Methods › Predicting sex using fMRI, structural MRI, and behavioral data ↔ scripts/Script16_PredictSexActivation_TaskSpecificRegion.R, the whole file · a weak match · score 0.72 · fold cross validation, predicted sex, prediction models, PLS, ROC, tuning
  6. [6] § Results › Males and females show broadly similar brain-wide association study signals with a few isolated exceptions ↔ scripts/Script44_BWAS_SexComparison.R, lines 152–207 · score 0.70 · topographic divergence score, sex shuffled, Bonferroni correction, TDSs, behavioral scale, Pperm
  7. [7] § Results › Brain-wide association studies link behavior and task-induced brain activation within each sex ↔ scripts/Script44_BWAS_SexComparison.R, lines 152–207 · score 0.69 · topographical divergence scores, sex shuffling, Bonferroni corrected, TDSs, Scatter, density
  8. [8] § Methods › Predicting sex using fMRI, structural MRI, and behavioral data ↔ scripts/Script29_PredictSexBehavior_Permutation.R, lines 1–87 · score 0.68 · predicted sex, prediction models, MICE, imputed, behavioral scale, caret
  9. [9] § Methods › Clustering task-specific sex differences in brain activation ↔ scripts/Script6_ClusteringTaskSpecificRegions.R, lines 1–40 · score 0.68 · iter.max, kmeans clustering, scree, nstart, matrix, activation
  10. [10] § Methods › Testing inter-domain correlations of sex typicality across individuals ↔ scripts/Script37_PredictSex_STS.R, lines 411–461 · score 0.67 · sex probability scores, sex typicality, misclassified, STSs, sex prediction, volume
  11. [11] § Methods › Clustering task-specific sex differences in brain activation › Testing for alignment of task-specific and task-general sex differences in activation with functional anatomy of the human brai ↔ scripts/Script7_TaskSpecificGeneral_Enrichment.R, lines 271–323 · score 0.65 · markello_spatialnulls, topic map, Yeo, Neurosynth, network, Spin
  12. [12] § Methods › Participants and data preparation › Structural MRI data ↔ scripts/Script10_readHCPsMRIdata.R, lines 1–54 · score 0.65 · FreeSurfer, cortical thickness, surface area, recon, Euler, parcellate
  13. [13] § Methods › Brain-wide association studies (BWASs) between activation and behavior › Comparing the topography of brain-behavior associations between sexes ↔ scripts/Script44_BWAS_SexComparison.R, lines 1–26 · score 0.63 · topographical divergence, activation behavior associations, dissimilar, TDS, score, males
  14. [14] § Methods › Participants and data preparation › Structural MRI data ↔ scripts/Script11_SexAnatomyHCP.R, lines 1–32 · score 0.62 · FreeSurfer, cortical thickness, surface area, vertex, anatomy, volume
  15. [15] § Methods › Participants and data preparation › Behavioral data ↔ scripts/Script46_BWAS_SexModulation_OmnibusDesnityPlot_RankedDotPlot.R, lines 58–142 · score 0.62 · scanner tasks, alertness, personality, psychiatric, sensory, behavioral scales
  16. [16] § Methods › Participants and data preparation › Behavioral data ↔ scripts/Script15_SexBehavior.R, lines 145–232 · score 0.61 · scanner tasks, alertness, personality, psychiatric, sensory, behavioral scales
  17. [17] § Methods › Brain-wide association studies (BWASs) between activation and behavior › Sex stratified BWAS ↔ scripts/Script42_BWAS_MaleFemale_SplitHalf.R, lines 1–17 · score 0.57 · repeating BWAS, randomly splitting, behavioral scale, fMRI, Pperm, brain activation
  18. [18] § Methods › Analysis of fMRI data › Testing for task-specific and task-general SDA ↔ scripts/Script5_SexAcrossTasks.R, lines 1–47 · score 0.54 · linear mixed, lme4, lmer, fMRI, parcellation, models
  19. [19] § Methods › Participants and data preparation › Task fMRI data ↔ scripts/Script4_SexPerTask_Covary.R, lines 42–127 · score 0.52 · working memory, linear model, filtering, emotion, language
  20. [20] § Results › Multivariate patterns of brain activation, brain anatomy, and behavior are all highly but orthogonally predictive of participant sex ↔ scripts/Script16_PredictSexActivation_TaskSpecificRegion.R, the whole file · a weak match · score 0.52 · fold cross validation, sex prediction accuracy, MRI, GMV, maps, model
  21. [21] § Methods › Analysis of structural MRI data ↔ scripts/Script14_SexAnatomyUKB.R, lines 167–224 · score 0.51 · cortical thickness, FDR correction, effectsize, Cohen, anatomy, GMV
  22. [22] § Results › Humans show both task-specific and task-general sex differences in brain activation ↔ scripts/Script4_SexPerTask_Covary.R, lines 42–127 · score 0.51 · eta squared, language task, median, emotion, FDR, maps

Paper

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

The paper is loaded when this pane is shown.

The authors' code

R · 304 lines · 12 KB · no license · 3 matches

  1. ####################################################
  2. ### Script 14: Calculate Sex differences in
  3. ### FreeSurfer volume (FSV or Gray Matter Volume), Surface Area (SA), Cortical Thickness (CT) in Glasser
  4. ### from the youngest subset of healthy UK Biobank participants (44-50 years; 529 males and 637 females)
  5. ### with euler greater than -217 (GMV,CT,SA: Fig. S12a-b, Source Data)
  6. ####################################################
  7. ### SET UP ###
  8. library(lme4)
  9. library(tidyverse)
  10. library(lmerTest)
  11. library(furrr)
  12. library(tictoc)
  13. library(limma)
  14. library(genio)
  15. library(ciftiTools)
  16. ciftiTools.setOption("wb_path", "/usr/local/apps/connectome-workbench/1.5.0/wb_command")
  17. library(freesurfer)
  18. library(ggplot2)
  19. library(patchwork)
  20. library(GetoptLong)
  21. library(lsr) #eta-Squared
  22. library(effectsize)
  23. ####Function to write cifti in Glasser parcellation
  24. # function to assign value of each parcel in HCP/MMP/Glasser parcellation to vertices in that parcel in CIFTI
  25. # MMP parcellation (download from HCP S1200 group results)P
  26. MMP <- read_cifti("../data/HCP_S1200_GroupAvg_v1/Q1-Q6_RelatedValidation210.CorticalAreas_dil_Final_Final_Areas_Group_Colors.32k_fs_LR.dlabel.nii")
  27. # adjust each atlas into vector of assignments and dataframe for meta
  28. MMPleft <- as.vector(MMP$data$cortex_left)
  29. MMPright <- as.vector(MMP$data$cortex_right)
  30. MMPmeta <- as.data.frame(MMP$meta$cifti$labels$INDEXMAX)
  31. adata <- c(MMPleft,MMPright)
  32. mdata <- MMPmeta
  33. assign_value <- function(data) {
  34. arange <- c(181:360,1:180)#make sure left first (181:360), right second(1:180)
  35. res <- matrix(rep(0, length(adata)*1), ncol=1)
  36. temp <- adata
  37. for (m in 1:length(arange))
  38. {
  39. # find avg beta (by region)
  40. res[which(adata==arange[m])] <- data[m]
  41. }
  42. return(res)
  43. }
  44. # need to load one cifti dscalar file downloaded from HCP S1200 as a cfiti structure holder,
  45. # e.g., one file from xxxxx(one particpant)/MNINonLinear/Results/tfMRI_MOTOR/tfMRI_MOTOR_hp200_s4_level2.feat/motor_contrast.dscalar.nii
  46. test <- read_cifti("../data/motor_contrast.dscalar.nii", brainstructures = "all")
  47. # function to write Glasser Parcellated results to cifti
  48. write_glasser_cifti <- function(gdata,gname,ciftiname){
  49. tstats_vis <- test # initialize structure
  50. if (is.null(dim(gdata))) {
  51. cifti_data <- as.vector(assign_value(gdata))
  52. tstats_vis$data$cortex_left <- as.matrix(cifti_data[1:29696])
  53. tstats_vis$data$cortex_right <- as.matrix(cifti_data[29697:59412])
  54. tstats_vis$data$subcort <- matrix(rep(0,31870),ncol = 1)
  55. } else {
  56. cifti_data <- matrix(rep(0,59412*ncol(gdata)),ncol = ncol(gdata))
  57. for (m in 1:ncol(gdata)) {
  58. cifti_data[,m] <- as.vector(assign_value(gdata[,m]))
  59. }
  60. tstats_vis$data$cortex_left <- as.matrix(cifti_data[1:29696,])
  61. tstats_vis$data$cortex_right <- as.matrix(cifti_data[29697:59412,])
  62. tstats_vis$data$subcort <- matrix(rep(0,31870*ncol(gdata)),ncol = ncol(gdata))
  63. }
  64. # names
  65. tstats_vis$meta$cifti$names <- gname
  66. write_cifti(tstats_vis, ciftiname)
  67. }
  68. # Function: Spin tests of Pearson correlation between A and B data
  69. # across regions in Glasser (with the 10000 spin index created in fsaverage)
  70. spintest <- function(dataA,dataB,Alab,Blab,fname,fname2) {
  71. # use cortical MMP/Glasser atlas
  72. dfcor <-data.frame(A=dataA, B=dataB)
  73. # calculate the observed correlation
  74. cor_obs <- cor(dfcor$A,dfcor$B)
  75. # load indexes of spin 1000 generated by markello_spatialnulls
  76. sIndex <- read_matrix("../data/Glasser_fsa5_spin10000.txt") +1 #index starts from 0 instead of 1
  77. # build null using spin index
  78. permn <- ncol(sIndex)
  79. cor_null <- rep(NaN, permn)
  80. for (n in 1:permn)
  81. {
  82. Anull <- dfcor$A[sIndex[,n]]# rotate A
  83. cor_null[n] <- cor(dfcor$B,Anull)
  84. }
  85. #using abs to calculate p perm for a two-sided test
  86. p_perm <- length(which(abs(cor_null)>abs(cor_obs)))/permn
  87. # plot A (on y axis) vs. B (on x axis)
  88. ti=paste0("Correlation of ",Alab," and ",Blab, " across Glasser regions:")
  89. fit <- lm(A ~ B, data = dfcor)
  90. p <- ggplot(dfcor, aes(y = A, x = B)) +
  91. geom_point(color='black') +
  92. stat_smooth(size=2,method = "lm", se=FALSE,color="grey",show.legend = TRUE)+
  93. labs(y= Alab,
  94. x=Blab,
  95. title = paste(ti,"r =",signif(cor_obs,2)," p_spin =",signif(p_perm, 4))) +
  96. theme_classic() +
  97. theme(legend.position = c(.95, .9),
  98. legend.justification = c("right", "top"),
  99. legend.box.just = "right",
  100. legend.margin = margin(6, 6, 6, 6))
  101. print(p)
  102. ggsave(fname,height=6, width=6)
  103. #write source data
  104. colnames(dfcor)[1:2] <- c("CohenDinHCP","CohenDinUKB")
  105. write.csv(dfcor,row.names = FALSE,
  106. file = fname2)
  107. return(p)
  108. }
  109. ####################################################
  110. #Run lm model to identify sex effect in GMV
  111. # load data
  112. load(file = "../data/UKB_GMV_Glasser.RData")
  113. participant_id <- as.factor(FSV_wide_UKB$participant_id)
  114. sex <- as.factor(FSV_wide_UKB$sex)
  115. age <- FSV_wide_UKB$age
  116. tgmv <- FSV_wide_UKB$tgmv_FS741 # using tgmv from FS741 done by myslef
  117. inputs <- map(as.list(FSV_wide_UKB[,-c(1:6)]), function(x){
  118. d <- data.frame(participant_id = participant_id,
  119. age = age,
  120. sex=sex,
  121. tgmv=tgmv,
  122. voxel = x)
  123. return(d)
  124. })
  125. # lm model to identify sex effects while covarying total GMV
  126. results_list_sum <- map(inputs, function(d){
  127. res <- lm(formula = voxel ~ age + sex + tgmv, data = d)
  128. sum <- summary(res)
  129. etaS <- eta_squared(car::Anova(res,type = 2)) #type 2 partial eta-squared for effect size
  130. sum$etaS <- etaS
  131. return(sum)
  132. })
  133. # build data frame to hold sex effects
  134. sex_t <- map_dfr(results_list_sum, function(x){
  135. df <- data.frame(t_stat = x$coefficients[3,"t value"],
  136. p_val = x$coefficients[3,"Pr(>|t|)"],
  137. etaS = x$etaS$Eta2_partial[2]*sign(x$coefficients[3,"t value"])) #add sign to effect size
  138. return(df)
  139. })
  140. rownames(sex_t) <- names(results_list_sum)
  141. # calculate FDR-corrected p-values
  142. sex_t <- sex_t %>%
  143. mutate(fdr_p = p.adjust(p = p_val, method = "fdr"),
  144. BF_p = p.adjust(p = p_val, method = "bonferroni"),
  145. sig = ifelse(test = fdr_p < 0.05, yes = 1, no = 0),
  146. logFDR =-log10(fdr_p),
  147. t_thresholded = t_stat*sig,
  148. etaS_thresholded = etaS*sig)
  149. # calculate cohen's d using t_to_d from effectsize package
  150. tempcd <- t_to_d(t = sex_t$t_stat,df=1160)
  151. sex_t$cohend <- tempcd$d
  152. sex_t$cohend_thresholded <- sex_t$cohend*sex_t$sig
  153. # save results
  154. save(sex_t,file = "../data/SexGMV_UKBresults_Glasser.RData")
  155. write_glasser_cifti(as.matrix(sex_t),colnames(sex_t),
  156. "../outputs/SexGMV_UKBresults_Glasser.dscalar.nii")#use wb_view to load this cifit file: t_thresholded for Fig. 12a
  157. # compare effect size results from HCP and UKB for sex differences in sMRI
  158. sex_t_UKB <- sex_t
  159. load(file = "../data/SexGMV_HCPresults_Glasser.RData")
  160. tempcd <- t_to_d(t = sex_t$t_stat,df=959)
  161. cor(sex_t$cohend,sex_t_UKB$cohend)
  162. #Fig. S12b and source data
  163. spintest(sex_t$cohend,sex_t_UKB$cohend,'HCP_cohenD','UKB_cohenD',
  164. '../outputs/ROIbasedCorr_CohenD_MF_GMV_HCP_UKB_MMPatlas_SpinTest10000.pdf',
  165. '../outputs/ROIbasedCorr_CohenD_MF_GMV_HCP_UKB_MMPatlas_SpinTest10000.csv')
  166. ####################################################
  167. #Run lm model to identify sex effect in CT
  168. # load data
  169. load(file = "../data/UKB_CT_Glasser.RData")
  170. participant_id <- as.factor(FSthick_wide_UKB$participant_id)
  171. sex <- as.factor(FSthick_wide_UKB$sex)
  172. age <- FSthick_wide_UKB$age
  173. avgCT <- FSthick_wide_UKB$avgCT# average cortical thickness
  174. inputs <- map(as.list(FSthick_wide_UKB[,-c(1:6)]), function(x){
  175. d <- data.frame(participant_id = participant_id,
  176. age = age,
  177. sex=sex,
  178. avgCT=avgCT,
  179. voxel = x)
  180. return(d)
  181. })
  182. # lm model to identify sex effects while covarying avg CT
  183. results_list_sum <- map(inputs, function(d){
  184. res <- lm(formula = voxel ~ age + sex + avgCT, data = d)
  185. sum <- summary(res)
  186. etaS <- eta_squared(car::Anova(res,type = 2)) #type 2 partial eta-squared for effect size
  187. sum$etaS <- etaS
  188. return(sum)
  189. })
  190. # build data frame to hold sex effects
  191. sex_t <- map_dfr(results_list_sum, function(x){
  192. df <- data.frame(t_stat = x$coefficients[3,"t value"],
  193. p_val = x$coefficients[3,"Pr(>|t|)"],
  194. etaS = x$etaS$Eta2_partial[2]*sign(x$coefficients[3,"t value"])) #add sign to effect size
  195. return(df)
  196. })
  197. rownames(sex_t) <- names(results_list_sum)
  198. # calculate FDR-corrected p-values
  199. sex_t <- sex_t %>%
  200. mutate(fdr_p = p.adjust(p = p_val, method = "fdr"),
  201. BF_p = p.adjust(p = p_val, method = "bonferroni"),
  202. sig = ifelse(test = fdr_p < 0.05, yes = 1, no = 0),
  203. logFDR =-log10(fdr_p),
  204. t_thresholded = t_stat*sig,
  205. etaS_thresholded = etaS*sig)
  206. # calculate cohen's d using t_to_d from effectsize package
  207. tempcd <- t_to_d(t = sex_t$t_stat,df=1160)
  208. sex_t$cohend <- tempcd$d
  209. sex_t$cohend_thresholded <- sex_t$cohend*sex_t$sig
  210. # save results
  211. save(sex_t,file = "../data/SexCT_UKBresults_Glasser.RData")
  212. write_glasser_cifti(as.matrix(sex_t),colnames(sex_t),
  213. "../outputs/SexCT_UKBresults_Glasser.dscalar.nii")
  214. #use wb_view to load this cifit file: t_thresholded for Fig. S12a
  215. # compare effect size results from HCP and UKB for sex differences in sMRI
  216. sex_t_UKB <- sex_t
  217. load(file = "../data/SexCT_HCPresults_Glasser.RData")
  218. cor(sex_t$cohend,sex_t_UKB$cohend)
  219. #Fig. S12b and source data
  220. spintest(sex_t$cohend,sex_t_UKB$cohend,'HCP_cohenD','UKB_cohenD',
  221. '../outputs/ROIbasedCorr_CohenD_MF_CT_HCP_UKB_MMPatlas_SpinTest10000.pdf',
  222. '../outputs/ROIbasedCorr_CohenD_MF_CT_HCP_UKB_MMPatlas_SpinTest10000.cvf')
  223. ####################################################
  224. #Run lm model to identify sex effect in SA
  225. # load data
  226. load(file = "../data/UKB_SA_Glasser.RData")
  227. participant_id <- as.factor(FSsurfacearea_wide_UKB$participant_id)
  228. sex <- as.factor(FSsurfacearea_wide_UKB$sex)
  229. age <- FSsurfacearea_wide_UKB$age
  230. totalSA <- FSsurfacearea_wide_UKB$totalSA# total surface area
  231. inputs <- map(as.list(FSsurfacearea_wide_UKB[,-c(1:6)]), function(x){
  232. d <- data.frame(participant_id = participant_id,
  233. age = age,
  234. sex=sex,
  235. totalSA=totalSA,
  236. voxel = x)
  237. return(d)
  238. })
  239. # lm model to identify sex effects while covarying total SA
  240. results_list_sum <- map(inputs, function(d){
  241. res <- lm(formula = voxel ~ age + sex + totalSA, data = d)
  242. sum <- summary(res)
  243. etaS <- eta_squared(car::Anova(res,type = 2)) #type 2 partial eta-squared for effect size
  244. sum$etaS <- etaS
  245. return(sum)
  246. })
  247. # build data frame to hold sex effects
  248. sex_t <- map_dfr(results_list_sum, function(x){
  249. df <- data.frame(t_stat = x$coefficients[3,"t value"],
  250. p_val = x$coefficients[3,"Pr(>|t|)"],
  251. etaS = x$etaS$Eta2_partial[2]*sign(x$coefficients[3,"t value"])) #add sign to effect size
  252. return(df)
  253. })
  254. rownames(sex_t) <- names(results_list_sum)
  255. # calculate FDR-corrected p-values
  256. sex_t <- sex_t %>%
  257. mutate(fdr_p = p.adjust(p = p_val, method = "fdr"),
  258. BF_p = p.adjust(p = p_val, method = "bonferroni"),
  259. sig = ifelse(test = fdr_p < 0.05, yes = 1, no = 0),
  260. logFDR =-log10(fdr_p),
  261. t_thresholded = t_stat*sig,
  262. etaS_thresholded = etaS*sig)
  263. # calculate cohen's d using t_to_d from effectsize package
  264. tempcd <- t_to_d(t = sex_t$t_stat,df=1160)
  265. sex_t$cohend <- tempcd$d
  266. sex_t$cohend_thresholded <- sex_t$cohend*sex_t$sig
  267. # save results
  268. save(sex_t,file = "../data/SexSA_UKBresults_Glasser.RData")
  269. write_glasser_cifti(as.matrix(sex_t),colnames(sex_t),
  270. "../outputs/SexSA_UKBresults_Glasser.dscalar.nii")
  271. #use wb_view to load this cifit file: t_thresholded for Fig. S12a
  272. # compare effect size results from HCP and UKB for sex differences in sMRI
  273. sex_t_UKB <- sex_t
  274. load(file = "../data/SexSA_HCPresults_Glasser.RData")
  275. cor(sex_t$cohend,sex_t_UKB$cohend)
  276. # Fig S12b and source data
  277. spintest(sex_t$cohend,sex_t_UKB$cohend,'HCP_cohenD','UKB_cohenD',
  278. '../outputs/ROIbasedCorr_CohenD_MF_SA_HCP_UKB_MMPatlas_SpinTest10000.pdf',
  279. '../outputs/ROIbasedCorr_CohenD_MF_SA_HCP_UKB_MMPatlas_SpinTest10000.csv')

Script14_SexAnatomyUKB.R at commit 1788f03, no license · at the source

Overview

Authors: Siyuan Liu1, Bridget W Mahony1, Ethan T Whitman1, Stephen J Gotts2, Dustin Moraczewski3, Adam Thomas3, Alex Martin2, Armin Raznahan1
  1. Section on Developmental Neurogenomics, Human Genetics Branch, National Institute of Mental Health, Bethesda, MD USA
  2. Section on Cognitive Neuropsychology, Laboratory of Brain and Cognition, National Institute of Mental Health, Bethesda, MD USA
  3. Data Science and Sharing Team, National Institute of Mental Health, Bethesda, MD USA
Institutions: National Institute of Mental Health (United States); National Institutes of Health (United States)
Journal: Nature communications, volume 17, issue 1, article 6694
Dates: received 22 August 2025; accepted 5 May 2026; published online 21 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41467-026-73262-2 · PMID 42168179 · PMCID PMC13385741 · OpenAlex W7162011037
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), human (organism)
Methods: Statistics, Smoothing, state filtering, decompositions, Machine learning, Connectivity, fMRI & imaging, Preprocessing
Keywords: Neuroscience, Psychology
MeSH: Behavior*, Brain*, Sex Characteristics*, Adult, Brain Mapping, Female, Humans, Magnetic Resonance Imaging, Male, Young Adult (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: NIMH NIH HHS (U54 MH091657); Intramural NIH HHS (ZIA MH002949); U.S. Department of Health &amp; Human Services | NIH | National Institute of Mental Health (ZIAMH002949); U.S. Department of Health & Human Services | NIH | National Institute of Mental Health (NIMH) (ZIAMH002949)
Citations: not cited yet (Europe PMC); 96 references in the paper

Abstract

The neurobiological accompaniments of well-established sex differences in human behavior and disease remain unclear — in part due to a lack of large, diverse functional neuroimaging studies. We address this gap using over 700 h of fMRI data across seven tasks from 978 individuals with extensive structural and behavioral measures. We find that sex differences in task-activation are widespread (85% of cortex) and reproducible, largely task-specific, of small to moderate effect size, and unaligned with brain volume differences. While machine learning can classify sex from brain activation, volume, or behavior, these data types provide orthogonal information. Brain-wide association studies reveal that links between brain activation and behavior are highly conserved between sexes. The few subtle sex differences in brain-behavior linkage that do exist are not preferentially localized to sex-biased behaviors. Our findings clarify the nature of sex differences in human brain function and their links with neuroanatomy and behavior, providing a useful foundation for future research.

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

Repository

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

siyuanliu8/HCPsexdifferences

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 1788f03b6b649187bca9bd9bdc0359edb56be6a9, 13 May 2026
Languages: R (46)
Size: 245 files, 46 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (46 files), caret (20 files), Plotly (20 files), reticulate (20 files), ggplot2 (18 files), patchwork (17 files), easystats (11 files), lme4 (11 files), lmerTest (11 files), broom (9 files), limma (8 files), circlize (5 files), ComplexHeatmap (4 files), car (2 files), reshape2 (2 files), ggpubr (1 file), pheatmap (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
47 files

Code availability

All custom code and scripts used for data processing and statistical analysis in this study are publicly available on GitHub at https://github.com/siyuanliu8/HCPsexdifferences.

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

Tracing map

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

What the map holds:

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

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

Data

Datasets cited

Data availability

The primary HCP data are available by application at https://www.humanconnectome.org/study/hcp-young-adult. The UK Biobank validation data can be accessed by submitting an application at https://www.ukbiobank.ac.uk/enable-your-research/apply-for-access. The data generated in this study are provided in the accompanying Supplementary Data and Source Data files. Source data are provided in this paper. Source data are provided with this paper.

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

Versions

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

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 2 keywords, 10 MeSH terms, 4 funders, 88 references.

Cite

This paper

Liu, S., Mahony, B. W., Whitman, E. T., Gotts, S. J., Moraczewski, D., Thomas, A., Martin, A., & Raznahan, A. (2026). Robust but independent sex differences in human brain function, structure, and behavior. Nature communications, 17(1), 6694. https://doi.org/10.1038/s41467-026-73262-2

BibTeX

@article{liu2026robust,
author = {Liu, Siyuan and Mahony, Bridget W and Whitman, Ethan T and Gotts, Stephen J and Moraczewski, Dustin and Thomas, Adam and Martin, Alex and Raznahan, Armin},
title = {{Robust but independent sex differences in human brain function, structure, and behavior}},
journal = {Nature communications},
year = {2026},
month = may,
volume = {17},
number = {1},
pages = {6694},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-73262-2},
url = {https://doi.org/10.1038/s41467-026-73262-2},
pmid = {42168179},
pmcid = {PMC13385741}
}

RIS

TY - JOUR
AU - Liu, Siyuan
AU - Mahony, Bridget W
AU - Whitman, Ethan T
AU - Gotts, Stephen J
AU - Moraczewski, Dustin
AU - Thomas, Adam
AU - Martin, Alex
AU - Raznahan, Armin
TI - Robust but independent sex differences in human brain function, structure, and behavior
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/05/21
VL - 17
IS - 1
SP - 6694
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-73262-2
UR - https://doi.org/10.1038/s41467-026-73262-2
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-73262-2",
"type": "article-journal",
"title": "Robust but independent sex differences in human brain function, structure, and behavior",
"container-title": "Nature communications",
"author": [
{
"family": "Liu",
"given": "Siyuan"
},
{
"family": "Mahony",
"given": "Bridget W"
},
{
"family": "Whitman",
"given": "Ethan T"
},
{
"family": "Gotts",
"given": "Stephen J"
},
{
"family": "Moraczewski",
"given": "Dustin"
},
{
"family": "Thomas",
"given": "Adam"
},
{
"family": "Martin",
"given": "Alex"
},
{
"family": "Raznahan",
"given": "Armin"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "6694",
"DOI": "10.1038/s41467-026-73262-2",
"PMID": "42168179",
"PMCID": "PMC13385741",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-73262-2",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
21
]
]
}
}

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/s41467-026-74274-8 [code]
Regional sex differences in human cortical anatomy vary in their morphometric bases and overlap with sex chromosomal and gonadal influences.
Journal: Nature communications
In common: tidyverse, structural MRI / diffusion, 14 references, 2 authors
[2] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: caret, reticulate, limma, 11 other tools
[3] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: reticulate, limma, car, 11 other tools
[4] doi:10.1038/s41467-026-74753-y [code]
A human-specific microRNA controls the timing of excitatory synaptogenesis.
Journal: Nature communications
In common: reticulate, limma, easystats, 11 other tools
[5] doi:10.3390/ijms27104466 [code]
Uncovering the Key Circuit FOSL2/FOS/EGR3/EGR1, Contributing to the Hyperexcitability of Excitatory Neurons in the Epileptic Temporal Cortex and Hippocampus.
Journal: International journal of molecular sciences
In common: caret, reticulate, limma, 10 other tools
[6] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: limma, car, circlize, 10 other tools
[7] doi:10.1002/hbm.70605 [code]
BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.
Journal: Human brain mapping
In common: reticulate, easystats, broom, 7 other tools, 3 references
[8] doi:10.1038/s41467-026-77170-3 [code]
DNA methylation profiling identifies long-range epigenetic silencing of clustered protocadherins as a key determinant of meningioma progression.
Journal: Nature communications
In common: caret, limma, broom, 8 other tools
[9] doi:10.1038/s41514-026-00397-3 [code]
Nasal administration of Protollin enhances monocyte phagocytosis and decreases CD8&lt;sup&gt;+&lt;/sup&gt; T cell cytotoxicity in subjects with early Alzheimer's disease: a Phase 1 clinical trial.
Journal: npj aging
In common: reticulate, limma, car, 8 other tools
[10] doi:10.1038/s41586-026-10735-w [code]
Distributed control circuits across a brain-and-cord connectome.
Journal: Nature
In common: caret, reticulate, circlize, 8 other tools

Contribute

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

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

Request its removal

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

Discussion, reproductions, activity

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

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

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