Virtual Rat project is a computaional neuroscience project conducted by Xiangci Li as a research assistant at Erlich lab under the guidance of New York University Shanghai Professor Jeffrey Erlich. We showed that the task switch cost of rat's ProAnti orienting task can be modeled by an Elman Recurrent Neural Network. The experimental data are from Dr. Carlos Brody's lab at Princeton.
There is a video available for this project!
For any question, please contact
Xiangci Li (xiangci.li@nyu.edu)
Jeffrey Erlich (jerlich@nyu.edu)
From the perspective of implementation, Virtual Rat project consists of two parts: Virtual Rat (RNN model) and data analysis of rats' behavioral and electrophysiology data.
- Visit https://github.com/dmlc/minpy to setup Minpy and MXNet.
- Other requirements: Python 2.7, Numpy, Matplotlib, Scikit-learn, Scipy
MATLAB 2017a or later.
The codes for the final version of this project are all under publication
folder.
figures
folder saves figures produced. mats
folder saves .mat
files and pkls
folder saves .pkl
files.
- Run
sbatch trainingTime.sh
on HPC to evokeTrainingTime.py
. All weights after certain training epochs will be saved. - Run
sbatch testTrainingTime.sh
on HPC to evokeTestTrainingTime.py
. Similarly runsbatch testTrainingTimeFine.sh
to evokeTestTrainingTimeFine.py
. The weights saved will be loaded to test the performance of the models and the results will be saved in the folderTrainingTime
. - Run jupyter notebook
TrainingTime.ipynb
. This notebook finds out best epochs to plot later figures. - Run jupyter notebook
VirtualRat.ipynb
andDiluteActivation.ipynb
to obtain figures. - Run jupyter notebook
PETH.ipynb
to choose sample PETH.
- Run
sbatch trainBlock.sh
on HPC to evokeBlockTime.py
. All weights after certain training epochs will be saved. - Run
sbatch testBlockTime.sh
on HPC to evokeTestBlockTime.py
. The weights saved will be loaded to test the performance of the models and the results will be saved in the folderBlockTime
. - Run jupyter notebook
Block.ipynb
.
- Run
sbatch RatioTime.sh
on HPC to evokeTrainRatioTime.py
. All weights after certain training epochs will be saved. - Run
sbatch testTrainingTimeRatio.sh
on HPC to evokeTestTrainingTimeRatio.py
. The weights saved will be loaded to test the performance of the models and the results will be saved in the folderRatioTime
. - Run jupyter notebook
TrainingTimeRatio.ipynb
to check the performace over time. - Run jupyter notebook
Ratio.ipynb
.
- Run
convertBehavior.m
to extract necessary information from the original huge data file for running Python scripts. - Run
countSpikes.m
to produce spike counts. - Run
realRatEphysTrainClfs.py
andrealRatEphysTrainClfsTarget.py
- Run
ratSGDrule.m
,ratSGDTarget.m
,RNN_SGD_rule.m
andRNN_SGD_target.m
. - Run jupyter notebook
realRatEphys.ipynb
. - Run jupyter notebook
realRatEphysTarget.ipynb
. - Run jupyter notebook
RNNEphys.ipynb
. - Run jupyter notebook
realRatBehavior.ipynb
.
-
Collect pro anti and other data from original spike data
- Saved in
SessionInfo.mat
, a cell type structure. - Each cell has double of (N_of_trials, 4)
- Each trial has (pro, target_right, switch, hit)
- Saved in
-
Collect brain area data
-
Saved in
BrainArea.mat
, a cell type structure. -
Each cell has double of (1, N_of_cells)
-
Index: brain area 0: left mPFC 1: right mPFC 2: left SC 3: right SC 4: left FOF 5: right FOF
-
-
Collect rat index
- Saved in
RatIndexPerSession.mat
, (N_session, 1) double.
- Saved in
-
Collect cellid per session
- Saved in
CellIndexPerSession.mat
, a cell type structure. - Each cell has double of (1, N_of_cells), containing cell indices (not the raw cell ID, but still sufficient)
- Saved in
-
Collect Duan's session index and Erlich's session indices.
- Count spikes from Duan's ephys data and Erlich's ephys data using different time periods and time steps.
- Duan's spike count includes delay step, which matches the RNN model.
- Erlich's does not include delay step.
- Saved in
SpikeCountsPerSessionDuan.mat
andSpikeCountsPerSessionErlich.mat
, cell type structure. - Each cell is a double with shape (5 steps, num_cells recorded in this session, num_trials)
- Separately calculate for Erlich's and Duan's data.
- Save as
Duan_single_AUC_p.mat
, an array with (N_cells,10) - Each column corresponds to 'ITI_auc','ITI_p','rule_auc','rule_p','delay_auc','delay_p','target_auc','target_p','choice_auc','choice_p'
- This script trains (overfit) logistic regression classifier to predict each trials' rule encoding score and save them in to an array which will be converted to MATLAB table for fitting GLME.
- Saves results computed in
experimentor_SGD_table_brainArea.mat
- 21 categories: session_index, pro, right, switch, hit, rat_index, score0, score1, score2, score3, score4,accuracy0, accuracy1, accuracy2, accuracy3, accuracy4, encoding0, encoding1, encoding2, encoding3, encoding4