-
Notifications
You must be signed in to change notification settings - Fork 15
/
process_data.m
100 lines (68 loc) · 2.77 KB
/
process_data.m
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
clear all
% you should change this to your local data paths
% where you downloaded the 2P data
dataroot = '/media/carsen/DATA2/grive/10krecordings/spontData';
% where ephys data is
ephysroot = '/home/carsen/dm11/data/Spikes/eightprobes/';
% give a local folder for saving intermediate data (around 4-5GB)
matroot = '/media/carsen/DATA2/grive/10krecordings/spontResults';
mkdir(matroot)
% do you have a GPU? if not set to 0
useGPU = 1;
% should be in github folder
addpath(genpath('.'));
% also download rastermap
% https://github.com/MouseLand/rastermap/
addpath('/media/carsen/DATA2/Github/rastermap/matlab/');
dex = 2; % second dataset as example dataset
%% this will perform analyses and save output for figures
%% run PC analysis
pcAnalysis(dataroot,matroot, useGPU, dex);
%% run rastermap and determine distance-dependence of clusters
smooth1Dclusters(dataroot,matroot,useGPU, dex);
%% predict PCs from each other
peerPC_cov(dataroot, matroot, useGPU, dex);
%% run behavioral analyses
predictPCsFromAllBeh(dataroot,matroot,useGPU);
quantifyBehavior(dataroot,matroot, dex);
%% run ephys analyses *** need ephys data downloaded ***
% bin spikes in 30Hz bins and align to faces
alignFaces30Hz(ephysroot, matroot);
%%
% run ephys analyses
masterAnalysis(matroot);
%% time delay analysis (panel 4K)
% we used nseed = 10 in the paper - this will be a bit slow
faceTimelagsToPCs(dataroot,matroot,useGPU);
%% run analysis for stim-spont
sharedVariance(dataroot, matroot, useGPU);
faceStatistics(dataroot, matroot);
stimfaceVariance(dataroot,matroot,useGPU);
%% ----------- supplementary figure analyses --------------
%% varying number of neurons for SVCA and behavior predictions
incNeurFacePred(dataroot, matroot, useGPU);
%% varying time bin
% using single-plane 30Hz recordings
% (you'll have to download new data from figshare)
timebinAnalysis_30hz(dataroot, matroot, useGPU);
%% single neuron analyses (instead of predicting SVCs)
% peer prediction for neurons is pretty slow
% (because there are different peers for each neuron)
% (I've put the mat file in the folder if you want to use it 'PCApred.mat')
peerExcludeNeighbors(dataroot,matroot,useGPU);
% behavioral prediction
predictNeuronsFromAllBeh(dataroot,matroot,useGPU, dex);
% behavioral predictions at different time delays
faceTimelags(dataroot,matroot,useGPU);
% correlation of neurons with behaviors at different depths
arousalDepths(dataroot, matroot)
% returns face prediction of neuron and its position
predictNeuronsFromFacePositions(dataroot,matroot);
%% stim-spont controls
% using drifting grating responses
% (you'll have to download new data from figshare)
sharedVariance_ori32(dataroot, matroot, useGPU);
faceStatistics_ori32(dataroot, matroot);
% ephys stim-spont
% (data not yet available)
stimspontcorr_ephys(matroot);