Published May 20, 2023 | Version 1.0
Journal article Open

Matlab scripts for joint behavioral and neural analysis of Intan recordings

Authors/Creators

  • 1. University of Wyoming

Description

This Matlab script can be used for analyzing how neural activity correlates behavior including lick, facial activity, speed, and up to four external manipulations. All Matlab scripts were written in Matlab 2022b with all official packages and software.

To see what results this code can achieve, please see our research paper bioRxiv 2023.07.11.548619; doi: https://doi.org/10.1101/2023.07.11.548619

To install Matlab, please view https://www.mathworks.com.

To install Jupyter Lab, please view https://jupyter.org/install.

Prerequired codes and software: 'read_Intan_RHD2000_file.m', 'upsample2x.m' available from https://intantech.com/downloads.html?tabSelect=Software
                                TSPE toolbox https://github.com/biomemsLAB/TSPE
                                Bayesian adaptive kernel smoother https://github.com/nurahmadi/BAKS
                                Spike sorter swindale.ecc.ubc.ca/home-page/software
                                Stimulus-associated spike latency test http://kepecslab.cshl.edu/software

All installation can be done in a day.


The behavioral set up for mouse can refer https://github.com/ywang2822/Multi_Lick_ports_behavioral_setup

To jointly analyze behavioral and neural data, we first extract these data separately.

The behavioral metrics include lick signal, images with time evolving (facial activity), speed (locomotor activity), and stimulation onsets.
for individual trial: 'Lick_BehavDat.m' 
for combined trial: 'lick_BehavDat_stack.m'
for analysis of all trials: 'Data_Stac_Ave.m'
helping function: 'list_lick.m' (input trial name in this function)

The neural activity data is specifically spiking data.
SpikeSoter: save as both csv and plx file
To generate and align spike raster data from csv file: 'Lick_SpikDat.m' (used for both individual and combined trial)
To identify opto-tag neural activity channel: 'Cell_ID.m'

Second, we categorize cells based on whether their activiy can represent movement phases, valence, or lick command.
For valence: 'evaluate_valenced_selectivity_byBAKS.m'
             helping codes: 'evaluate_valenced_selectivity_byBAKS_wq.m','evaluate_valenced_selectivity_byBAKS_wsq.m'
For movement phases: 'evaluate_cue_selectivity_byBAKS.m' Please note 'DO' denotes initial-before lick onset, 'LO' denotes initial-after lick onset, 'quinine' denotes terminal.
The generated data should be saved in such order 'Neuron_index'>'valence'>'wsq'(session)>'IC'(brain region)
To calculate the number of these categorized neural representations: 'evaluate_number_selected_cell.m'

Third, we calculate how these different categorized neural representations connect with each other during behavior.
evaluate connectivity among and in each category: 'evaluate_properties_of_selected_cell.m'
(this code can also evaluate trendline slope and trajectories angles of water lick trials)
evaluate connectivity between optotag and optoexcited neurons: 'evaluate_connectivity_optoexi.m'

Fourth, we evaluate if the neural activity of certain group of cells (e.g.projection defined or genetically defined) can predict behavior.
For large-scale window (movement phases) and small-scale window (valence): 'decode_liquid_type_singlemouse.m'
For decoding all lick trials (valence only): 'decode_all_lick_trials.m'
For decoding facial activity: 'behavioral_modeling.m'

Fifth, we display the mean neural activity in certain brain regions
To evaluate mean firing rate: 'mean_neural_dynamics.m'
To evaluate whether there is a linear correlation between mean firing rate and behavioral data: 'mean_neural_dynamics_singletrial.m'

Finally, we simulate the behavioral output by using spiking neural network.
To generate spike data: 'Network_modeling.ipynb'
To generate behavioral data: 'network_moedeling.m'

One data files folder is provided in 'Example of original data file folder'.

For any question, please contact robertwangyihan@outlook.com

Files

LICENSE.md

Files (264.6 MB)

Name Size Download all
md5:64a6b85760c67589bbfe00bdf1434594
13.0 kB Download
md5:0905b061b9a6e958e50ba6970f7448e5
7.8 kB Download
md5:4096960c490ed59d4b081759bbcfb5b2
26.8 kB Download
md5:5147b67a1311997c4e38bdfdb09a1e45
763 Bytes Download
md5:ad1aa014f3dc11e5c07cf37c2be15eae
28.2 kB Download
md5:b652f93ab338bd3901a9595f978a2791
9.6 kB Download
md5:ce82e70392fc1fc7a99c3c244669cbe6
7.3 kB Download
md5:3120ecd2db01bc720f6147b4348db185
16.7 kB Download
md5:6b5b9427461684fa7b56fc87598cc0bc
64.4 kB Download
md5:b40a79267165c7f5c93c6b4dfcdabc00
4.0 kB Download
md5:c3cee34524898d4b6ad4e26527b2730f
30.4 kB Download
md5:1603091d530a1b2ef8514283e39b6598
23.3 kB Download
md5:4ffaa5a793dfce01426a480bd31c696d
264.3 MB Download
md5:a47668a28784d2f62258b0adf0e762b0
11.7 kB Preview Download
md5:f081a1228ab42f872e24df3524d881dd
8.8 kB Download
md5:72ee4e3c24c1f4d5f0b77edd203f6a60
3.1 kB Download
md5:9e22adde2442f882c6643ea0a4697865
1.8 kB Download
md5:68af65505b2efc9fc1c6563c77ba2d93
3.6 kB Download
md5:97e8dca9c98a0980d08fb697d4bf5400
8.3 kB Download
md5:0b8331e3918ded55b5a46758148e97f3
9.1 kB Download
md5:f9b9bff5d5ca81c87670f7621fcc92a0
10.3 kB Preview Download
md5:fd4b1f93f92c99b679e1930ddae40b5d
7.6 kB Download