-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompileCohortData.m
More file actions
47 lines (35 loc) · 1.32 KB
/
compileCohortData.m
File metadata and controls
47 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
%% COMPILE FRA and STIM DATA FROM COHORT
clearvars;close all;clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% EDIT HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cohortName = 'CaMKII';
outputTableSaveDir = 'D:\Data\';
params.parentPath = 'D:\Data\CaMKII_combined';
params.tableDir = '.';
params.treatment = 'pre';
params.pkPTsigSD = 2;
params.nFramesPostPulse = 2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DONE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Compile FRA and stim/response data
[TfraAnml,TfraROI] = compileAnmlFRA(params);
Tinput = compileAnmlROItables(params);
%isolate tone repsonsive cells
TfraROI = TfraROI(TfraROI.dPrime>0,:);
Tinput = innerjoin(Tinput,TfraROI,'Keys',{'animal','roiID'},...
'RightVariables',{'BFuDB'});
%% clean up
clear Tfra*
% animalID and roiID 2 sequence
[G,iA] = findgroups(Tinput.animal);
tmp = splitapply(@(x) {findgroups(x)},Tinput.roiID,G);
tmp = vertcat(tmp{:});
Tinput.animal = G;
Tinput.roiID = tmp;
clearvars -except Tinput params
%% save output table
if ~isfolder(outputTableSaveDir)
mkdir(outputTableSaveDir)
end
save(fullfile(outputTableSaveDir,[cohortName '_dataTable.mat']),'Tinput','-v7.3')
save(fullfile(outputTableSaveDir,[cohortName '_params.mat']),'params')