Motex Overview

Some matlab routines for downloading, processing and converting mouse GCaMP data from Benucci lab to mrTools format.

Motex download

Requires two repositories:

Download both and add both to your Matlab path: addpath(genpath('~/proj/mrTools')) and addpath(genpath('~/proj/motex'))

Download data

Instructions for connecting to server and downloading data are here

Download

You can download files using the motexGetData function to a local directory that you should create on your computer. The default is ~/data/motex/raw

% make the local directory (assuming you have not already)
mkdir ~/data/motex/raw;
% download data for M190802_RN
motexGetData('M190802_RN');

Note that it defaults to looking in particular directories for the data and the log files (see help motexGetData). You can override these by doing:

% specify the paths where data and logs will be read from. Note that either
% of these can be cell arrays if you want the program to search multiple directories
motexGetData('M190802_RN','fromDataPaths=/Volumes/tex/IMAGING','fromLogPaths=/Volumes/DATA/MOUSE/LOGS','toPath=~/data/motex/raw');

Convert data to mrTools

After you have downloaded the raw data locally then you can convert it to mrTools with the function motex2mrtools

% convert all of the runs in M190718_RN which have been dowloaded with motexGetData
motex2mrtools('M190718_RN');

If you only want to process a particular session/run you can specify that as follows:

% convert only a specific session / run
motex2mrtools('M190718_RN','sessionNum=1','runNum=1');

You can also specify the stimulus type:

% convert only a specific session / run
motex2mrtools('M190718_RN','sessionNum=1','runNum=1', 'stimulusType=manual');

See help on motex2mrtools for more details.

This function first analyzes the raw data folders and then the logs. If you just want that information, you can run those independently:

% load raw info (if you don't need to convert to mrtools but want to use these functions)
d = motexGetRawInfo('M190718_RN');
% load logs
d = motexGetLogs(d);

The functions will analyze the analog inputs to determine when the photo-diode picks up a frame trigger. It will put up a figure that looks like the following and ask you to confirm:

The top trace shows you the full trace of the photo diode in black. The red is what the program has determined are the events in that trace. The second row shows you up to the first run - this should look like a long series of blips of the same height before it gets to the beginning. The last trace shows you a full trial. For experiments in which there is a photodiode trigger you should see the red trace go up and down for each one of the frames. The green shows you the camera acquisitions. If all looks ok then answer y to the prompt.

If all goes perfectly, then you should just get a prompt to create the session. It will do so by converting the camera files to nifti using motexCamera2nifti, concatenate all runs from the same experiment and then run the event-related analysis. This may take some time.

If all does not go well then there may be a few more prompts for you to check - it is looking at trying to reconcile photodiode times and what it expects from the stimulus timing.