January 23, 2018 at 3:34 pm #21288
Congratulations for this great software.
I have connectome matrices that are based on tractography: adjacency matrices, each cell representing the number of streamlines between two regions of interest (one matrix per subject).
I would like to know if it is possible to import and analyse these matrices in Braph?
Since these are not correlation matrices, I couldn’t find a way to import data as specified in the manual.
PedroFebruary 4, 2018 at 10:50 am #21334
Currently, BRAPH does not allow you to import adjacency matrices. In order to import adjacency matrices in BRAPH directly, without calculating the correlation coefficients, you would need to modify the underlying code in Braph. Below, I write a detailed list what would you need to do in BRAPH in order to import your matrices:
1) You should have the adjacency matrix for each subject saved separately in a Matlab file (.mat) and group the matrices according to your study. Then, without any modification to the Cohort files you would be able to import the adjacency matrices for each group as explained in the manual (http://braph.org/manual/fmri/fmri-cohort/ ; for your case, as you have one matrix per subject you could do the fMRI/EEG analysis).
Please note that your adjacency matrix needs to be consistent with the atlas you uploaded for this to work; for example if you upload brain atlas of 200 regions, you need to have an adjacency matrix of size 200×200.
2) In the EEGGraphAnalysis.m file, locate the function adjmatrix. In this function, after the line case EEGGraphAnalysis.CORR_KENDALL you should see [A,P] = corr(data,’Type’,’Kendall’) (this should be located at line 355 in EEGGraphAnalysis.m). You would need to modify this line to read:
A = data;
P = zeros(size(data));
In other words, the function [A,P] = adjmatrix(ga,data) in the file EEGGraphAnalysis.m should look like this (notice the line commented out after case EEGGraphAnalysis.CORR_KENDALL):
function [A,P] = adjmatrix(ga,data)
% ADJMATRIX calculates the adjaciency matrix
% [A,P] = ADJMATRIX(GA,DATA) calculates the adjaciency matrix A and the
% matrix of p-values for correlations P, given the graph analysis GA
% and its subject data DATA.
% See also EEGGraphAnalysis, corr, partialcorr, corrcoef.
[A,P] = corr(data,’Type’,’Spearman’);
%[A,P] = corr(data,’Type’,’Kendall’);
A = data;
P = zeros(size(data));
[A,P] = partialcorr(data,’Type’,’Pearson’);
[A,P] = partialcorr(data,’Type’,’Spearman’);
otherwise % EEGGraphAnalysis.PEARSON
[A,P] = corrcoef(data);
A(A<0) = 0;
A = abs(A);
otherwise % EEGGraphAnalysis.NEG_NONE
What this accomplishes is to modify the Kendall correlation option in the graphical interface to use the adjacency matrix you provide instead of calculating correlation coefficient. Therefore, please choose this option of the rest of your analysis. If you choose any of the other four options, they would still work as coded originally; they would treat your adjacency matrix as time series and calculate correlation coefficient between different columns.
Finally, let me say that this modification is not specific to EEG analysis or to Kendall option. If you would actually need to use Kendall correlation coefficient you could modify any of the other option as explained above and this method would still work. Moreover, if you would like to use the fMRI analysis part, you can modify the fMRIGraphAnalysis.m file analogously.
I hope this helps you with your analysis. If there is anything else you would need help with, please do not hesitate to contact me.