Ben Lansdell, Ivana Milovanovic 2017
MATLAB code for studying multi-electrode array recording data from monkey as performs manual, brain control and dual control target pursuit task. Data from Moritz lab, experiment setup by Charlie Matlack.
A full working environment requires the following:
glmfit
, which is in the statistics toolbox.- Mark Schmit's L1 toolbox (here)
- MVGC toolbox
- GPFA toolbox
- Transfer entropy toolbox
- MySQL java driver
Depending on your usage, only a subset of these may be required. See usage section below.
- Edit startup.m for your system particulars
- Start MATLAB in this base directory. startup.m should add necessary paths. Otherwise, run startup.m separately.
- To make the plots presented in paper see the scripts in ./scripts
Beyond that, you'll need to set some paths:
-
If MATLAB is started in this directory then
startup.m
will automatically add the above directories to the path. If not, make surestartup.m
is run to setup paths and toolboxes, etc. You'll need to openstartup.m
to check the paths to different toolboxes are set correctly. -
The next simplest use case is to use the GLM code to fit/interpret different models:
const = 'on';
nK_sp = 100;
nK_pos = 100;
%Load test preprocessed data
pre = load('./testdata/test_preprocess_spline_short.mat');
data = filters_sp_pos(pre.processed, nK_sp, nK_pos);
model = MLE_glmfit(data, const);
Beyond that, to further setup your environment to be able to redo all analyses performed in our paper, requires:
- acquiring the data -- details in the paper. Once acquired its path can be added to
startup.m
. By default it looks for Blackrock .nev and .ns3 files in ./blackrock and Labview experiment data files in ./labview. - Setting up a/having access to our SQL database to store results of analyses for the thousands of recordings
Please contact the authors for more information on each of these. See also ./accessing_data.txt for information on the format of matlab, labview and BlackRock files.
preprocess_* functions generate a structure for use by functions in ./models
- Functions for importing data from .nev and .nsx files.
- Functions for importing trial data from Labview (.mat) files.
- Functions for smoothing torque data, and converting spike times to binned spikes
- generate_glm_data.m for simulating a GLM given input data and filters
Functions to take a preprocess structure output from ./preprocess, and generate a structure with data in appropriate format for fitting a GLM/linear model/etc to.
If the GLM has the form:
Functions to perform MLE fit of GLM model
Functions to interpret results of MLE fitting
- Functions to predict spike trains given stimulus and a fit GLM
- Functions to plot filters of GLM
- Granger causality connectivity
- Other plotting functions
- Scripts that generate plots used in paper
Various support functions
- Functions to import blackrock files
- Functions to compute correlations, etc
- Functions to save plots as .eps
- Various other things
The size of the dataset and number of analyses performed necessitated managing fits and results in a SQL database. Here are functions to add fits and other analyses to a SQL database. Details on obtaining the .sql file can be found in the publication.