When pain becomes self: limbic-default mode network hyperconnectivity predicts microvascular decompression failure in trigeminal neuralgia.
The 5 matches
- [1] § Materials and methods › Effect size ranking analysis ↔ 8SVM.m, lines 224 to 303 · score 0.78 · aTHA, pTHA, Subcortical region, HIP, AMY, CAU · Report a mismatch
- [2] § Results › The prediction model ↔ 8SVM.m, lines 305 to 445 · score 0.76 · fold cross validation, SVM classification, classification model, connectivity features, trained, AUC · Report a mismatch
- [3] § Materials and methods › Model construction ↔ 8SVM.m, lines 305 to 445 · score 0.67 · SVM classifier, cross validation, kernel, splits, train, model · Report a mismatch
- [4] § Results › Top 10 connections by effect size and healthy control group position ↔ 8SVM.m, lines 224 to 303 · score 0.64 · pTHA, cortical regions, AMY, CAU, GP, NAc · Report a mismatch
- [5] § Materials and methods › Model construction ↔ 8SVM.m, lines 488 to 539 · score 0.51 · confusion matrices, ROC, curve, SVM, AUC, classification · 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
MATLAB · 1,157 lines · 45 KB · CC-BY-4.0 · 5 matches
- %% =====================================================================
- % Brain Connectivity Group Comparison Analysis + Permutation Test +
- % Modeling with Top 10 Effect Size Connections
- % =====================================================================
- % clear; close all; clc;
- %% 1. Parameter Settings
- n_permutations = 5000; % Number of permutations (suggested: 1000-10000)
- alpha = 0.05; % Significance level
- fdr_threshold = 0.05; % FDR correction threshold
- %% 2. Load Data
- cd('D:\work\data_analysis\TN')
- load E_corr_cortex_subcortex_total_r
- E_group = corr_cortex_subcortex_r_FDR_all;
- load NE_corr_cortex_subcortex_total_r
- NE_group = corr_cortex_subcortex_r_FDR_all;
- fprintf('=== Brain Connectivity Group Comparison Analysis ===\n');
- fprintf('E-group dimensions: %s\n', mat2str(size(E_group)));
- fprintf('NE-group dimensions: %s\n', mat2str(size(NE_group)));
- %% 3. Data Preprocessing and Validation
- % Ensure correct data format
- if size(E_group,1) ~= 100 || size(E_group,2) ~= 16 || size(E_group,3) ~= 30
- error('Incorrect E_group dimensions, should be 100¡Á16¡Á30');
- end
- if size(NE_group,1) ~= 100 || size(NE_group,2) ~= 16 || size(NE_group,3) ~= 30
- error('Incorrect NE_group dimensions, should be 100¡Á16¡Á30');
- end
- % Check data validity
- if any(isnan(E_group(:))) || any(isinf(E_group(:)))
- warning('E_group contains NaN or Inf values');
- E_group(isnan(E_group)) = 0;
- E_group(isinf(E_group)) = 0;
- end
- if any(isnan(NE_group(:))) || any(isinf(NE_group(:)))
- warning('NE_group contains NaN or Inf values');
- NE_group(isnan(NE_group)) = 0;
- NE_group(isinf(NE_group)) = 0;
- end
- %% 4. Extract Connection Strength Vectors and Reshape Data
- % Flatten each subject's 100¡Á16 matrix into 1600-dimensional vector
- n_cortical = 100; % Number of cortical regions
- n_subcortical = 16; % Number of subcortical regions
- n_subjects_E = size(E_group, 3);
- n_subjects_NE = size(NE_group, 3);
- fprintf('Data reshaping:\n');
- fprintf('Connections per subject: %d ¡Á %d = %d\n', n_cortical, n_subcortical, n_cortical*n_subcortical);
- % Reshape data: each subject as a row, each column as a connection
- data_E = zeros(n_subjects_E, n_cortical * n_subcortical);
- data_NE = zeros(n_subjects_NE, n_cortical * n_subcortical);
- for subj = 1:n_subjects_E
- temp = squeeze(E_group(:,:,subj));
- data_E(subj, :) = temp(:)';
- end
- for subj = 1:n_subjects_NE
- temp = squeeze(NE_group(:,:,subj));
- data_NE(subj, :) = temp(:)';
- end
- fprintf('E-group data matrix: %s\n', mat2str(size(data_E)));
- fprintf('NE-group data matrix: %s\n', mat2str(size(data_NE)));
- %% 5. Calculate Group Difference Statistics (Real Data)
- fprintf('\n=== Calculating Real Group Differences ===\n');
- % Initialize result matrices
- real_t_stats = zeros(n_cortical, n_subcortical);
- real_p_values = zeros(n_cortical, n_subcortical);
- cohens_d = zeros(n_cortical, n_subcortical); % Effect size
- % Perform two-sample t-test for each connection
- for i = 1:n_cortical
- for j = 1:n_subcortical
- % Calculate connection index
- conn_idx = (i-1)*n_subcortical + j;
- % Extract group data for this connection
- conn_E = data_E(:, conn_idx);
- conn_NE = data_NE(:, conn_idx);
- % Two-sample t-test
- [~, p, ~, stats] = ttest2(conn_E, conn_NE, 'Vartype', 'unequal');
- % Store results
- real_t_stats(i, j) = stats.tstat;
- real_p_values(i, j) = p;
- % Calculate Cohen's d effect size
- mean_diff = mean(conn_E) - mean(conn_NE);
- pooled_std = sqrt((std(conn_E)^2 + std(conn_NE)^2)/2);
- cohens_d(i, j) = mean_diff / pooled_std;
- end
- end
- fprintf('Uncorrected significant connections: %d (p < %.3f)\n', sum(real_p_values(:) < alpha), alpha);
- %% 6. Permutation Test
- fprintf('\n=== Starting Permutation Test (%d permutations) ===\n', n_permutations);
- % Combine all data
- all_data = [data_E; data_NE];
- n_total = size(all_data, 1);
- labels = [ones(n_subjects_E, 1); 2*ones(n_subjects_NE, 1)];
- % Initialize permutation distribution
- perm_t_stats = zeros(n_cortical, n_subcortical, n_permutations);
- perm_max_t = zeros(n_permutations, 1); % Maximum t-value (for FWE correction)
- perm_min_t = zeros(n_permutations, 1); % Minimum t-value (two-sided test)
- fprintf('Progress: ');
- progress_step = round(n_permutations/20);
- for perm = 1:n_permutations
- % Display progress
- if mod(perm, progress_step) == 0
- fprintf('%d%% ', round(perm/n_permutations*100));
- end
- % Randomly permute labels
- perm_labels = labels(randperm(n_total));
- % Create permuted groups
- perm_group1_idx = perm_labels == 1;
- perm_group2_idx = perm_labels == 2;
- perm_data1 = all_data(perm_group1_idx, :);
- perm_data2 = all_data(perm_group2_idx, :);
- % Calculate permuted t-statistics
- perm_t_matrix = zeros(n_cortical, n_subcortical);
- for i = 1:n_cortical
- for j = 1:n_subcortical
- conn_idx = (i-1)*n_subcortical + j;
- conn1 = perm_data1(:, conn_idx);
- conn2 = perm_data2(:, conn_idx);
- % Calculate t-statistic (simplified version)
- mean1 = mean(conn1);
- mean2 = mean(conn2);
- std1 = std(conn1);
- std2 = std(conn2);
- n1 = length(conn1);
- n2 = length(conn2);
- % Two-sample t-statistic
- t_stat = (mean1 - mean2) / sqrt(std1^2/n1 + std2^2/n2);
- perm_t_matrix(i, j) = t_stat;
- end
- end
- % Store permutation results
- perm_t_stats(:,:,perm) = perm_t_matrix;
- % Record extreme statistics (for FWE correction)
- perm_max_t(perm) = max(abs(perm_t_matrix(:)));
- perm_min_t(perm) = min(perm_t_matrix(:));
- end
- fprintf('Completed!\n');
- %% 7. Calculate Permutation Test P-values
- fprintf('\n=== Calculating Permutation Test P-values ===\n');
- % Initialize results
- perm_p_values = zeros(n_cortical, n_subcortical);
- fwe_corrected_p = zeros(n_cortical, n_subcortical); % FWE-corrected p-values
- % Calculate p-value for each connection
- for i = 1:n_cortical
- for j = 1:n_subcortical
- % Get real t-value
- real_t = real_t_stats(i, j);
- % Calculate permutation p-value (two-sided test)
- if real_t > 0
- % For positive t-values: proportion of permutations ¡Ý real t
- extreme_count = sum(perm_t_stats(i,j,:) >= real_t);
- else
- % For negative t-values: proportion of permutations ¡Ü real t
- extreme_count = sum(perm_t_stats(i,j,:) <= real_t);
- end
- perm_p_values(i, j) = (extreme_count + 1) / (n_permutations + 1);
- % Calculate FWE-corrected p-value (based on maximum t-statistic)
- if real_t > 0
- fwe_extreme = sum(perm_max_t >= abs(real_t));
- else
- fwe_extreme = sum(perm_min_t <= real_t);
- end
- fwe_corrected_p(i, j) = (fwe_extreme + 1) / (n_permutations + 1);
- end
- end
- %% 8. FDR Correction
- fprintf('=== Performing FDR Correction ===\n');
- % Flatten p-value matrix for FDR correction
- all_perm_p = perm_p_values(:);
- all_fdr_p = mafdr(all_perm_p, 'BHFDR', true); % Using Storey's method
- % Reshape back to matrix
- fdr_corrected_p = reshape(all_fdr_p, n_cortical, n_subcortical);
- % Find FDR-corrected significant connections
- fdr_significant = fdr_corrected_p < fdr_threshold;
- fwe_significant = fwe_corrected_p < alpha;
- fprintf('Permutation test significant connections (uncorrected): %d\n', sum(perm_p_values(:) < alpha));
- fprintf('FDR-corrected significant connections (q < %.3f): %d\n', fdr_threshold, sum(fdr_significant(:)));
- fprintf('FWE-corrected significant connections (p < %.3f): %d\n', alpha, sum(fwe_significant(:)));
- %% 9. Find Top 10 Connections by Effect Size
- fprintf('\n=== Finding Top 10 Connections by Effect Size ===\n');
- % Load cortical region information
- fprintf('Loading cortical region information...\n');
- roi_data = readtable('Schaefer2018_100Parcels_7Networks_order_FSLMNI152_1mm.Centroid_RAS.csv');
- roi_names_raw = roi_data{:, 2};
- if isstring(roi_names_raw)
- roi_names = cellstr(roi_names_raw);
- elseif istable(roi_names_raw) || istimetable(roi_names_raw)
- roi_names = table2cell(roi_names_raw);
- else
- roi_names = roi_names_raw;
- end
- % Ensure 100x1 cell array
- if iscell(roi_names) && size(roi_names, 2) > 1
- roi_names = roi_names(:, 1);
- end
- % Subcortical region names
- subcortical_names = {
- 'HIP-rh', 'AMY-rh', 'pTHA-rh', 'aTHA-rh', 'NAc-rh', 'GP-rh', 'PUT-rh', 'CAU-rh', ...
- 'HIP-lh', 'AMY-lh', 'pTHA-lh', 'aTHA-lh', 'NAc-lh', 'GP-lh', 'PUT-lh', 'CAU-lh'
- };
- % Find top 10 connections by absolute effect size
- all_cohens_d_abs = abs(cohens_d(:));
- [~, sorted_indices] = sort(all_cohens_d_abs, 'descend');
- % Take only top 10
- n_top_conn = min(10, length(sorted_indices));
- top_conn_indices = sorted_indices(1:n_top_conn);
- % Get detailed information for top 10 connections
- top_conn_info = cell(n_top_conn, 7); % Store: cortical index, subcortical index, cortical name, subcortical name, t-value, p-value, effect size
- for k = 1:n_top_conn
- idx = top_conn_indices(k);
- [i, j] = ind2sub([n_cortical, n_subcortical], idx);
- % Get region names
- if i <= length(roi_names)
- cortical_name = roi_names{i};
- else
- cortical_name = sprintf('Cortical_%d', i);
- end
- if j <= length(subcortical_names)
- subcortical_name = subcortical_names{j};
- else
- subcortical_name = sprintf('Subcortical_%d', j);
- end
- % Simplify names for display
- cortical_short = strrep(cortical_name, '7Networks_', '');
- cortical_short = strrep(cortical_short, '_', ' ');
- if length(cortical_short) > 30
- cortical_short = [cortical_short(1:27) '...'];
- end
- subcortical_short = strrep(subcortical_name, '-', ' ');
- top_conn_info{k, 1} = i;
- top_conn_info{k, 2} = j;
- top_conn_info{k, 3} = cortical_short;
- top_conn_info{k, 4} = subcortical_short;
- top_conn_info{k, 5} = real_t_stats(i, j);
- top_conn_info{k, 6} = perm_p_values(i, j);
- top_conn_info{k, 7} = cohens_d(i, j);
- end
- % Display top 10 connections
- fprintf('\nTop 10 Connections by Effect Size:\n');
- fprintf('Rank\tCortical Region\t\t\t\t\tSubcortical Region\t\tCohen''s d\t\tp-value\n');
- fprintf('%s\n', repmat('-', 80, 1));
- for k = 1:n_top_conn
- fprintf('%2d\t%-35s\t%-15s\t%10.3f\t\t%.6f\n', ...
- k, top_conn_info{k,3}, top_conn_info{k,4}, ...
- top_conn_info{k,7}, top_conn_info{k,6});
- end
- %% 10. Classification Modeling with Top 10 Connections
- fprintf('\n=== Classification Modeling with Top 10 Connections ===\n');
- % Set classification parameters
- n_classification_permutations = 100; % Random repetitions for classification
- n_folds = 5; % Cross-validation folds
- % Prepare feature data
- top_conn_features = zeros(n_subjects_E + n_subjects_NE, n_top_conn);
- top_conn_labels = [ones(n_subjects_E, 1); zeros(n_subjects_NE, 1)]; % E-group=1, NE-group=0
- % Extract features
- for k = 1:n_top_conn
- i = top_conn_info{k, 1};
- j = top_conn_info{k, 2};
- conn_idx = (i-1)*n_subcortical + j;
- % Extract group data for this connection
- top_conn_features(:, k) = [data_E(:, conn_idx); data_NE(:, conn_idx)];
- end
- fprintf('Feature matrix dimensions: %s\n', mat2str(size(top_conn_features)));
- fprintf('Label dimensions: %s\n', mat2str(size(top_conn_labels)));
- % Initialize result storage
- classification_results = struct();
- classification_results.accuracy_all = zeros(n_classification_permutations, 1);
- classification_results.auc_all = zeros(n_classification_permutations, 1);
- classification_results.feature_importance_all = zeros(n_classification_permutations, n_top_conn);
- classification_results.predictions_all = cell(n_classification_permutations, 1);
- classification_results.true_labels_all = cell(n_classification_permutations, 1);
- classification_results.scores_all = cell(n_classification_permutations, 1);
- % Start classification modeling
- fprintf('Starting classification modeling (%d random repetitions)...\n', n_classification_permutations);
- for perm = 1:n_classification_permutations
- if mod(perm, 10) == 0
- fprintf(' Processing iteration %d/%d...\n', perm, n_classification_permutations);
- end
- % Randomly shuffle data
- rng(perm); % Set random seed for reproducibility
- n_samples = size(top_conn_features, 1);
- shuffle_idx = randperm(n_samples);
- X_shuffled = top_conn_features(shuffle_idx, :);
- y_shuffled = top_conn_labels(shuffle_idx);
- % 5-fold cross-validation
- cv_indices = crossvalind('Kfold', y_shuffled, n_folds);
- fold_accuracy = zeros(n_folds, 1);
- fold_predictions = [];
- fold_true_labels = [];
- fold_scores = [];
- fold_feature_importance = zeros(n_folds, n_top_conn);
- for fold = 1:n_folds
- % Split training and testing sets
- test_idx = (cv_indices == fold);
- train_idx = ~test_idx;
- X_train = X_shuffled(train_idx, :);
- y_train = y_shuffled(train_idx);
- X_test = X_shuffled(test_idx, :);
- y_test = y_shuffled(test_idx);
- % Train SVM classifier
- try
- % Use linear SVM
- svm_model = fitcsvm(X_train, y_train, ...
- 'KernelFunction', 'linear', ...
- 'Standardize', true, ...
- 'BoxConstraint', 1);
- % Predict
- [y_pred, scores] = predict(svm_model, X_test);
- % Calculate accuracy
- fold_accuracy(fold) = sum(y_pred == y_test) / length(y_test);
- % Store prediction results
- fold_predictions = [fold_predictions; y_pred];
- fold_true_labels = [fold_true_labels; y_test];
- fold_scores = [fold_scores; scores(:, 2)]; % Positive class probability scores
- % Calculate feature importance (SVM weights)
- if isprop(svm_model, 'Beta')
- fold_feature_importance(fold, :) = abs(svm_model.Beta)';
- else
- % Alternative method if weights cannot be obtained directly
- fold_feature_importance(fold, :) = rand(1, n_top_conn);
- end
- catch ME
- fprintf('Warning: Error in fold %d: %s\n', fold, ME.message);
- fold_accuracy(fold) = 0.5; % Random guessing accuracy
- end
- end
- % Store this iteration's results
- classification_results.accuracy_all(perm) = mean(fold_accuracy);
- classification_results.predictions_all{perm} = fold_predictions;
- classification_results.true_labels_all{perm} = fold_true_labels;
- classification_results.scores_all{perm} = fold_scores;
- classification_results.feature_importance_all(perm, :) = mean(fold_feature_importance, 1);
- % Calculate AUC
- try
- [~, ~, ~, auc] = perfcurve(fold_true_labels, fold_scores, 1);
- classification_results.auc_all(perm) = auc;
- catch
- classification_results.auc_all(perm) = 0.5;
- end
- end
- % Calculate average performance
- mean_accuracy = mean(classification_results.accuracy_all);
- std_accuracy = std(classification_results.accuracy_all);
- mean_auc = mean(classification_results.auc_all);
- std_auc = std(classification_results.auc_all);
- mean_feature_importance = mean(classification_results.feature_importance_all, 1);
- fprintf('\nClassification Results Statistics:\n');
- fprintf(' Average Accuracy: %.3f ¡À %.3f (range: %.3f - %.3f)\n', ...
- mean_accuracy, std_accuracy, min(classification_results.accuracy_all), max(classification_results.accuracy_all));
- fprintf(' Average AUC: %.3f ¡À %.3f (range: %.3f - %.3f)\n', ...
- mean_auc, std_auc, min(classification_results.auc_all), max(classification_results.auc_all));
- fprintf(' Chance level: 0.500\n');
- % Statistical significance (permutation test)
- n_above_chance = sum(classification_results.accuracy_all > 0.5);
- classification_p_value = (n_above_chance + 1) / (n_classification_permutations + 1);
- fprintf(' Permutation test p-value: %.4f\n', classification_p_value);
- % Determine significance
- if classification_p_value < 0.05
- fprintf(' ? Classification performance significantly above chance level (p < 0.05)\n');
- else
- fprintf(' ? Classification performance not significantly above chance level (p = %.4f)\n', classification_p_value);
- end
- %% 11. Visualization of Classification Results
- fprintf('\n=== Generating Classification Result Visualizations ===\n');
- figure('Position', [100, 100, 1400, 900], 'Name', 'Classification Analysis Results', 'Color', 'white');
- % Subplot 1: Accuracy Distribution
- subplot(2, 3, 1);
- histogram(classification_results.accuracy_all, 20, 'FaceColor', [0.2, 0.6, 0.8], 'EdgeColor', 'none');
- hold on;
- xline(0.5, 'r--', 'LineWidth', 2, 'Color', [0.8, 0.2, 0.2]);
- xline(mean_accuracy, 'k-', 'LineWidth', 2);
- xline(mean_accuracy + std_accuracy, 'k:', 'LineWidth', 1.5);
- xline(mean_accuracy - std_accuracy, 'k:', 'LineWidth', 1.5);
- xlabel('Classification Accuracy', 'FontSize', 12, 'FontWeight', 'bold');
- ylabel('Frequency', 'FontSize', 12, 'FontWeight', 'bold');
- title(sprintf('Accuracy Distribution (n=%d iterations)', n_classification_permutations), ...
- 'FontSize', 14, 'FontWeight', 'bold');
- legend('Distribution', 'Chance level', 'Mean', '¡À1 SD', 'Location', 'best', 'FontSize', 10);
- grid on;
- % Add statistics text
- stats_text = sprintf('Mean = %.3f ¡À %.3f\nRange = [%.3f, %.3f]\np = %.4f', ...
- mean_accuracy, std_accuracy, min(classification_results.accuracy_all), ...
- max(classification_results.accuracy_all), classification_p_value);
- text(0.05, 0.95, stats_text, 'Units', 'normalized', ...
- 'HorizontalAlignment', 'left', 'VerticalAlignment', 'top', ...
- 'FontSize', 11, 'FontWeight', 'bold', ...
- 'BackgroundColor', [1, 1, 0.9], 'EdgeColor', 'k', 'Margin', 2);
- % Subplot 2: ROC Curve
- subplot(2, 3, 2);
- % Combine all iteration predictions for ROC
- all_true_labels = [];
- all_scores = [];
- for perm = 1:n_classification_permutations
- all_true_labels = [all_true_labels; classification_results.true_labels_all{perm}];
- all_scores = [all_scores; classification_results.scores_all{perm}];
- end
- % Calculate ROC curve
- [X_roc, Y_roc, T_roc, AUC_roc] = perfcurve(all_true_labels, all_scores, 1);
- % Plot ROC curve
- plot(X_roc, Y_roc, 'b-', 'LineWidth', 2);
- hold on;
- plot([0, 1], [0, 1], 'r--', 'LineWidth', 1.5); % Random line
- xlabel('False Positive Rate (FPR)', 'FontSize', 12, 'FontWeight', 'bold');
- ylabel('True Positive Rate (TPR)', 'FontSize', 12, 'FontWeight', 'bold');
- title(sprintf('Average ROC Curve (AUC = %.3f)', mean_auc), ...
- 'FontSize', 14, 'FontWeight', 'bold');
- legend(sprintf('SVM (AUC = %.3f)', mean_auc), 'Random Classifier', ...
- 'Location', 'southeast', 'FontSize', 11);
- grid on;
- axis equal;
- xlim([0, 1]);
- ylim([0, 1]);
- % Subplot 3: Confusion Matrix
- subplot(2, 3, 3);
- % Calculate average confusion matrix
- all_predictions = [];
- all_true = [];
- for perm = 1:n_classification_permutations
- all_predictions = [all_predictions; classification_results.predictions_all{perm}];
- all_true = [all_true; classification_results.true_labels_all{perm}];
- end
- conf_mat = confusionmat(all_true, all_predictions);
- conf_mat_normalized = conf_mat ./ sum(conf_mat, 2);
- % Plot heatmap
- imagesc(conf_mat_normalized);
- colorbar;
- caxis([0, 1]);
- colormap(jet);
- % Add numerical labels
- for i = 1:2
- for j = 1:2
- text(j, i, sprintf('%.3f', conf_mat_normalized(i,j)), ...
- 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle', ...
- 'FontSize', 14, 'FontWeight', 'bold', 'Color', 'w');
- end
- end
- set(gca, 'XTick', 1:2, 'XTickLabel', {'Predicted E', 'Predicted NE'}, ...
- 'YTick', 1:2, 'YTickLabel', {'True E', 'True NE'}, ...
- 'FontSize', 12, 'FontWeight', 'bold');
- title('Normalized Confusion Matrix (Average)', 'FontSize', 14, 'FontWeight', 'bold');
- % Subplot 4: Feature Importance vs Effect Size
- subplot(2, 3, 4);
- % Sort by feature importance
- [sorted_importance, sort_idx] = sort(mean_feature_importance, 'descend');
- sorted_names = cell(n_top_conn, 1);
- sorted_cohens_d = zeros(n_top_conn, 1);
- for k = 1:n_top_conn
- idx = sort_idx(k);
- sorted_names{k} = sprintf('%s-%s', top_conn_info{idx,3}(1:min(10, length(top_conn_info{idx,3}))), ...
- top_conn_info{idx,4}(1:min(5, length(top_conn_info{idx,4}))));
- sorted_cohens_d(k) = top_conn_info{idx,7};
- end
- % Plot double bar chart
- x_pos = 1:n_top_conn;
- bar_width = 0.35;
- bar(x_pos - bar_width/2, sorted_importance, bar_width, ...
- 'FaceColor', [0.2, 0.6, 0.8], 'DisplayName', 'Feature Importance');
- hold on;
- bar(x_pos + bar_width/2, sorted_cohens_d, bar_width, ...
- 'FaceColor', [0.8, 0.4, 0.2], 'DisplayName', 'Cohen''s d');
- xlabel('Feature Rank', 'FontSize', 12, 'FontWeight', 'bold');
- ylabel('Importance / Effect Size', 'FontSize', 12, 'FontWeight', 'bold');
- title('Feature Importance vs Effect Size', 'FontSize', 14, 'FontWeight', 'bold');
- set(gca, 'XTick', 1:n_top_conn, 'XTickLabel', sorted_names, 'FontSize', 9, 'XTickLabelRotation', 45);
- legend('Location', 'best', 'FontSize', 10);
- grid on;
- % Subplot 5: Group Comparison for Top 3 Features
- subplot(2, 3, 5);
- % Select top 3 most important features
- n_show_features = min(3, n_top_conn);
- for k = 1:n_show_features
- idx = sort_idx(k);
- i = top_conn_info{idx, 1};
- j = top_conn_info{idx, 2};
- conn_idx = (i-1)*n_subcortical + j;
- % Extract data
- feature_data_E = data_E(:, conn_idx);
- feature_data_NE = data_NE(:, conn_idx);
- % Create subplot
- subplot(2, 3, 5);
- subplot_pos = 0.1 + (k-1)*0.25;
- axes('Position', [subplot_pos, 0.15, 0.2, 0.3]);
- % Plot boxplot
- boxplot([feature_data_E; feature_data_NE], ...
- [ones(n_subjects_E,1); 2*ones(n_subjects_NE,1)], ...
- 'Labels', {'E Group', 'NE Group'});
- hold on;
- % Add scatter points
- scatter(ones(n_subjects_E,1) + (rand(n_subjects_E,1)-0.5)*0.1, feature_data_E, ...
- 30, 'filled', 'MarkerFaceColor', [0.2, 0.4, 0.8], 'MarkerFaceAlpha', 0.6);
- scatter(2*ones(n_subjects_NE,1) + (rand(n_subjects_NE,1)-0.5)*0.1, feature_data_NE, ...
- 30, 'filled', 'MarkerFaceColor', [0.8, 0.4, 0.2], 'MarkerFaceAlpha', 0.6);
- title(sprintf('Feature #%d: %s', k, sorted_names{k}(1:min(15, length(sorted_names{k})))), ...
- 'FontSize', 11);
- ylabel('Connection Strength', 'FontSize', 10);
- grid on;
- % Add effect size information
- text(1.5, max([feature_data_E; feature_data_NE])*1.05, ...
- sprintf('d=%.2f', sorted_cohens_d(k)), ...
- 'HorizontalAlignment', 'center', 'FontSize', 10, 'FontWeight', 'bold');
- end
- % Set main title
- axes('Position', [0, 0, 1, 1], 'Visible', 'off');
- text(0.5, 0.95, 'Group Comparison for Top 3 Features', ...
- 'HorizontalAlignment', 'center', 'FontSize', 14, 'FontWeight', 'bold');
- % Subplot 6: Feature Correlation Matrix
- subplot(2, 3, 6);
- % Calculate feature correlations
- feature_corr = corr(top_conn_features);
- imagesc(feature_corr);
- colorbar;
- caxis([-1, 1]);
- colormap(jet);
- % Add correlation values
- for i = 1:n_top_conn
- for j = 1:n_top_conn
- if i ~= j
- text(j, i, sprintf('%.2f', feature_corr(i,j)), ...
- 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle', ...
- 'FontSize', 8, 'FontWeight', 'bold', 'Color', 'w');
- else
- text(j, i, '1.00', ...
- 'HorizontalAlignment', 'center', 'VerticalAlignment', 'middle', ...
- 'FontSize', 8, 'FontWeight', 'bold', 'Color', 'w');
- end
- end
- end
- set(gca, 'XTick', 1:n_top_conn, 'XTickLabel', 1:n_top_conn, ...
- 'YTick', 1:n_top_conn, 'YTickLabel', 1:n_top_conn, ...
- 'FontSize', 9, 'FontWeight', 'bold');
- xlabel('Feature Index', 'FontSize', 12, 'FontWeight', 'bold');
- ylabel('Feature Index', 'FontSize', 12, 'FontWeight', 'bold');
- title('Feature Correlation Matrix', 'FontSize', 14, 'FontWeight', 'bold');
- %% 12. Detailed Results Output and Saving
- fprintf('\n=== Saving Detailed Results ===\n');
- % Create detailed results structure
- detailed_results = struct();
- detailed_results.perm_test_results = struct();
- detailed_results.perm_test_results.real_t_stats = real_t_stats;
- detailed_results.perm_test_results.real_p_values = real_p_values;
- detailed_results.perm_test_results.perm_p_values = perm_p_values;
- detailed_results.perm_test_results.fdr_corrected_p = fdr_corrected_p;
- detailed_results.perm_test_results.fwe_corrected_p = fwe_corrected_p;
- detailed_results.perm_test_results.cohens_d = cohens_d;
- detailed_results.perm_test_results.significant_fdr = fdr_significant;
- detailed_results.perm_test_results.significant_fwe = fwe_significant;
- detailed_results.top_connections = struct();
- detailed_results.top_connections.n_top = n_top_conn;
- detailed_results.top_connections.indices = top_conn_indices;
- detailed_results.top_connections.info = top_conn_info;
- detailed_results.top_connections.features = top_conn_features;
- detailed_results.top_connections.labels = top_conn_labels;
- detailed_results.classification_results = classification_results;
- detailed_results.classification_results.mean_accuracy = mean_accuracy;
- detailed_results.classification_results.std_accuracy = std_accuracy;
- detailed_results.classification_results.mean_auc = mean_auc;
- detailed_results.classification_results.std_auc = std_auc;
- detailed_results.classification_results.mean_feature_importance = mean_feature_importance;
- detailed_results.classification_results.p_value = classification_p_value;
- % Save results
- save('complete_analysis_results.mat', 'detailed_results');
- fprintf('Detailed results saved to complete_analysis_results.mat\n');
- % Save top 10 connections table
- top_conn_table = cell2table(top_conn_info, ...
- 'VariableNames', {'Cortical_Index', 'Subcortical_Index', 'Cortical_Name', ...
- 'Subcortical_Name', 't_stat', 'p_value', 'Cohens_d'});
- writetable(top_conn_table, 'top_10_connections.csv');
- fprintf('Top 10 connections information saved to top_10_connections.csv\n');
- % Save classification results
- classification_summary = table();
- classification_summary.Metric = {'Mean_Accuracy'; 'Accuracy_SD'; 'Mean_AUC'; 'AUC_SD'; 'Permutation_p_value'};
- classification_summary.Value = [mean_accuracy; std_accuracy; mean_auc; std_auc; classification_p_value];
- writetable(classification_summary, 'classification_summary.csv');
- fprintf('Classification summary saved to classification_summary.csv\n');
- %% 13. Final Summary Report
- fprintf('\n========== FINAL ANALYSIS SUMMARY ==========\n');
- fprintf('Dataset Information:\n');
- fprintf(' E-group subjects: %d\n', n_subjects_E);
- fprintf(' NE-group subjects: %d\n', n_subjects_NE);
- fprintf(' Total connections: %d ¡Á %d = %d\n', n_cortical, n_subcortical, n_cortical*n_subcortical);
- fprintf('\nPermutation Test Results:\n');
- fprintf(' Permutations: %d\n', n_permutations);
- fprintf(' FDR-significant connections: %d\n', sum(fdr_significant(:)));
- fprintf(' Maximum effect size (|Cohen''s d|): %.3f\n', max(abs(cohens_d(:))));
- fprintf('\nTop 10 Connections by Effect Size:\n');
- for k = 1:min(5, n_top_conn)
- fprintf(' %d. %s - %s (d=%.3f, p=%.4f)\n', ...
- k, top_conn_info{k,3}, top_conn_info{k,4}, ...
- top_conn_info{k,7}, top_conn_info{k,6});
- end
- fprintf('\nClassification Modeling Results:\n');
- fprintf(' Random repetitions: %d\n', n_classification_permutations);
- fprintf(' Cross-validation folds: %d\n', n_folds);
- fprintf(' Mean accuracy: %.3f ¡À %.3f\n', mean_accuracy, std_accuracy);
- fprintf(' Mean AUC: %.3f ¡À %.3f\n', mean_auc, std_auc);
- fprintf(' Permutation test p-value: %.4f\n', classification_p_value);
- if classification_p_value < 0.05
- fprintf(' ¡ú Classification performance is SIGNIFICANTLY above chance level!\n');
- else
- fprintf(' ¡ú Classification performance is NOT SIGNIFICANT\n');
- end
- fprintf('\n========== ANALYSIS COMPLETED! ==========\n');
- fprintf
- %% =====================================================================
- %% 13. Final Summary Report
- fprintf('\n========== FINAL ANALYSIS SUMMARY ==========\n');
- fprintf('Dataset Information:\n');
- fprintf(' E-group subjects: %d\n', n_subjects_E);
- fprintf(' NE-group subjects: %d\n', n_subjects_NE);
- fprintf(' Total connections: %d ¡Á %d = %d\n', n_cortical, n_subcortical, n_cortical*n_subcortical);
- fprintf('\nPermutation Test Results:\n');
- fprintf(' Permutations: %d\n', n_permutations);
- fprintf(' FDR-significant connections: %d\n', sum(fdr_significant(:)));
- fprintf(' Maximum effect size (|Cohen''s d|): %.3f\n', max(abs(cohens_d(:))));
- fprintf('\nTop 10 Connections by Effect Size:\n');
- for k = 1:min(5, n_top_conn)
- fprintf(' %d. %s - %s (d=%.3f, p=%.4f)\n', ...
- k, top_conn_info{k,3}, top_conn_info{k,4}, ...
- top_conn_info{k,7}, top_conn_info{k,6});
- end
- fprintf('\nClassification Modeling Results:\n');
- fprintf(' Random repetitions: %d\n', n_classification_permutations);
- fprintf(' Cross-validation folds: %d\n', n_folds);
- fprintf(' Mean accuracy: %.3f ¡À %.3f\n', mean_accuracy, std_accuracy);
- fprintf(' Mean AUC: %.3f ¡À %.3f\n', mean_auc, std_auc);
- fprintf(' Permutation test p-value: %.4f\n', classification_p_value);
- if classification_p_value < 0.05
- fprintf(' ¡ú Classification performance is SIGNIFICANTLY above chance level!\n');
- else
- fprintf(' ¡ú Classification performance is NOT SIGNIFICANT\n');
- end
- fprintf('\n========== ANALYSIS COMPLETED! ==========\n');
- % ɾ³ý»ò×¢Ê͵ôÏÂÃæÕâÐÐ
- % fprintf
- %% =====================================================================
- % ÐÂÔö²¿·Ö£º±£´æ·ÖÀà·ÖÎöͼÏñΪ¸ßÖÊÁ¿Ê¸Á¿Í¼£¨±£´æµ½Vector_FiguresÎļþ¼Ð£©
- %% 13. Final Summary Report
- fprintf('\n========== FINAL ANALYSIS SUMMARY ==========\n');
- fprintf('Dataset Information:\n');
- fprintf(' E-group subjects: %d\n', n_subjects_E);
- fprintf(' NE-group subjects: %d\n', n_subjects_NE);
- fprintf(' Total connections: %d ¡Á %d = %d\n', n_cortical, n_subcortical, n_cortical*n_subcortical);
- fprintf('\nPermutation Test Results:\n');
- fprintf(' Permutations: %d\n', n_permutations);
- fprintf(' FDR-significant connections: %d\n', sum(fdr_significant(:)));
- fprintf(' Maximum effect size (|Cohen''s d|): %.3f\n', max(abs(cohens_d(:))));
- fprintf('\nTop 10 Connections by Effect Size:\n');
- for k = 1:min(5, n_top_conn)
- fprintf(' %d. %s - %s (d=%.3f, p=%.4f)\n', ...
- k, top_conn_info{k,3}, top_conn_info{k,4}, ...
- top_conn_info{k,7}, top_conn_info{k,6});
- end
- fprintf('\nClassification Modeling Results:\n');
- fprintf(' Random repetitions: %d\n', n_classification_permutations);
- fprintf(' Cross-validation folds: %d\n', n_folds);
- fprintf(' Mean accuracy: %.3f ¡À %.3f\n', mean_accuracy, std_accuracy);
- fprintf(' Mean AUC: %.3f ¡À %.3f\n', mean_auc, std_auc);
- fprintf(' Permutation test p-value: %.4f\n', classification_p_value);
- if classification_p_value < 0.05
- fprintf(' ¡ú Classification performance is SIGNIFICANTLY above chance level!\n');
- else
- fprintf(' ¡ú Classification performance is NOT SIGNIFICANT\n');
- end
- fprintf('\n========== ANALYSIS COMPLETED! ==========\n');
- % ɾ³ý»ò×¢Ê͵ôÏÂÃæÕâÐÐ
- % fprintf
- %% =====================================================================
- % ±£´æÍ¼Ïñ²¿·Ö´ÓÕâÀ↑ʼ
- % =====================================================================
- fprintf('\n========================================\n');
- fprintf('Saving classification analysis figures as vector graphics...\n');
- fprintf('========================================\n');
- % ´´½¨±£´æÍ¼ÏñµÄÎļþ¼Ð
- output_folder = 'Vector_Figures';
- if ~exist(output_folder, 'dir')
- mkdir(output_folder);
- end
- % ÔÚVector_FiguresÏ´´½¨·ÖÀà½á¹ûµÄ×ÓÎļþ¼Ð
- classification_subfolder = fullfile(output_folder, 'Classification_Results');
- if ~exist(classification_subfolder, 'dir')
- mkdir(classification_subfolder);
- end
- % »ñÈ¡µ±Ç°Ê±¼ä´Á
- timestamp = datestr(now, 'yyyymmdd_HHMMSS');
- % ¶¨ÒåÒª±£´æµÄfigure
- figure_info = {
- 1, 'Classification_Analysis_Results';
- };
- % ÉèÖÃͼÐÎÊôÐÔ
- set(0, 'DefaultAxesFontName', 'Arial');
- set(0, 'DefaultTextFontName', 'Arial');
- % ±£´æÖ÷ͼ
- for i = 1:size(figure_info, 1)
- fig_num = figure_info{i, 1};
- fig_name = figure_info{i, 2};
- if ishandle(fig_num)
- figure(fig_num);
- set(gcf, 'PaperPositionMode', 'auto');
- set(gcf, 'InvertHardcopy', 'off');
- set(gcf, 'Renderer', 'painters');
- fprintf('\nSaving Figure %d: %s\n', fig_num, fig_name);
- % ±£´æÎªPDF
- pdf_filename = fullfile(classification_subfolder, sprintf('%s_%s.pdf', fig_name, timestamp));
- try
- exportgraphics(gcf, pdf_filename, 'ContentType', 'vector');
- fprintf(' ? Saved PDF: %s\n', pdf_filename);
- catch
- print(gcf, pdf_filename, '-dpdf', '-r600');
- fprintf(' ? Saved PDF (print): %s\n', pdf_filename);
- end
- % ±£´æÎªEPS
- eps_filename = fullfile(classification_subfolder, sprintf('%s_%s.eps', fig_name, timestamp));
- print(gcf, eps_filename, '-depsc', '-r600');
- fprintf(' ? Saved EPS: %s\n', eps_filename);
- % ±£´æÎªPNG
- png_filename = fullfile(classification_subfolder, sprintf('%s_%s.png', fig_name, timestamp));
- print(gcf, png_filename, '-dpng', '-r300');
- fprintf(' ? Saved PNG: %s\n', png_filename);
- end
- end
- fprintf('\n========================================\n');
- fprintf('All figures saved to: %s\n', classification_subfolder);
- fprintf('========================================\n');
- %% 13. Final Summary Report
- fprintf('\n========== FINAL ANALYSIS SUMMARY ==========\n');
- fprintf('Dataset Information:\n');
- fprintf(' E-group subjects: %d\n', n_subjects_E);
- fprintf(' NE-group subjects: %d\n', n_subjects_NE);
- fprintf(' Total connections: %d ¡Á %d = %d\n', n_cortical, n_subcortical, n_cortical*n_subcortical);
- fprintf('\nPermutation Test Results:\n');
- fprintf(' Permutations: %d\n', n_permutations);
- fprintf(' FDR-significant connections: %d\n', sum(fdr_significant(:)));
- fprintf(' Maximum effect size (|Cohen''s d|): %.3f\n', max(abs(cohens_d(:))));
- fprintf('\nTop 10 Connections by Effect Size:\n');
- for k = 1:min(5, n_top_conn)
- fprintf(' %d. %s - %s (d=%.3f, p=%.4f)\n', ...
- k, top_conn_info{k,3}, top_conn_info{k,4}, ...
- top_conn_info{k,7}, top_conn_info{k,6});
- end
- fprintf('\nClassification Modeling Results:\n');
- fprintf(' Random repetitions: %d\n', n_classification_permutations);
- fprintf(' Cross-validation folds: %d\n', n_folds);
- fprintf(' Mean accuracy: %.3f ¡À %.3f\n', mean_accuracy, std_accuracy);
- fprintf(' Mean AUC: %.3f ¡À %.3f\n', mean_auc, std_auc);
- fprintf(' Permutation test p-value: %.4f\n', classification_p_value);
- if classification_p_value < 0.05
- fprintf(' ¡ú Classification performance is SIGNIFICANTLY above chance level!\n');
- else
- fprintf(' ¡ú Classification performance is NOT SIGNIFICANT\n');
- end
- fprintf('\n========== ANALYSIS COMPLETED! ==========\n');
- % ɾ³ý»ò×¢Ê͵ôÏÂÃæÕâÐÐ
- % fprintf
- %% =====================================================================
- % ±£´æÍ¼Ïñ²¿·Ö - ±£´æµ½ vector_figures Îļþ¼Ð
- % =====================================================================
- fprintf('\n========================================\n');
- fprintf('Saving classification analysis figures to vector_figures folder...\n');
- fprintf('========================================\n');
- % ´´½¨±£´æÍ¼ÏñµÄÎļþ¼Ð£¨Ê¹ÓÃСд vector_figures£©
- output_folder = 'vector_figures';
- if ~exist(output_folder, 'dir')
- mkdir(output_folder);
- fprintf('Created folder: %s\n', output_folder);
- end
- % ÔÚvector_figuresÏ´´½¨·ÖÀà½á¹ûµÄ×ÓÎļþ¼Ð
- classification_subfolder = fullfile(output_folder, 'Classification_Results');
- if ~exist(classification_subfolder, 'dir')
- mkdir(classification_subfolder);
- fprintf('Created subfolder: %s\n', classification_subfolder);
- end
- % »ñÈ¡µ±Ç°Ê±¼ä´Á
- timestamp = datestr(now, 'yyyymmdd_HHMMSS');
- % ¶¨ÒåÒª±£´æµÄfigure
- figure_info = {
- 1, 'Classification_Analysis_Results';
- };
- % ÉèÖÃͼÐÎÊôÐÔ
- set(0, 'DefaultAxesFontName', 'Arial');
- set(0, 'DefaultTextFontName', 'Arial');
- % ±£´æÖ÷ͼ
- for i = 1:size(figure_info, 1)
- fig_num = figure_info{i, 1};
- fig_name = figure_info{i, 2};
- if ishandle(fig_num)
- figure(fig_num);
- set(gcf, 'PaperPositionMode', 'auto');
- set(gcf, 'InvertHardcopy', 'off');
- set(gcf, 'Renderer', 'painters');
- fprintf('\nSaving Figure %d: %s\n', fig_num, fig_name);
- % 1. ±£´æÎªPDF£¨Ê¸Á¿¸ñʽ£¬×îÊʺϲåÈëÂÛÎÄ£©
- pdf_filename = fullfile(classification_subfolder, sprintf('%s_%s.pdf', fig_name, timestamp));
- try
- exportgraphics(gcf, pdf_filename, 'ContentType', 'vector');
- fprintf(' ? Saved PDF (vector): %s\n', pdf_filename);
- catch
- print(gcf, pdf_filename, '-dpdf', '-r600');
- fprintf(' ? Saved PDF (print): %s\n', pdf_filename);
- end
- % 2. ±£´æÎªEPS£¨Ê¸Á¿¸ñʽ£¬ÊʺÏLaTeX£©
- eps_filename = fullfile(classification_subfolder, sprintf('%s_%s.eps', fig_name, timestamp));
- print(gcf, eps_filename, '-depsc', '-r600');
- fprintf(' ? Saved EPS (vector): %s\n', eps_filename);
- % 3. ±£´æÎªTIFF£¨¸ß·Ö±æÂÊ£¬ÊÊºÏÆÚ¿¯Í¶¸å£©
- tiff_filename = fullfile(classification_subfolder, sprintf('%s_%s_600dpi.tiff', fig_name, timestamp));
- print(gcf, tiff_filename, '-dtiff', '-r600');
- fprintf(' ? Saved TIFF (600 DPI): %s\n', tiff_filename);
- % 4. ±£´æÎªPNG£¨¸ß·Ö±æÂÊ£¬ÊʺϿìËÙÔ¤ÀÀ£©
- png_filename = fullfile(classification_subfolder, sprintf('%s_%s_600dpi.png', fig_name, timestamp));
- print(gcf, png_filename, '-dpng', '-r600');
- fprintf(' ? Saved PNG (600 DPI): %s\n', png_filename);
- % 5. ±£´æÎªJPEG£¨Ñ¹Ëõ¸ñʽ£¬ÊʺÏÍøÒ³£©
- jpg_filename = fullfile(classification_subfolder, sprintf('%s_%s_300dpi.jpg', fig_name, timestamp));
- print(gcf, jpg_filename, '-djpeg', '-r300');
- fprintf(' ? Saved JPEG (300 DPI): %s\n', jpg_filename);
- end
- end
- % ¶îÍâ±£´æ£º½«Figure 1µÄÿ¸ö×Óͼµ¥¶À±£´æ
- if ishandle(1)
- figure(1);
- % »ñÈ¡µ±Ç°figureµÄËùÓÐaxes
- all_axes = findall(gcf, 'Type', 'axes');
- subplot_counter = 0;
- subplot_names = {'01_Accuracy_Distribution', '02_ROC_Curve', '03_Confusion_Matrix', ...
- '04_Feature_Importance', '05_Group_Comparison', '06_Correlation_Matrix'};
- for ax_idx = 1:length(all_axes)
- % Ìø¹ýcolorbarºÍlegend
- ax_tag = get(all_axes(ax_idx), 'Tag');
- if ~isempty(ax_tag) && (strcmp(ax_tag, 'colorbar') || strcmp(ax_tag, 'legend') || strcmp(ax_tag, 'annotation'))
- continue;
- end
- % »ñÈ¡axesµÄλÖÃ
- ax_pos = get(all_axes(ax_idx), 'Position');
- % Ö»±£´æÖ÷ÒªµÄ×Óͼ
- if ax_pos(1) > 0.02 && ax_pos(1) < 0.98 && ax_pos(2) > 0.02 && ax_pos(2) < 0.98
- subplot_counter = subplot_counter + 1;
- % ´´½¨ÐµÄfigure
- single_fig = figure('Visible', 'off', 'Position', [100, 100, 500, 400], ...
- 'Color', 'white', 'Renderer', 'painters');
- % ¸´ÖÆaxesÄÚÈÝ
- new_ax = copyobj(all_axes(ax_idx), single_fig);
- set(new_ax, 'Position', [0.13, 0.11, 0.775, 0.815]);
- % ÉèÖÃ×ÓͼÃû³Æ
- if subplot_counter <= length(subplot_names)
- subplot_name = subplot_names{subplot_counter};
- else
- subplot_name = sprintf('Subplot_%02d', subplot_counter);
- end
- % ±£´æµ¥¸ö×ÓͼΪPDF
- subplot_pdf = fullfile(classification_subfolder, sprintf('%s_%s.pdf', subplot_name, timestamp));
- try
- exportgraphics(single_fig, subplot_pdf, 'ContentType', 'vector');
- fprintf(' ? Saved subplot %d as PDF: %s\n', subplot_counter, subplot_pdf);
- catch
- print(single_fig, subplot_pdf, '-dpdf', '-r600');
- end
- % ±£´æµ¥¸ö×ÓͼΪTIFF
- subplot_tiff = fullfile(classification_subfolder, sprintf('%s_%s_600dpi.tiff', subplot_name, timestamp));
- print(single_fig, subplot_tiff, '-dtiff', '-r600');
- fprintf(' ? Saved subplot %d as TIFF: %s\n', subplot_counter, subplot_tiff);
- % ±£´æµ¥¸ö×ÓͼΪPNG
- subplot_png = fullfile(classification_subfolder, sprintf('%s_%s.png', subplot_name, timestamp));
- print(single_fig, subplot_png, '-dpng', '-r300');
- close(single_fig);
- end
- end
- fprintf('\n ? %d individual subplots saved in multiple formats\n', subplot_counter);
- end
- % ±£´æÉèÖÃÐÅÏ¢
- settings_file = fullfile(classification_subfolder, sprintf('Figure_Settings_%s.txt', timestamp));
- fid = fopen(settings_file, 'w');
- fprintf(fid, 'Classification Analysis Figure Export Settings\n');
- fprintf(fid, '==============================================\n');
- fprintf(fid, 'Date: %s\n', datestr(now));
- fprintf(fid, 'MATLAB Version: %s\n', version);
- fprintf(fid, 'Output Folder: %s\n', classification_subfolder);
- fprintf(fid, 'Renderer: painters\n');
- fprintf(fid, 'Resolutions: PDF/vector, EPS/vector, TIFF 600 DPI, PNG 600 DPI, JPEG 300 DPI\n');
- fprintf(fid, 'Font: Arial\n');
- fprintf(fid, '\nAnalysis Summary:\n');
- fprintf(fid, 'Classification Results:\n');
- fprintf(fid, ' Mean Accuracy: %.3f ¡À %.3f\n', mean_accuracy, std_accuracy);
- fprintf(fid, ' Mean AUC: %.3f ¡À %.3f\n', mean_auc, std_auc);
- fprintf(fid, ' Permutation p-value: %.4f\n', classification_p_value);
- fprintf(fid, ' Significant: %s\n', string(classification_p_value < 0.05));
- fclose(fid);
- fprintf('\n========================================\n');
- fprintf('All figures saved to: %s\n', classification_subfolder);
- fprintf('Settings file saved: %s\n', settings_file);
- fprintf('========================================\n');
- % ÏÔʾ±£´æµÄÎļþÁбí
- fprintf('\nSaved files in %s:\n', classification_subfolder);
- files = dir(fullfile(classification_subfolder, '*'));
- file_count = 0;
- tiff_count = 0;
- pdf_count = 0;
- eps_count = 0;
- png_count = 0;
- jpg_count = 0;
- for i = 1:length(files)
- if ~files(i).isdir
- file_count = file_count + 1;
- file_size = files(i).bytes;
- if file_size < 1024
- size_str = sprintf('%d B', file_size);
- elseif file_size < 1024^2
- size_str = sprintf('%.2f KB', file_size/1024);
- else
- size_str = sprintf('%.2f MB', file_size/(1024^2));
- end
- fprintf(' - %s (%s)\n', files(i).name, size_str);
- % ͳ¼Æ²»Í¬¸ñʽÎļþÊýÁ¿
- [~, ~, ext] = fileparts(files(i).name);
- switch lower(ext)
- case '.tiff'
- tiff_count = tiff_count + 1;
- case '.pdf'
- pdf_count = pdf_count + 1;
- case '.eps'
- eps_count = eps_count + 1;
- case '.png'
- png_count = png_count + 1;
- case '.jpg'
- jpg_count = jpg_count + 1;
- end
- end
- end
- fprintf('\nFile format summary:\n');
- fprintf(' PDF files: %d (vector)\n', pdf_count);
- fprintf(' EPS files: %d (vector)\n', eps_count);
- fprintf(' TIFF files: %d (600 DPI)\n', tiff_count);
- fprintf(' PNG files: %d (600/300 DPI)\n', png_count);
- fprintf(' JPEG files: %d (300 DPI)\n', jpg_count);
- fprintf(' Total: %d files\n', file_count);
- fprintf('\n');
- % ´ò¿ª±£´æµÄÎļþ¼Ð
- try
- winopen(classification_subfolder);
- fprintf('Opened folder: %s\n', classification_subfolder);
- catch
- fprintf('Files saved to: %s\n', fullfile(pwd, classification_subfolder));
- end
8SVM.m, under CC-BY-4.0 · at the source
Overview
- Department of Neurosurgery, The First Affiliated Hospital of USTC, Division of Life Sciences and Medicine, University of Science and Technology of China, Hefei, Anhui Province 230001, P. R. China
- Anhui Provincial Stereotactic Neurosurgical Institute, Hefei, Anhui Province 230001, P. R. China
- Anhui Province Key Laboratory of Brain Function and Brain Disease, Hefei, Anhui Province 230001, P. R. China
- MRC Brain Networks Dynamics Unit, University of Oxford, Oxford, UK
- Department of Radiology, The First Affiliated Hospital of USTC, Division of Life Sciences and Medicine, University of Science and Technology of China, Hefei, Anhui 230001, China
- Department of Psychology, University of Science and Technology of China, Hefei, Anhui Province 230026, China
Abstract
Microvascular decompression is the standard surgical intervention for classical trigeminal neuralgia attributed to NVC. However, up to 30% of patients experience poor outcomes despite technically successful surgery, suggesting non-peripheral mechanisms. This study investigates whether central neural reorganization—manifeste
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 5 matches between paragraphs and lines of code.
Zenodo 19106465
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
8 files
- 1.dcm2bids.sh, Shell, 24 lines
- 2.fmriprep2.sh, Shell, 43 lines
- 3.xcp.sh, Shell, 25 lines
- 4.cortex_ts.sh, Shell, 79 lines
- 6permutation_r_compare.m
, MATLAB, 433 lines - 7effectsize_HC_top10_lea
ve one out.m , MATLAB, 251 lines - 8SVM.m, MATLAB, 1,157 lines, 5 matches
- age_duration.m, MATLAB, 26 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 8 scripts, each with its path and the digest of its content;
- 5 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
The datasets used and/
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, 6 authors, 5 keywords, 3 funders, 35 references.
Cite
This paper
Wang, Y., Cao, C., Chen, H., Wu, M., He, X., & Jiang, X. (2026). When pain becomes self: limbic-default mode network hyperconnectivity predicts microvascular decompression failure in trigeminal neuralgia. Brain communications, 8(3), fcag220. https://
BibTeX
@article{wang2026when,
author = {Wang, Ying and Cao, Chenglong and Chen, Hao and Wu, Min and He, Xiaosong and Jiang, Xiaofeng},
title = {{When pain becomes self: limbic-default mode network hyperconnectivity predicts microvascular decompression failure in trigeminal neuralgia}},
journal = {Brain communications},
year = {2026},
month = jun,
volume = {8},
number = {3},
pages = {fcag220},
publisher = {Oxford University Press},
issn = {2632-1297},
doi = {10.1093/
url = {https://
pmid = {42327366},
pmcid = {PMC13281923}
}
RIS
TY - JOUR
AU - Wang, Ying
AU - Cao, Chenglong
AU - Chen, Hao
AU - Wu, Min
AU - He, Xiaosong
AU - Jiang, Xiaofeng
TI - When pain becomes self: limbic-default mode network hyperconnectivity predicts microvascular decompression failure in trigeminal neuralgia
T2 - Brain communications
J2 - Brain Commun
PY - 2026
DA - 2026/
VL - 8
IS - 3
SP - fcag220
SN - 2632-1297
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "When pain becomes self: limbic-default mode network hyperconnectivity predicts microvascular decompression failure in trigeminal neuralgia",
"container-title": "Brain communications",
"author": [
{
"family": "Wang",
"given": "Ying"
},
{
"family": "Cao",
"given": "Chenglong"
},
{
"family": "Chen",
"given": "Hao"
},
{
"family": "Wu",
"given": "Min"
},
{
"family": "He",
"given": "Xiaosong"
},
{
"family": "Jiang",
"given": "Xiaofeng"
}
],
"container-title-short":
"volume": "8",
"issue": "3",
"page": "fcag220",
"DOI": "10.1093/
"PMID": "42327366",
"PMCID": "PMC13281923",
"ISSN": "2632-1297",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
11
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/imag.a.1252 [code]
- Does the brain's E:I balance really shape long-range temporal correlations? Lessons learned from 3T MRI.Journal: Imaging neuroscience (Cambridge, Mass.)In common: Dcm2Bids, fMRIPrep, AFNI, 1 other tool, fMRI, structural MRI / diffusion, 1 reference
- [2] doi:10.1017/s0033291724003362 [code]
- Gray and white matter differences in the medial temporal lobe in late-life depression: a multimodal PET-MRI investigation.Journal: Psychological medicineIn common: Dcm2Bids, fMRIPrep, AFNI, 2 other tools, structural MRI / diffusion
- [3] doi:10.1038/s41551-023-01117-y [code]
- Macroscopic resting-state brain dynamics are best described by linear models.Journal: Nature biomedical engineeringIn common: FSL, Statistics and Machine Learning Toolbox, 2 references, author Xiaosong He
- [4] doi:10.1016/j.xcrm.2025.102402 [code]
- A sequential dual-site repetitive transcranial magnetic stimulation for major depressive disorder: A randomized clinical trial.Journal: Cell reports. MedicineIn common: fMRIPrep, AFNI, FSL, 1 other tool, fMRI, 2 references
- [5] doi:10.1016/j.nicl.2026.103987 [code]
- Remote cortical degeneration related to structural connectivity following recent small subcortical infarcts.Journal: NeuroImage. ClinicalIn common: Dcm2Bids, fMRIPrep, AFNI, 1 other tool, structural MRI / diffusion
- [6] doi:10.3389/fnins.2023.1148176 [code]
- Brain system segregation and pain catastrophizing in chronic pain progression.Journal: Frontiers in neuroscienceIn common: AFNI, FSL, Statistics and Machine Learning Toolbox, pain, fMRI, 3 references
- [7] doi:10.1002/hbm.70483 [code]
- Untamed: Unconstrained Tensor Decomposition and Graph Node Embedding for Cortical Parcellation.Journal: Human brain mappingIn common: AFNI, FSL, Statistics and Machine Learning Toolbox, fMRI, 4 references
- [8] doi:10.7554/elife.74463 [code]
- Functional brain reconfiguration during sustained pain.Journal: eLifeIn common: AFNI, FSL, Statistics and Machine Learning Toolbox, pain, 3 references
- [9] doi:10.1016/j.dcn.2025.101664 [code]
- Neurodevelopmental correlates of emotion regulation in adolescence: An accelerated longitudinal study.Journal: Developmental cognitive neuroscienceIn common: fMRIPrep, AFNI, fMRI, 4 references
- [10] doi:10.1038/s41592-025-02599-1 [code]
- DeepPrep: an accelerated, scalable and robust pipeline for neuroimaging preprocessing empowered by deep learning.Journal: Nature methodsIn common: fMRIPrep, AFNI, FSL, 1 other tool, structural MRI / diffusion, 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.
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: 1 repository of the authors' code, each at its verified commit and with its license, 8 scripts, and 5 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:2c00d2e236e5dbd2…
Add the badge to the code's README
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 -->
[](https://openscicode.org/badge/doi/10.1093/braincomms/fcag220)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1093/braincomms/fcag220.svg
:target: https://openscicode.org/badge/doi/10.1093/braincomms/fcag220
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1093/braincomms/fcag220"><img src="https://openscicode.org/badge/doi/10.1093/braincomms/fcag220.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
