Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples.
The 22 matches · 3 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Methods › Data analysis › Cross-validated training ↔ scripts/matlab functions/train_mentalizing_classifiers.m, the whole file · a weak match · score 0.74 · support vector machine, fold cross validation, mentalizing related, activated, SVM, MS
- [2] § Methods › Data analysis › Region-of-interest (ROI) analyses ↔ scripts/MS_fullAnalysisScript.m, lines 371–426 · score 0.74 · mPFC, ROI classifiers, brain classifiers, MTG, analytic, cerebellum
- [3] § Methods › Data analysis › Region-of-interest (ROI) analyses ↔ scripts/MS_fullAnalysisScript.m, lines 371–426 · score 0.74 · mPFC, ROI classifiers, brain classifiers, MTG, analytic, cerebellum
- [4] § Results › Local patterns of self- and other-related mentalizing ↔ scripts/matlab functions/testing_ROI_classifiers.m, lines 119–256 · score 0.73 · error bars, training accuracies, standard error, validation accuracies, ROI classifier, heights
- [5] § Methods › Data analysis › Cross-validated training ↔ scripts/MS_fullAnalysisScript.m, lines 91–123 · score 0.69 · cross validated training, SVM classifiers, prediction accuracies, weight map, unthresholded, bootstrapping
- [6] § Methods › Data analysis › Cross-validated training ↔ scripts/MS_fullAnalysisScript.m, lines 91–123 · score 0.69 · cross validated training, SVM classifiers, prediction accuracies, weight map, unthresholded, bootstrapping
- [7] § Results › Cross-validated training results ↔ scripts/matlab functions/train_mentalizing_classifiers.m, the whole file · a weak match · score 0.67 · support vector machines, fold cross validation, Referential Signature, Mentalizing Signature, SVM, MS
- [8] § Methods › Data analysis › Cross-validated training ↔ scripts/MS_fullAnalysisScript.m, lines 91–123 · score 0.65 · ridge parameter, cross validated, brain signatures, weight map, folds, MS
- [9] § Methods › Data analysis › Cross-validated training ↔ scripts/MS_fullAnalysisScript.m, lines 91–123 · score 0.65 · ridge parameter, cross validated, brain signatures, weight map, folds, MS
- [10] § Methods › Data analysis › Testing the signatures in extension tasks ↔ scripts/MS_fullAnalysisScript.m, lines 125–240 · score 0.64 · dot products, Binary prediction, ANOVAs, feedback, attributional, linear
- [11] § Methods › Data analysis › Testing the signatures in extension tasks ↔ scripts/MS_fullAnalysisScript.m, lines 125–240 · score 0.64 · dot products, Binary prediction, ANOVAs, feedback, attributional, linear
- [12] § Methods › Data analysis › Cross-validated training ↔ scripts/MS_fullAnalysisScript.m, lines 54–89 · score 0.63 · NeuroSynth, social cognition, uniformity, downloaded, union, MS
- [13] § Methods › Data analysis › Validation in independent datasets › Associations with age ↔ scripts/MS_fullAnalysisScript.m, lines 242–369 · score 0.62 · model formula, linear mixed, age, sex, variable, fit
- [14] § Methods › Data analysis › Validation in independent datasets › Associations with age ↔ scripts/MS_fullAnalysisScript.m, lines 242–369 · score 0.62 · model formula, linear mixed, age, sex, variable, fit
- [15] § Methods › Data analysis › Validation in independent datasets ↔ scripts/MS_fullAnalysisScript.m, lines 125–240 · score 0.61 · dot product, accuracy statistics, binary, mentalizing signatures, MS, modeling
- [16] § Methods › Data analysis › Validation in independent datasets ↔ scripts/MS_fullAnalysisScript.m, lines 125–240 · score 0.61 · dot product, accuracy statistics, binary, mentalizing signatures, MS, modeling
- [17] § Results › Local patterns of self- and other-related mentalizing ↔ scripts/MS_fullAnalysisScript.m, lines 371–426 · score 0.60 · mPFC, ROI classifier, prediction accuracy, surface, cerebellum, NeuroSynth
- [18] § Methods › Data analysis › Validation in independent datasets › Group comparisons of pattern expression values ↔ scripts/MS_fullAnalysisScript.m, lines 242–369 · score 0.55 · linear mixed, healthy controls, variable, schizophrenia, fits, models
- [19] § Methods › Data analysis › Validation in independent datasets › Group comparisons of pattern expression values ↔ scripts/MS_fullAnalysisScript.m, lines 242–369 · score 0.55 · linear mixed, healthy controls, variable, schizophrenia, fits, models
- [20] § Results › Cross-validated training results ↔ scripts/matlab functions/svm_rfe_models.m, the whole file · a weak match · score 0.55 · recursive feature elimination, SVM classifiers, RFE, weight maps, Filled, Voxels
- [21] § Results › Leave-one-site-out classifiers trained on all datasets ↔ scripts/matlab functions/testing_ROI_classifiers.m, lines 119–256 · score 0.55 · error bars, standard error, validated accuracy, Mentalizing classifier, ROC, trained
- [22] § Results › Cross-validated training results ↔ scripts/MS_fullAnalysisScript.m, lines 371–426 · score 0.55 · mPFC, prediction accuracy, MTG, SMA, FDR, precuneus
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
MATLAB · 511 lines · 24 KB · MIT · 9 matches
- %% Replication Code for "Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples"
- % This code reproduces all analyses reported in:
- % Açıl et al. https://doi.org/10.1101/2025.03.10.642438
- %
- % DESCRIPTION:
- % This repository contains the full analysis pipeline for the manuscript,
- % including but not limited to
- % (i) cross-validated training four SVM classifiers as mentalizing signatures
- % (ii) validation in independent samples
- % (iii) developing ROI classifiers
- % (v) generating figures for main text and supplementary material.
- %
- % REQUIREMENTS:
- % MATLAB R2022b or above and the following toolboxes:
- % - Canlab Core Toolbox [version number, GitHub link]
- % - SPM12
- % - Statistics and Machine Learning Toolbox
- % - Signal Processing Toolbox
- % - DataViz toolbox (by Karvelis) for violin plots: https://github.com/povilaskarvelis/DataViz
- % - R Software (required for generating only one figure)
- %
- % INPUT DATA:
- % Single-subject contrast images of the training and testing datasets.
- % The training dataset is available at: https://doi.org/10.6084/m9.figshare.29908139
- % The validation (testing & extension) datasets are not shared publicly.
- % Therefore, only the training sections of the code will work with the
- % available images. For access at the validation datasets, please reach out to the
- % authors.
- %
- % OUTPUT:
- % Running this code will reproduce all analyses and figures as reported in the paper.
- %
- % CONTACT:
- % For questions or issues, please contact Dorukhan Açıl ([email hidden]) or Leonie Koban ([email hidden]).
- %
- %% Setup
- clear all; close all;
- %Set up paths
- project_path = './projectFolder';
- % This path should contain the input data in /inputData
- addpath(genpath('./CanlabCore')) % CanlabCore toolbox
- addpath(genpath('./spm12')) % SPM12
- rmpath(genpath('./CanlabCore/spm12/external/fieldtrip')) % Remove FieldTrip to avoid function conflicts
- cd(project_path)
- addpath(project_path)
- % NOTE: Adjust ./ and project_path directories based on your repo structure.
- signatureNames = {'Self_RS', 'Other_RS', 'MS', 'SvO_RS'}';
- %% 1. Load and prepare training data
- % Download the training images from the Figshare link above
- % and store under /inputData
- load('inputData/training_contrast_images.mat')
- % This contains the unmasked training fmri data storing 63 images. 21
- % subjects x 3 conditions. First 21 images belong to the self condition,
- % 22th-42th belong to the other-condition, and 43th-63th belong to the
- % control condition
- %Rescale using l2norm
- training_set_unmasked = rescale(training_set_unmasked, 'l2norm_images');
- % Create the social cognition mask and apply it on the training images
- % Association and uniformity tests masks from NeuroSynth of three terms
- % (mentalizing, self-referential, social) are downloaded on 06/06/2024.
- % These are stored in /inputData/Social_Mask
- fs = filenames('inputData/Social_Mask/*FDR*.nii');
- for f = 1:numel(fs) %computing union of the six masks
- if f==1
- d{f} = fmri_data(fs{f});
- social_mask = d{f};
- elseif f>1
- d{f} = fmri_data(fs{f});
- if f>4
- d{f} = threshold(d{f}, [0 100], 'raw-between');
- end
- social_mask = union(social_mask, d{f});
- end
- end
- %orthviews(social_mask) %to visually inspect
- training_set_masked = apply_mask(training_set_unmasked, social_mask);
- clear fs f d
- %% %% % Training Mentalizing Signatures (i) Self-RS, ii) Other-RS, iii) Mentalizing-RS, iv) Self-vs-Other RS
- % Input images are from n=21 participants performing a trait-evaluation task with three conditions: Self, Other, Control.
- % 1) Self-Referential Signature (Self-RS) – self-condition vs. other two conditions
- % 2) Other-Referential Signature (Other-RS) – other-condition vs. the other two conditions
- % 3) Mentalizing Signature (Mentalizing-RS) – mentalizing (self+other) vs. control condition
- % 4) Self-vs-Other (SvO-RS) – direct contrast between self- vs. other-related mentalizing
- %
- % Outputs: Uncorrected weight maps that are effectively the brain signatures of mentalizing,
- % statistics of the cross-validated training stage, and bootstrapped
- % thresholded images used for visualization
- % Train bootstrapped SVM classifiers
- % Using 10-fold CV, 5000 bootstraps for weight stability, and .5 ridge parameter for class balancing.
- training_stats = train_mentalizing_classifiers(training_set_masked, 1);
- % Second argument requires a logical input to enable or disable bootstrapping
- % Here define the mentalizing signatures
- for i = 1:numel(fieldnames(training_stats))
- fn = fieldnames(training_stats);
- mentalizing_signatures.(signatureNames{i}) = training_stats.(fn{i}).weight_obj; clear fn
- end
- % Compute prediction accuracies and visualize the training ROC plots
- % The output is displayed in the command window and also stored in the training_results struct.
- results.trainingPredictions = training_ROC(training_stats, signatureNames, 21, []); %third argument is the sample size, fourth argument defines the true and false classes
- % Visualize the weight maps
- %this will plot the unthresholded and thresholded weight maps of the classifiers in separate windows
- %requires statistical weight map as an output of bootstrapping
- figure_brain(mentalizing_signatures, signatureNames);
- %% %% %% Validating Mentalizing Signatures in 6 Independent Datasets
- % % Validation datasets:
- % Study 2-5 are testing datasets. Study 6-7 are extension datasets.
- study_names = {'Study2', 'Study3', 'Study4a', 'Study4b', 'Study5a', 'Study5b', 'Study5c', 'Study6a', 'Study6b', 'Study7'};
- % Load validation datasets - Note: these are not shared publicly
- validation_sets = {'DAT_Study2.mat', 'DAT_Study3.mat', ...
- 'DAT_Study4a.mat', 'DAT_Study4b.mat', ...
- 'DAT_Study5a.mat', 'DAT_Study5b.mat', 'DAT_Study5c.mat',...
- 'DAT_Study6a.mat', 'DAT_Study6b.mat', 'DAT_Study_7.mat'}; %not publicly available
- % The testing and extension datasets are stored in /inputData in standard
- % format where conditions are fields of the struct .dat, each of which contains
- % single-subject contrast images for the condition.
- full_paths = fullfile(['/inputData/', validation_sets]);
- %full_paths should store the paths as characters that will be used to load
- %the images in next steps. load(full_paths{1}) should load struct called
- %'dat' with three fields (per condition) each corresponding to an fmri_data object that
- %stores images of the respective condition.
- clear validation_sets path_validation_data
- % Applying the signatures (weight maps) onto the testing and extension datasets
- % Here we compute pattern expression values by taking the dot products of
- % four mentalizing classifiers and single-subject condition contrast
- % images from each study. Validation images are first rescaled using
- % l2-norm, then resampled onto the same image space as the classifiers.
- pexp = pattern_expressions(mentalizing_signatures, full_paths, study_names);
- % First argument contains the classifiers, second argument must indicate
- % the paths to the validation datasets, and the third argument stores
- % names for these datasets
- % Testing Accuracies using ROC and Accuracy Plots
- % i) Testing datasets
- studies = {'Study2', 'Study3', 'Study4a', 'Study4b', 'Study5a', 'Study5b', 'Study5c'};
- %only Study 2-5 are testing signatures. Beware that the color and shape
- %codes are dependent on the study_names, so if they are changed, it might
- %throw an error.
- results.testingPredictions = testing_signatures(pexp, studies, [], []);
- %this will plot ROC and accuracy plots and store accuracy statistics in the
- %"testing_results" structs along with average accuracy values
- %3rd and 4th arguments define true and false classes which are also defined
- %in the function
- % ii) Extension datasets
- % a) Study 7 in which signatures were tested using linear effects models
- results.extension.stat_study7 = rmAnova_extension(pexp.Study7);
- % Violin Plots for illustrating pattern expressions by condition
- conditions = {'Feedback on Self', 'Feedback on Partner', 'Control Condition'};
- plot_data = pexp.Study7;
- num_classifiers = 3; % plot in order Self-RS, Other-RS, MS
- plot_asterisks = 1; %beware that the function below is not coded to adapt to plot a different dataset
- % in that case, turn this to 0
- violPlot_pexp(plot_data, conditions, num_classifiers, plot_asterisks);
- % b) Study 6 in which signatures predictions are tested using binary prediction tests
- % ROC plots are produced. This dataset has only two conditions or a
- % 2x2 design, so it is structurally different than other datasets
- % Input
- %pexp struct with Study6a and Study6b fields must be there
- col = [.73 .01 .32; .07 .6 1]; %colors for the lines
- maps_to_plot = {'othermap', 'mentmap'}; %this indicates that only Other-RS and MS should be tested.
- figure; %Create plots
- for w = 1:2
- pexp_vals = pexp.Study6a.(maps_to_plot{w});
- subplot(2,2,w);
- true_con = 'attributional'; false_con = 'factual'; n = numel(pexp.Study6a.(maps_to_plot{1}).attributional);
- ROC_6a = roc_plot([pexp_vals.attributional; pexp_vals.factual], [ones(n,1); -ones(n,1)]==1, 'twochoice', 'color', col(1,:)); hold on
- title('Attributional vs Factual');
- %plot features
- ROC_6a.line_handle(1).Marker = 'v'; ROC_6a.line_handle(1).MarkerSize = 6;
- ROC_6a.line_handle(2).LineWidth = 2; set(gca, 'FontSize', 12);
- acc = num2str(ROC_6a.accuracy, '%.2f');
- acc_str = num2str(str2double(acc)*100);
- text(0.95, .4, 'Accuracies', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top', 'Color', 'k', 'FontSize', 12, 'FontWeight', 'bold')
- text(0.95, .3, ['Social: %', acc_str], 'Units', 'normalized', 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top', 'Color', col(1,:), 'FontSize', 12, 'FontWeight', 'bold')
- subplot(2,2,w+2);
- pexp_vals = pexp.Study6b.(maps_to_plot{w})
- true_con = {'attrib_social', 'attrib_nonsocial'}; false_con = {'fact_social', 'fact_nonsocial'}; n = numel(pexp.Study6b.(maps_to_plot{1}).attrib_social);
- ROC_6b1 = roc_plot([pexp_vals.(true_con{1}); pexp_vals.(false_con{1})], [ones(n,1); -ones(n,1)]==1, 'twochoice', 'color', col(1,:)); hold on
- ROC_6b2 = roc_plot([pexp_vals.(true_con{2}); pexp_vals.(false_con{2})], [ones(n,1); -ones(n,1)]==1, 'twochoice', 'color', col(2,:)); hold on
- title('Attributional vs Factual');
- %plot features
- ROC_6b1.line_handle(1).Marker = 'v'; ROC_6b2.line_handle(1).Marker = '*'; ROC_6b2.line_handle(2).LineStyle = ':';
- ROC_6b1.line_handle(1).MarkerSize = 6; ROC_6b2.line_handle(1).MarkerSize = 6;
- ROC_6b1.line_handle(2).LineWidth = 2; ROC_6b2.line_handle(2).LineWidth = 2;
- set(gca, 'FontSize', 12);
- acc = num2str(ROC_6b1.accuracy, '%.2f'); acc2 = num2str(ROC_6b2.accuracy, '%.2f');
- acc_str = num2str(str2double(acc)*100); acc_str2 = num2str(str2double(acc2)*100);
- text(0.95, .4, 'Accuracies', 'Units', 'normalized', 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top', 'Color', 'k', 'FontSize', 12, 'FontWeight', 'bold')
- text(0.95, .3, ['Social: %', acc_str], 'Units', 'normalized', 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top', 'Color', col(1,:), 'FontSize', 12, 'FontWeight', 'bold')
- text(0.95, .2, ['Nonsocial: %', acc_str2], 'Units', 'normalized', 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top', 'Color', col(2,:), 'FontSize', 12, 'FontWeight', 'bold')
- end; set(gcf, 'Position', [750 150 530 450]);
- results.extension.ROC_6a = ROC_6a; results.extension.ROC_6b1 = ROC_6b1; results.extension.ROC_6b2 = ROC_6b2; clear ROC_6a ROC_6b1 ROC_6b2
- %ROC_6a, ROC_6b1, and ROC_6b2 fields store the ROC output for each comparison
- clear acc acc2 acc_str acc_str2 ans col conditions false_con maps_to_plot n num_classifiers ...
- pexp_vals plot_asterisks plot_data true_con w i
- %% %% %% Testing for Individual Differences (Clinical status and Age)
- % These analyses test whether clinical status and age are associated with
- % the degree of the signatures' separatability of the Self and Other
- % conditions.
- % i) Testing for sex effects in overall pattern expressions
- % Organize datasets - including only testing datasets each with three
- % conditions
- studies = {'Study2', 'Study3', 'Study4a', 'Study4b', 'Study5a', 'Study5b', 'Study5c'};
- combinedData = prepare_dataset(pexp, studies, [], []);
- demographics = readtable('inputData/Demographics_ALL.xlsx'); %This is not shared publicly due to data protection
- maps = fieldnames(combinedData);
- studies = {'Study2', 'Study3', 'Study4', 'Study5'};
- indexes = [{1:44}, {45:105}, {106:161}, {162:211}]; %using fixed indexes as they are concatenated in this order
- for m = 1:numel(maps) % merge covariates and the pattern fit data
- for i = 1:numel(studies)
- n = sum(contains(demographics.Study,studies{i}));
- combinedData.(maps{m})(indexes{i},7) = ...
- demographics(contains(demographics.Study,studies{i}),2); %get Sex info
- end
- combinedData.(maps{m}).Properties.VariableNames(7) = {'sex'};
- combinedData.(maps{m}).sex = categorical(combinedData.(maps{m}).sex);
- end
- % linear mixed effects model with age and sex as predictor variables
- model_formula = 'fit ~ sex + (1|study)'; clear lme
- for m = 1:numel(maps) %run the model for each map
- results.sexEffect.(maps{m}) = fitlme(combinedData.(maps{m}), model_formula);
- end
- % ii) Clinical status
- % a) Healthy controls vs Schizophrenia patients - LME models
- % Organize datasets
- studies = {'Study4a', 'Study4b', 'Study5a', 'Study5b'};
- ref_group = 'a'; ref_study = '4';
- HCvsSZ = prepare_dataset(pexp, studies, ref_group, ref_study);
- % linear mixed effects model
- model_formula = 'fit ~ group + (1|study)'; %LME for SZ vs HC
- maps = fieldnames(HCvsSZ);
- for m = 1:numel(maps) %run the model for each map
- results.indDiff.HCvsSZ.(maps{m}) = fitlme(HCvsSZ.(maps{m}), model_formula);
- disp('-------'); disp('----');
- disp(['LME RESULTS FOR: ', maps{m}])
- disp(results.indDiff.HCvsSZ.(maps{m})); disp('----'); disp('-------');
- end
- % Plot pexp distributions
- violPlot_pexp2(HCvsSZ)
- % b) Healthy controls vs Bipolar patients - t-test
- studies = {'Study5a', 'Study5c'};
- ref_group = 'a'; ref_study = '5';
- output_HCvsBP = prepare_dataset(pexp, studies, ref_group, ref_study);
- % two-sample t-test for HC vs BP comparison
- for m = 1:numel(maps)
- dat = output_HCvsBP.(maps{i});
- [results.indDiff.HCvsBP.h results.indDiff.HCvsBP.p results.indDiff.HCvsBP.ci ...
- results.indDiff.HCvsBP.stats] = ttest2(dat.fit(dat.group == '1'), dat.fit(dat.group == '0'), 'Vartype', 'unequal');
- if h == 1
- disp(maps);
- disp(p); disp(stats);
- end
- end
- % iii) Age
- studies = {'Study2', 'Study3'};
- ref_group = 'not needed'; ref_study = '2';
- output_dev = prepare_dataset(pexp, studies, ref_group, ref_study);
- ages = readtable('inputData/developmentalSamples_age.xlsx'); %load age info
- %run LME models
- maps = fieldnames(output_dev);
- model_formula = 'fit ~ ages + sex + (1|study)';
- clc;
- for k = 1:numel(maps)
- output_dev.(maps{k}).ages = ages{:,1};
- output_dev.(maps{k})(find(output_dev.(maps{k}).study == '1'), 8) = ...
- demographics(contains(demographics.Study,'Study2'),"Sex");
- output_dev.(maps{k})(find(output_dev.(maps{k}).study == '0'), 8) = ...
- demographics(contains(demographics.Study,'Study3'),"Sex");
- output_dev.(maps{k}).Properties.VariableNames(8) = {'sex'};
- results.indDiff.age.(maps{k}) = fitlme(output_dev.(maps{k}), model_formula);
- if double(results.indDiff.age.(maps{k}).Coefficients(2,6)) < .05
- disp('-----------')
- disp(maps{k})
- disp(results.indDiff.age.(maps{k}));
- end
- end
- % Plots for the Age effects
- % These are produced in R. So we are first exporting the data for R
- % access, which we'll use to produce Figures in R via system command,
- % and then illustrate them here as images
- % Save data for R
- dat_table = table(output_dev.selfmap.fit, output_dev.othermap.fit, output_dev.SvOmap.fit, ...
- output_dev.selfmap.ages, output_dev.selfmap.study);
- dat_table.Properties.VariableNames = {'self_fit', 'other_fit', 'SvO_fit', 'ages', 'sample'};
- writetable(dat_table, 'temp/MapFitsAge.xlsx');
- %make sure that the R is in the path
- addpath(genpath('/Library/Frameworks/R.framework/Resources')); %this is an example path - it should be updated
- % This R script should save three figures in temp/Fig_Age. Make sure to
- % change the working directory in the R script (figure_Age.R)to the /ProjectFolder
- system('/Library/Frameworks/R.framework/Resources/bin/Rscript scripts/figure_Age.R'); %update the path to the R
- % Display figures in matlab
- img1 = imread('temp/Age_SelfRS.png');
- img2 = imread('temp/Age_OtherRS.png');
- img3 = imread('temp/Age_SvORS.png');
- subplot(1, 3, 1); imshow(img1); subplot(1, 3, 2); imshow(img2); subplot(1, 3, 3); imshow(img3);
- set(gcf, 'Position', [1, 299, 1280, 420]);
- clear ages ans combinedData dat dat_table demographics i img1 img2 img3 indexes k m maps model_formula n ...
- other_fit output_dev output_HCvsBP HCvsSZ ref_group ref_study sample self_fit studies SvO_fit
- %% %% %% ROI Analyses
- % Training ROI classifiers instead of brain-wide /whole-brain classifiers
- % using the same analytic strategy as above
- % 1. Extract and create ROI masks from the Neurosynth (NS) mask
- source_mask = 'inputData/mentalizing_ass-test_z_FDR_0.01.nii';
- % this function will select ROIs with at least 200 voxels, and ask the user
- % to assign a name to save this image to the output folder.
- % The output is saved in inputData/ROIs
- % This step could be skipped because images are provided in inputData/ROIs
- extract_ROI(source_mask, training_set_masked)
- % 2. Train predictive maps for each ROI
- path4ROImasks = 'inputData/ROIs';
- results.ROI_training = train_ROI_classifiers(path4ROImasks, training_set_masked);
- % MultiClass field contains results from three classifiers (in each column
- % of relevant objects): Self classifiers, other classifiers, and
- % mentalizing classifiers. ROC field contains training results
- % 3. Validate the ROI classifiers in the testing datasets and display
- % prediction accuracies both in training and testing datasets
- testing_sets = {'DAT_Study2.mat', 'DAT_Study3.mat', ...
- 'DAT_Study4a.mat', 'DAT_Study4b.mat', ...
- 'DAT_Study5a.mat', 'DAT_Study5b.mat', 'DAT_Study5c.mat'};
- results.ROI_testing = testing_ROI_classifiers(results.ROI_training, testing_sets, 1);
- % last argument is logical input argument to either make (1) or not make
- % the figure (0)
- % 4. Display weights of each ROI as Self-vs-Other Classifiers
- % beware that, if ROIs are recreated by assigning a user-given name above,
- % these names must be updated accordingly
- regs_to_plot_weights = {'aMTG_L', 'aMTG_R', 'mPFC', 'TPJ_R', 'TPJ_L', 'Precuneus'};
- %SvO classifiers of these regions could predict self vs other both in
- %the training and testing datasets - so we are illustrating their weights
- regs_to_plot_green = {'Cerebellum_R', 'Cerebellum_L', 'Cerebellum_BL', 'SMA_L'};
- %SvO classifiers of these regions weren't successfuly in separating two
- %conditions - we are not illustrating their weights
- for m = 1:numel(regs_to_plot_weights)
- figure; % this surface function may crash in matlab versions after 2022b. It requires a fix in render_on_surface.m function that it refers.
- surface_handles = surface(results.ROI_training.stats_ROI_SvO.(regs_to_plot_weights{m}).weight_obj, 'foursurfaces', 'noverbose');
- text(0, 1, regs_to_plot_weights{m}, 'FontSize', 20, 'HorizontalAlignment', 'center', 'Interpreter', 'none');
- set(gcf,'Position', [5, 208, 807, 420]);
- end
- for m = 1:numel(regs_to_plot_green)
- figure;
- reg_col = colormap_tor([0.10 0.82 0.0039], [0.10 0.82 0.0039]);
- surface_handles = surface(results.ROI_training.stats_ROI_SvO.(regs_to_plot_green{m}).weight_obj, 'foursurfaces', 'noverbose', 'pos_colormap', reg_col, 'neg_colormap', reg_col);
- text(0, 1, regs_to_plot_green{m}, 'FontSize', 20, 'HorizontalAlignment', 'center', 'Interpreter', 'none');
- set(gcf,'Position', [5, 208, 807, 420]);
- end
- clear regs_to_plot_weights regs_to_plot_green
- %% %% %% Leave-One-Site-Out (LOSO) Classifiers
- % Training leave-one-site-out classifiers combining all datasets that used
- % the same or similar task with three conditions: Study 1-5
- % 1. Gather data together
- testing_sets = {'DAT_Study2.mat', 'DAT_Study3.mat', ...
- 'DAT_Study4a.mat', 'DAT_Study4b.mat', ...
- 'DAT_Study5a.mat', 'DAT_Study5b.mat', 'DAT_Study5c.mat'};
- ref = fmri_data; %reference image to resample onto
- conds = {'self','other','control'};
- for i = 1:numel(testing_sets) %Merge all data together
- load(testing_sets{i});
- fn = fieldnames(dat);
- for v = 1:numel(fn)
- if i == 1 %Create template images
- datLOSO.(conds{v}) = fmri_data;
- end
- dat.(fn{v}) = resample_space(dat.(fn{v}),ref); %Resample space of validation datasets to reference image
- datLOSO.(conds{v}) = cat(datLOSO.(conds{v}), dat.(fn{v})); %Concatenate images
- end
- clear dat
- end
- training_set_unmasked_LOSO = resample_space(training_set_unmasked,datLOSO.self);
- for v = 1:numel(conds) % Include the training dataset
- datLOSO.(conds{v}).dat(:,1) = []; %delete the first image which was the reference image
- datLOSO.(conds{v}) = rescale(datLOSO.(conds{v}), 'l2norm_images'); %L2norm normalization
- datLOSO.(conds{v}) = cat(datLOSO.(conds{v}), get_wh_image(training_set_unmasked_LOSO,(v-1)*21+1:21*v));
- end
- LOSO_set = cat(datLOSO.self, datLOSO.other, datLOSO.control); clear datLOSO ref
- LOSO_set.removed_images = zeros(696,1); % correction to prevent crashes
- LOSO_set = apply_mask(LOSO_set,social_mask); %apply the social cognition mask
- % 2. Train SVM classifiers using 5 folds with each study in a single fold
- sites = {'Study2', 'Study3', 'Study4', 'Study5', 'Study1'}; % in the order that they appear in LOSO_set dataset
- sampleSizes = [44, 61, 56, 50, 21];
- results.LOSO_classifiers = train_LOSO_classifiers(LOSO_set, sites, sampleSizes);
- % Second argument lists the studies in the order they were concatenated in
- % the LOSO_set fmri_dataset. Third argument defines the sample size of each study
- clear conds fn i output_folder path4ROImasks v sampleSizes sites training_set_unmasked_LOSO
- %% %% %% Supplementary Tables and Figures
- % i) Label tables that show significant clusters in the thresholded maps of
- % mentalizing signatures
- cluster_labels = get_cluster_labels(training_stats, signatureNames);
- % ii) Whole-brain results - Train and test new classifiers using the
- % unmasked training dataset, or in other words that masked with whole-brain
- % gray matter mask.
- clasf_wBrain = train_mentalizing_classifiers(training_set_unmasked, 1);
- %Training ROCs
- results.wBrain_training = training_ROC(clasf_wBrain, signatureNames, 21, []);
- %Test the whole brain classifiers in the testing datasets
- pexp_wB = pattern_expressions(clasf_wBrain, full_paths, study_names);
- % Testing state ROC and Accuracy Plots
- study_names = {'Study2', 'Study3', 'Study4a', 'Study4b', 'Study5a', 'Study5b', 'Study5c'};
- results.wBrain_testing = testing_signatures(pexp_wB, study_names, [], []);
- %this will plot ROC and accuracy plots and store accuracy statistics in the
- %"testing_results" structs along with average accuracy values
- % Brain images
- figure_brain(clasf_wBrain, signatureNames);
- % ii) RFE images - Compute new SVM models using recursive feature
- % elimination with final n = 5000
- map_names = {'Self', 'Other', 'Mentalizing', 'SelfvsOther'};
- results.svm_rfe = svm_rfe_models(training_set_masked, map_names);
MS_fullAnalysisScript.m at commit d9ec388, under MIT · at the source
Overview
23 affiliations
- Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Germany
- Department of Child and Adolescent Psychiatry, Psychotherapy, and Psychosomatics, Leipzig University, Leipzig, Germany
- Department of Clinical Child and Adolescent Psychology and Psychotherapy, University of Bremen, Bremen, Germany
- Department of Psychology, University of Arizona, Tucson, AZ USA
- Cognitive Science, University of Arizona, Tucson, AZ USA
- Department of Medicine, School of Medicine and Health Sciences, Institute of Neurosciences, University of Barcelona, Barcelona, Spain
- Institut d’Investigacions Biomèdiques August Pi i Sunyer (IDIBAPS), Barcelona, Spain
- Department of Clinical, Neuro and Developmental Psychology, Faculty of Behavioral and Movement Sciences, Institute for Brain and Behavior Amsterdam, Vrije Universiteit Amsterdam, Amsterdam, The Netherlands
- Institute for Medical Imaging Technology, Ruijin Hospital, Shanghai Jiao Tong University School of Medicine, Shanghai, China
- Department of Clinical and Developmental Neuropsychology, University of Groningen, Groningen, The Netherlands
- Department of Psychiatric Rehabilitation, Lentis Zuidlaren, Zuidlaren, The Netherlands
- FIDMAG Germanes Hospitalàries Research Foundation, Barcelona, Spain
- Centro de Investigación Biomédica en Red de Salud Mental (CIBERSAM) ISCIII, Barcelona, Spain
- Developmental Clinical Psychology Research Unit, Faculty of Psychology and Educational Sciences, University of Geneva, Geneva, Switzerland
- Research Department of Clinical, Educational and Health Psychology, University College London, London, UK
- Social Neuroscience of Human Attachment (SoNeAt) Lab, Department of Psychology, University of Essex, Colchester, UK
- Laboratory of Behavioural Neurology and Imaging of Cognition, Department of Neuroscience, University Medical Center, University of Geneva, Geneva, Switzerland
- Swiss Center for Affective Sciences, University of Geneva, Geneva, Switzerland
- Department of Psychology, Queen’s University, Kingston, ON Canada
- Center for Neuroscience Studies, Queen’s University, Kingston, ON Canada
- Department of Psychological and Brain Sciences, Dartmouth College, Hanover, NH USA
- Lyon Neuroscience Research Center (CRNL), CNRS, Inserm, Université Claude Bernard Lyon 1, Bron, France
- Le Vinatier Psychiatrie Universitaire Lyon Métropole, Bron, France
Abstract
Human social interactions rely on the ability to reflect on one’s own and others’ internal states and traits—a process known as mentalizing. Impaired or altered mentalizing is a hallmark of multiple psychiatric and neurodevelopmental conditions. Yet, replicable and easily testable brain markers of mentalizing have so far been lacking. Here, we apply an interpretable machine learning approach to multiple datasets (total n = 390) to train and validate fMRI brain signatures that predict i) mentalizing about the self, ii) mentalizing about another person, and iii) both types of mentalizing. Self-mentalizing and other-mentalizing classifiers had positive weights in anterior/
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 22 matches between paragraphs and lines of code.
ldmk/2025_MentalizingSignatures
d9ec38844cff0d3031358e667ac7f22e8ef8927e, 13 May 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
20 files
- scripts/
MS_fullAnalysisScript.m , MATLAB, 511 lines, 9 matches - scripts/
R script/ , R, 64 linesfigure_Age.R - scripts/
matlab functions/ , MATLAB, 524 linesdaviolinplot2.m - scripts/
matlab functions/ , MATLAB, 54 linesextract_ROI.m - scripts/
matlab functions/ , MATLAB, 65 linesfigure_brain.m - scripts/
matlab functions/ , MATLAB, 53 linesget_cluster_labels.m - scripts/
matlab functions/ , MATLAB, 52 linespattern_expressions.m - scripts/
matlab functions/ , MATLAB, 45 linesprepare_dataset.m - scripts/
matlab functions/ , MATLAB, 69 linesrmAnova_extension.m - scripts/
matlab functions/ , MATLAB, 72 lines, 1 matchsvm_rfe_models.m - scripts/
matlab functions/ , MATLAB, 256 lines, 2 matchestesting_ROI_classifiers. m - scripts/
matlab functions/ , MATLAB, 208 linestesting_signatures.m - scripts/
matlab functions/ , MATLAB, 192 linestrain_LOSO_classifiers.m - scripts/
matlab functions/ , MATLAB, 72 linestrain_ROI_classifiers.m - scripts/
matlab functions/ , MATLAB, 89 lines, 2 matchestrain_mentalizing_classi fiers.m - scripts/
matlab functions/ , MATLAB, 90 linestraining_ROC.m - scripts/
matlab functions/ , MATLAB, 82 linesviolPlot_pexp.m - scripts/
matlab functions/ , MATLAB, 37 linesviolPlot_pexp2.m - LICENSE, License, 21 lines
- README.md, Text, 60 lines
Zenodo 19461625
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
20 files
- scripts/
MS_fullAnalysisScript.m , MATLAB, 511 lines, 8 matches - scripts/
R script/ , R, 64 linesfigure_Age.R - scripts/
matlab functions/ , MATLAB, 524 linesdaviolinplot2.m - scripts/
matlab functions/ , MATLAB, 54 linesextract_ROI.m - scripts/
matlab functions/ , MATLAB, 65 linesfigure_brain.m - scripts/
matlab functions/ , MATLAB, 53 linesget_cluster_labels.m - scripts/
matlab functions/ , MATLAB, 52 linespattern_expressions.m - scripts/
matlab functions/ , MATLAB, 45 linesprepare_dataset.m - scripts/
matlab functions/ , MATLAB, 69 linesrmAnova_extension.m - scripts/
matlab functions/ , MATLAB, 72 linessvm_rfe_models.m - scripts/
matlab functions/ , MATLAB, 256 linestesting_ROI_classifiers. m - scripts/
matlab functions/ , MATLAB, 208 linestesting_signatures.m - scripts/
matlab functions/ , MATLAB, 192 linestrain_LOSO_classifiers.m - scripts/
matlab functions/ , MATLAB, 72 linestrain_ROI_classifiers.m - scripts/
matlab functions/ , MATLAB, 89 linestrain_mentalizing_classi fiers.m - scripts/
matlab functions/ , MATLAB, 90 linestraining_ROC.m - scripts/
matlab functions/ , MATLAB, 82 linesviolPlot_pexp.m - scripts/
matlab functions/ , MATLAB, 37 linesviolPlot_pexp2.m - LICENSE, License, 21 lines
- README.md, Text, 58 lines
Code availability
Mentalizing signatures for use in future studies, as well as custom MATLAB scripts for analyses are available at95: https://
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:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 36 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
- figshare:29908139, at figshare; found in “Data availability”
- figshare:29931707, at figshare; found in DataCite
- openneuro:ds001618, at OpenNeuro; found in “Data availability”
Data availability
Source data for all figures and single-subject contrast images of the training dataset (Study 1) are available at94 10.6084/
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, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 19 authors, 2 keywords, 15 MeSH terms, 3 funders, 83 references.
Cite
This paper
Açıl, D., Andrews-Hanna, J. R., López-Solà, M., van Buuren, M., Krabbendam, L., Zhang, L., van der Meer, L., Fuentes-Claramonte, P., Pomarol-Clotet, E., Salvador, R., Debbané, M., Vrticka, P., Vuilleumier, P., Sbarra, D. A., Coppola, A. M., Tusche, A., White, L. O., Wager, T. D., & Koban, L. (2026). Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples. Nature communications, 17(1), 7229. https://
BibTeX
@article{acl2026brain,
author = {Açıl, Dorukhan and Andrews-Hanna, Jessica R and López-Solà, Marina and van Buuren, Mariët and Krabbendam, Lydia and Zhang, Liwen and van der Meer, Lisette and Fuentes-Claramonte, Paola and Pomarol-Clotet, Edith and Salvador, Raymond and Debbané, Martin and Vrticka, Pascal and Vuilleumier, Patrik and Sbarra, David A and Coppola, Andrea M and Tusche, Anita and White, Lars O and Wager, Tor D and Koban, Leonie},
title = {{Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7229},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
pmid = {42251044},
pmcid = {PMC13396484}
}
RIS
TY - JOUR
AU - Açıl, Dorukhan
AU - Andrews-Hanna, Jessica R
AU - López-Solà, Marina
AU - van Buuren, Mariët
AU - Krabbendam, Lydia
AU - Zhang, Liwen
AU - van der Meer, Lisette
AU - Fuentes-Claramonte, Paola
AU - Pomarol-Clotet, Edith
AU - Salvador, Raymond
AU - Debbané, Martin
AU - Vrticka, Pascal
AU - Vuilleumier, Patrik
AU - Sbarra, David A
AU - Coppola, Andrea M
AU - Tusche, Anita
AU - White, Lars O
AU - Wager, Tor D
AU - Koban, Leonie
TI - Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 7229
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Brain neuromarkers predict self- and other-related mentalizing across adult, clinical, and developmental samples",
"container-title": "Nature communications",
"author": [
{
"family": "Açıl",
"given": "Dorukhan"
},
{
"family": "Andrews-Hanna",
"given": "Jessica R"
},
{
"family": "López-Solà",
"given": "Marina"
},
{
"family": "van Buuren",
"given": "Mariët"
},
{
"family": "Krabbendam",
"given": "Lydia"
},
{
"family": "Zhang",
"given": "Liwen"
},
{
"family": "van der Meer",
"given": "Lisette"
},
{
"family": "Fuentes-Claramonte",
"given": "Paola"
},
{
"family": "Pomarol-Clotet",
"given": "Edith"
},
{
"family": "Salvador",
"given": "Raymond"
},
{
"family": "Debbané",
"given": "Martin"
},
{
"family": "Vrticka",
"given": "Pascal"
},
{
"family": "Vuilleumier",
"given": "Patrik"
},
{
"family": "Sbarra",
"given": "David A"
},
{
"family": "Coppola",
"given": "Andrea M"
},
{
"family": "Tusche",
"given": "Anita"
},
{
"family": "White",
"given": "Lars O"
},
{
"family": "Wager",
"given": "Tor D"
},
{
"family": "Koban",
"given": "Leonie"
}
],
"container-title-short":
"volume": "17",
"issue": "1",
"page": "7229",
"DOI": "10.1038/
"PMID": "42251044",
"PMCID": "PMC13396484",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
6
]
]
}
}
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.3758/s13415-026-01425-1 [code]
- Mindful minds: How group identity shapes brain and behavior in social decision-making.Journal: Cognitive, affective & behavioral neuroscienceIn common: SPM, 2 references, 2 authors
- [2] doi:10.1038/s41467-026-71568-9 [code]
- Convergent and selective representations of pain, appetitive processes, aversive processes, and cognitive control in the insula.Journal: Nature communicationsIn common: SPM, Statistics and Machine Learning Toolbox, 5 references, author Tor D. Wager
- [3] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: SPM, Statistics and Machine Learning Toolbox, 4 references, author Tor D. Wager
- [4] doi:10.1038/s41593-026-02219-x [code]
- A neural signature of adaptive mentalization.Journal: Nature neuroscienceIn common: SPM, Statistics and Machine Learning Toolbox, 7 references
- [5] doi:10.1038/s41467-026-71151-2 [code]
- Common and distinct neural correlates of social interaction processing and theory of mind in narratives.Journal: Nature communicationsIn common: SPM, Statistics and Machine Learning Toolbox, 3 references, author Tor D. Wager
- [6] doi:10.1038/s41467-026-74743-0 [code]
- Meta-analytic evidence for distinct neural correlates of conditioned versus verbally induced placebo analgesia.Journal: Nature communicationsIn common: SPM, Statistics and Machine Learning Toolbox, 1 reference, author Tor D. Wager
- [7] doi:10.1038/s41467-026-74331-2 [code]
- Trial-by-trial fMRI-neurofeedback dissociates fusiform and occipital contributions to face detection and recognition.Journal: Nature communicationsIn common: SPM, Statistics and Machine Learning Toolbox, author Patrik Vuilleumier
- [8] doi:10.3389/fncir.2026.1741762 [code]
- Task-dependent increases and decreases of BOLD signal in theory of mind brain regions during strategic social interaction.Journal: Frontiers in neural circuitsIn common: SPM, Statistics and Machine Learning Toolbox, 3 references
- [9] doi:10.1038/s41467-026-73153-6 [code]
- Latent neural architecture organising shared aesthetic evaluations of visual artworks.Journal: Nature communicationsIn common: Statistics and Machine Learning Toolbox, 4 references
- [10] doi:10.1038/s41380-026-03547-x [code]
- Multiscale characterization of cortical signatures in positive and negative schizotypy: a worldwide ENIGMA study.Journal: Molecular psychiatryIn common: schizophrenia / psychosis, author Martin Debbané
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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 36 scripts, and 22 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:5c7b2e691fb474f0…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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.
