Skip to content

braph-software/MemoryCapacity

Repository files navigation

BRAPH 2.0

BRAPH 2.0 — Multimodal and AI-powered Brain Connectivity Analysis

BRAPH 2 Website DOI

BRAPH 2.0 Memory Capacity

The BRAPH 2.0 Memory Capacity is a pipeline that uses the reservoir computing framework to calculate both global and regional memory capacity. This pipeline has been used to derive the results in the manuscript: “Computational memory capacity predicts aging and cognitive decline” by Mijalkov et al. (2024).

Code implementation

The codes implementing the global and regional memory capacity are located in the memorycapacity folder. Both measures have been implemented within a single pipeline that is fully integrated in BRAPH 2.0 software (for more information about BRAPH 2.0, please check the website or the GitHub repository.

Usage of the “MemoryCapacity” Pipeline

The braph2memorycapacity folder contains a fully compiled, minimal version of BRAPH 2.0 that calculates the global and regional memory capacity. This version of BRAPH 2.0 contains only one pipeline, which allows the user to upload brain atlas, to upload subjects with connectivity matrices, and to calculate the memory capacity for each subject. This pipeline can be used both from MATLAB command line or through the Graphical User Interfaces.

Example

An example dataset that will allow the user to perform the following steps can be created by running the script create_data_memorycapacity.m. This script will create two groups of subjects and the associated atlas files. Each subject has a weighted random connectivity matrix with a mean nodal degree of 4, which has been derived using the Watts–Strogatz model (group 1 uses a rewiring probability of 0.3 and group 2 has a rewiring probability of 0.85). After running the code, the data will be created in braph2memorycapacity/pipelines/memorycapacity/Example Data memory capacity.

After creating the example data, run example_memorycapacity.m. This is an example script demonstrating how to perform steps 4-8 in the following section.

Usage through MATLAB command line (suggested use)

  1. Open the braph2memorycapacity folder.
  2. Execute the braph2.m script in MATLAB. This script loads BRAPH 2.0 and all related dependencies.
  3. Close the main graphical interface that appears. BRAPH 2.0 software is now fully loaded and ready to use.
  4. Load brain atlas. Braph atlas can be loaded by executing the following code:

im_ba = ImporterBrainAtlasXLS( ... 'FILE', ['atlas.xlsx'], ... 'WAITBAR', true ... ); ba = im_ba.get('BA');

The above code loads the atlas contained in the "atlas.xlsx" file. A custom atlas can be uploaded by changing the file name; please ensure that the atlas is also in the .xlsx format. For more information about how to create brain atlas file, please check the following tutorial, as well as the folder atlases which contains several already prepared atlases ready to use with BRAPH 2.0.

  1. Load group of subjects. Subjects can be loaded using the following:

im_gr1 = ImporterGroupSubjectCON_XLS( ... 'DIRECTORY', ['MC_Group_1_XLS'], ... 'BA', ba, ... 'WAITBAR', true ... ); gr1 = im_gr1.get('GR');

The data for all subjects should be contained in a single folder (in this example, named "MC_Group_1_XLS"). Each subject's connectivity matrix should be contained in a single, separate Excel file. For more information about how to create subject files, please check the following tutorial.

  1. Create an analysis and calculate group average values. This step can be performed using the following code:

analysis_MC = AnalyzeEnsemble_CON_WU( ... 'GR', gr1 ... ); % measure calculation at group level global_memorycapacity = analysis_MC.get('MEASUREENSEMBLE', 'GlobalMemoryCapacity').get('M'); nodal_memorycapacity = analysis_MC.get('MEASUREENSEMBLE', 'NodalMemoryCapacity').get('M'); Here, "gr1" refers to the group of subjects created in the previous step. The code creates a weighted undirected (WU) analysis that will calculate both nodal and global memory capacity measures for each subject. The analysis reports the average values per group (stored in the variables "global_memorycapacity" and "nodal_memorycapacity", respectively.

  1. Get memory capacity values for individual subjects (optional).

num_subject = gr1.get('SUB_DICT').get('LENGTH'); global_memorycapacity_subject = cell(1, num_subject); nodal_memorycapacity_subject = cell(1, num_subject); for i = 1:1:num_subject global_memorycapacity_subject{i} = analysis_MC.get('G_DICT').get('IT', i).get('M_DICT').get('IT', 'GlobalMemoryCapacity').get('M'); nodal_memorycapacity_subject{i} = analysis_MC.get('G_DICT').get('IT', i).get('M_DICT').get('IT', 'NodalMemoryCapacity').get('M'); end The individual values are stored in "global_memorycapacity_subject" and "nodal_memorycapacity_subject" cell arrays, where each cell holds the data for individual subjects.

Usage through BRAPH 2.0 Graphical User Interfaces

The Memory capacity pipeline can also be used via the graphical interfaces integrated within BRAPH 2.0. Currently, the interfaces allow the calculation and plotting of group averaged global and nodal memory capacity (single subject calculations can only be performed through the command line).

  1. Open the braph2memorycapacity folder.
  2. Execute the braph2.m script in MATLAB. This script loads BRAPH 2.0 and all related dependencies.
  3. On the main GUI, select the "Pipeline Memory Capacity Analysis WU" and open this pipeline by pressing the button "Open Pipeline Memory Capacity Analysis WU ...".
  4. This action opens an interface with different sections that will guide the user through the different steps of the analyses (defining and ploting brain atlas, uploading a group, defining an analysis, and calculating the measures).

BRAPH 2.0 tutorials

This pipeline utilizes the full functionalities of the BRAPH 2.0 software (http://braph.org/). More information about the analysis and how to use the interfaces can be found in the main BRAPH 2.0 repository. The full tutorials are available here. Please consider one of the Tutorials for Graph Theory Analysis Pipelines for more information on how to use the Memory Capacity pipeline.

Software compilation

The compiled version of the software is already provided in this repository under "braph2memorycapacity" folder. However, if you would like to compile the software again (for example, after implementing new functionalities in BRAPH 2.0, or adding new pipelines) you will need to run the braph2memorycapacity_genesis.m script. This will re-generate "braph2memorycapacity" folder which can then be used as explained above. WARNING: To ensure a successful compilation, the folder "braph2memorycapacity" should be erased and all of its dependencies should be removed from the MATLAB path. This folder will be regenerated after a successful compilation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published