Revision 887149dbc4bb495e72f3413f6766f52a7cd123e5 authored by TritschLab on 19 May 2021, 15:07:52 UTC, committed by GitHub on 19 May 2021, 15:07:52 UTC
1 parent 6439ab6
movementSpecificityMotor.m
%% Summary:
%
% This script creates a cell array that can be pasted into excel,
% containing each motor FOV's percent of movement-specific cells,
% normalized to the number of active cells and organized by acquisition,
% date and mouse.
%
% Inputs:
%
% User-selected .mat file names
%
% Outputs:
%
% 'mousePeakFreq' - cell array, where each row is an FOV, and the columns
% have the labels Mouse / Date / Acq Num / % Rest Specific dSPNs / % Non-
% Specific dSPNs / % Movement Specific dSPNs / then the same for iSPNs.
%
% Author: Jeffrey March, 2018
%% Main Code
[trials, pathname] = uigetfile('*.mat','MultiSelect','on');
cd(pathname)
totalFiles = 0;
mousePeakFreq = {};
cellNum = [1,1];
prevMouse = '';
prevDate = '';
numCondits = 3;
roi = {};
statsMats = {[],[]};
for trial = 1:length(trials);
load(trials{trial});
totalFiles = totalFiles + 1
roi = {data.dF1, data.dF2};
if isfield(data, 'subVideo')
if ~(strcmp(data.imageFile,prevMouse))
mousePeakFreq{cellNum(1),1} = data.imageFile;
end
if ~(strcmp(data.date,prevDate))
mousePeakFreq{cellNum(1),2} = data.date;
end
mousePeakFreq{cellNum(1),3} = data.acqNum;
for cellType = 1:2;
for cellROI = 1:length(roi{cellType}.roiList)
mousePeakFreq{cellNum(cellType), 4 + (cellType-1)*numCondits} = sum(roi{cellType}.motorFreqRest(:,1) > 0 & roi{cellType}.peakFreqRestMot(:,2) == 0)/sum(roi{cellType}.motorFreqRest(:,1) > 0 | roi{cellType}.peakFreqRestMot(:,2) > 0);
mousePeakFreq{cellNum(cellType), 5 + (cellType-1)*numCondits} = sum(roi{cellType}.motorFreqRest(:,1) > 0 & roi{cellType}.peakFreqRestMot(:,2) > 0)/sum(roi{cellType}.motorFreqRest(:,1) > 0 | roi{cellType}.peakFreqRestMot(:,2) > 0);
mousePeakFreq{cellNum(cellType), 6 + (cellType-1)*numCondits} = sum(roi{cellType}.motorFreqRest(:,1) == 0 & roi{cellType}.peakFreqRestMot(:,2) > 0)/sum(roi{cellType}.motorFreqRest(:,1) > 0 | roi{cellType}.peakFreqRestMot(:,2) > 0);
end
cellNum(cellType) = cellNum(cellType) + 1;
end
for cellType = 1:2
cellNum(cellType) = max(cellNum);
end
prevMouse = data.imageFile;
prevDate = data.date;
end
end
Computing file changes ...