DOI: 10.5281/zenodo.14963086
title: Ghandour2025_NatureCommunications

description: Aim:

Using custom-made Matlab codes to generate the following:

First_code: Extract, filter, & plot the calcium transients over time Second_code: calculate the cooccurrence of neurons from different categories.

Prerequisites: Software: "MatlabR2018a" available http//www.mathworks.com Instalation guide: https://jp.mathworks.com/videos/how-to-install-matlab-1525083586145.html Installation time: approx. 30 min Operating system: Windows 10 pro Non-standard hardware: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2018a_Windows.pdf Data files: 1. Calcium raw data over time ("finalv_MouseID.CSV" file produced by "Hotaru" Automatic cell detection) 2. "Frames for session.xlsx" file containing the timing of each session.

Steps:

Load 'v109entobe.mat'manually.

First_code: "extract_ca_transients_plot.m" a. Open the software and set the directory to the folder containing all the codes and files. b. Open the finalv_mouseID.CSV file to view the fluorescence data table then import and save as a numeric matrix file (finalv_mouseID.mat) in the same folder. c. Write the name of the imported data file before loading the matlab numeric matrix file (finalv_mouseID.mat) by double clicking. d. Open the Matlab code file "first_code_extract_ca_transients_plot.m" and Input the range (sec) of all sessions' time (from the start of the first session till the end of the last session) provided in the "Frames for session.xlsx" files. e. From the above tool bar press "Editor" then "Run" to remove low frequency flactuations and noise by using a 0.01 Hz high-pass filtering and calculating the z-scores to sxclude those below 3 SD. "Running time" is approximately less than 30 sec. f. expected run time (couple of seconds)

Second_code:"cooccurence": a. After runing all the steps in the first code, open the third code that is used to calculate the synchronized neuronal activity. b. Input the classified neurons (results of the second_code) into Cell_type_A, Cell_type_B, or Cell_type_C, respectively. c. Specify the value for the bin_Frame_Num as "4" to calculate the co-active neurons for each 250 ms time bin. d. From the above tool bar press "Editor" then "Run"."Running time" is approximately less than 30 sec. e. Co-activity data will be displayed in the command window in the folowing order: (Engram-to-be, Common engram cell, Specific engram, Engram-to-be + Common engram, Engram-to-be+ Specific engram, Engram-to-be+Common engram+Specific engram) in addition to the generated plots. f. expected run time (couple of seconds)



3. Download the "Khaled_et_al_PCAICA" folders.


Aim:

Using custom-made Matlab codes to generate the following:

Extract, filter, & plot the PCAICA-detected patterns in a certain session and backproject them over the whole session to determine their activity in other sessions.

Steps:

Load 'calcium_135.mat'manually.

a. Open the software and set the directory to the folder containing all the codes and files. b. run the code and press y (as a yes for the question that arises) c. all figures and data plots will appear automatically. d. expected run time (couple of seconds)



Ca2+ data for running the above codes are uploaded at the following link. Please download the files from the link below.

 

4. for the NMF

This is a self-implementation of non-negative matrix factorization (NMF). This is specialized to perform pattern separation for the calcium signal detected by the HOTARU online sorting system (Takekawa, T. et al, 2017).

Please ues the python version in the folder named "python"

Usage can be found using the following command:

python3 nmf_sklearn_and_self_gpu.py -h

One may use the files in the "demo" folder for practice. By runing the following command, we can obtain the separated patterns and the corresponding occurrence.

python3 ./nmf_sklearn_and_self_gpu.py -S -smart_search -i finalv135_01_W1.txt -Ns 1 -Ne 300 -Na 100 -oe finalv135_01_W1_energy.txt -ob finalv135_01_W1_basis.txt -oc finalv135_01_W1_coeff.txt

Here the columns in finalv135_01_W1_basis.txt represent the neuronal activation patterns, the columns in finalv135_01_W1_coeff.txt represents the corresponding occurrence, and the rows in finalv135_01_W1_energy.txt contain the information of cost function and AIC for each NMF order.

 

5. Engram-to-be simulation

Codes for simulations and analyses in Ghandour, Haga, Ohkawa et al., "Dual roles of idling moments for past and future memories".

Codes depend on Python 3, numpy, scipy, matplotlib, and a UNIX shell script (bash). With Anaconda (or Miniconda), you can run conda env create -f env_engramtobe.yml then conda activate engramtobe to create an appropreate environment.

For running the codes, execute bash batch.sh on a UNIX shell (we ran codes in Ubuntu 20.04 and 22.04). Otherwise, manually execute commands written in the batch.sh.

Codes execute 5 simulations for each of four conditions (with and without sleep, homeostatic plasticity OFF, LTD-OFF). Each simulation generates a .npz file that contains results. After 5 simulations, results are summarized to output .csv and .tiff files that show cell-type ratios, coincidence and correlation of neural activities, and matching ratios as presented in the paper.

It took approximately 10 minutes to finish all calculations by a workstation with Xeon-W7-3445.