forked from petersenpeter/CellExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Fernandez-Ruiz 2017 PV vs SST metrics 2. Adjust processing code so doesn't require waveforms to be run 3. Calculate CCG and transmission probability in 20s bins 4. Runners for my project & Kei's paper
- Loading branch information
1 parent
271d74a
commit 8da690e
Showing
6 changed files
with
166 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function cell_metrics = FR2017(cell_metrics,session,spikes,parameters) | ||
% This is an example template for creating your own calculations | ||
% | ||
% INPUTS | ||
% cell_metrics - cell_metrics struct | ||
% session - session struct with session-level metadata | ||
% spikes_intervalsExcluded - spikes struct filtered by (manipulation) intervals | ||
% spikes - spikes cell struct | ||
% spikes{1} : all spikes | ||
% spikes{2} : spikes excluding manipulation intervals | ||
% parameters - input parameters to ProcessCellExplorer | ||
% | ||
% OUTPUT | ||
% cell_metrics - updated cell_metrics struct | ||
|
||
sr = session.extracellular.sr; | ||
spikes = spikes{1}; | ||
if any(spikes.total==0) | ||
cell_indexes = find(spikes.total>0); | ||
else | ||
cell_indexes = 1:spikes.numcells; | ||
end | ||
|
||
% acg_mean = nan(1,spikes.numcells); | ||
burst_index = nan(1,spikes.numcells); | ||
refrac = nan(1,spikes.numcells); | ||
for i = cell_indexes | ||
acg = CCG(spikes.times{i},ones(size(spikes.times{i})),'binSize',0.001,'duration',.1,'norm','rate','Fs',1/sr); | ||
acg = acg(51:end); % subset to after spike | ||
% acg_mean(i) = mean(acg); | ||
if max(acg(1:10))==0 | ||
burst_index(i) = 0; | ||
else | ||
burst_index(i) = (max(acg(1:10)) - mean(acg(end-10:end)))/max(acg(1:10)); | ||
end | ||
|
||
[~, max_ind] = max(acg); | ||
for m = 2:max_ind | ||
slope(m) = (acg(m) - acg(1))/(m - 1); | ||
end | ||
slope_sd = std(slope); | ||
exceed_1SD = find(slope > slope_sd); | ||
refrac(i) = exceed_1SD(1) - 1; | ||
end | ||
|
||
% cell_metrics.acg_mean_FR = acg_mean; | ||
cell_metrics.burst_index_FR = burst_index; | ||
cell_metrics.refrac_period_FR = refrac; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
%% set session | ||
animal = 'BaggySweatpants'; | ||
session_name = '20220214_BaggySweatpants_DY01'; | ||
basepath = ['Z:\WT_Sequences\2022_winter\Preprocessed_Data\Spikes\g1\',animal,'\Ecephys\',... | ||
session_name,'\catgt_',session_name,'_g1\',session_name,'_g1_imec0']; | ||
cd(basepath) | ||
|
||
%% calculate | ||
tic | ||
% % set params | ||
session = sessionTemplate(basepath); | ||
session.extracellular.fileName = [session_name,'_g1_tcat.imec0.ap.bin']; | ||
session.extracellular.srLfp = 2500; | ||
% session = gui_session(session); | ||
% validateSessionStruct(session); | ||
|
||
% generate metrics file | ||
cell_metrics = ProcessCellMetrics('session', session,... | ||
'metrics',{'monoSynaptic_connections'},... | ||
'includeInhibitoryConnections',true,... | ||
'manualAdjustMonoSyn',false,... | ||
'getWaveformsFromDat',false,... | ||
'showWaveforms',false,... | ||
'sessionSummaryFigure',false,... | ||
'showGUI',false); | ||
toc | ||
|
||
% %% view | ||
% cell_metrics = CellExplorer('metrics',cell_metrics); | ||
% | ||
% %% view from file | ||
% animal = 'BaggySweatpants'; | ||
% session_name = '20220214_BaggySweatpants_DY01'; | ||
% basepath = ['Z:\WT_Sequences\2022_winter\Preprocessed_Data\Spikes\g1\',animal,'\Ecephys\',... | ||
% session_name,'\catgt_',session_name,'_g1\',session_name,'_g1_imec0']; | ||
% cd(basepath) | ||
% session = loadSession; | ||
% cell_metrics = loadCellMetrics; | ||
% cell_metrics = CellExplorer('metrics',cell_metrics); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
addpath(genpath("C:\Users\Niflheim\Documents\GitHub\External\CellExplorer")) | ||
% set session | ||
basepath = "\\oak-smb-giocomo.stanford.edu\groups\giocomo\export\data\Projects\JohnKei_NPH3"; | ||
load('\\oak-smb-giocomo.stanford.edu\groups\giocomo\fkmasuda\fkm_analysis\EAJ_revisions\wt_ket_sessions.mat') | ||
for s = 1:length(wt_ket_sessions) | ||
datadir = sprintf('%s\\%s\\%s_keicontrasttrack_ketamine1_g0\\%s_keicontrasttrack_ketamine1_g0_imec0',... | ||
basepath,wt_ket_sessions{s,1},wt_ket_sessions{s,2},wt_ket_sessions{s,2}); | ||
cd(datadir) | ||
|
||
% set params | ||
session = sessionTemplate(datadir); | ||
session.extracellular.fileName = [wt_ket_sessions{s,2},'_keicontrasttrack_ketamine1_g0_t0.imec0.ap.bin']; | ||
|
||
% generate metrics file | ||
cell_metrics = ProcessCellMetrics('session', session,... | ||
'metrics',{'monoSynaptic_connections'},... | ||
'includeInhibitoryConnections',true,... | ||
'manualAdjustMonoSyn',false,... | ||
'getWaveformsFromDat',false,... | ||
'showWaveforms',false,... | ||
'sessionSummaryFigure',false,... | ||
'showGUI',false); | ||
end |