Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.
The 40 matches · 17 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ dendritic_somatic_transfer.py, lines 93–215 · score 0.96 · dendritic somatic transfer, NMDA voltage dependence, somatic voltage, v_soma, dendritic integration, GABA conductances
- [2] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ optogenetic_experiment.py, lines 106–156 · score 0.96 · transduction failure rate, fiber tip, Light induced activation, log normal distribution, activation probability, light intensity
- [3] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ DG_circuit_dendritic_somatic_transfer.py, lines 417–467 · score 0.93 · hilar region, Connection probabilities, dendritic inhibition, molecular layer, local connections, granule cell
- [4] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ dendritic_somatic_network_clamp.py, lines 241–359 · score 0.92 · dendritic somatic transfer, NMDA voltage dependence, dendritic voltage, NMDA fraction, GABA conductances, membrane
- [5] § STAR METHODS › METHOD DETAILS › Putative monosynaptic connections ↔ buzcodeAddOns/MonoSyn/burstCCG.m, the whole file · a weak match · score 0.89 · inter spike intervals, Spike transmission probability, presynaptic spike, spike trains, 4 ms, 0.8 ms
- [6] § STAR METHODS › METHOD DETAILS › Putative monosynaptic connections ↔ buzcodeAddOns/MonoSyn/analyzeMonoSyn.m, the whole file · a weak match · score 0.85 · inter spike intervals, Spike transmission probability, putatively connected, 4 ms, 0.8 ms, subtracted
- [7] § STAR METHODS › METHOD DETAILS › Cell classification ↔ buzcodeAddOns/CellClassification/trainSVMpvssst.m, the whole file · a weak match · score 0.84 · Classification Learner App, cross validation, fold, AB, kernel, CV2
- [8] § STAR METHODS › METHOD DETAILS › Cell classification ↔ buzcodeAddOns/CellClassification/trainSVMpvsst.m, the whole file · a weak match · score 0.84 · Classification Learner App, cross validation, fold, AB, kernel, CV2
- [9] § STAR METHODS › METHOD DETAILS › Cell classification ↔ buzcodeAddOns/CellClassification/YutaClassifier.m, the whole file · a weak match · score 0.83 · principal components, maximum waveform, firing rate ratios, granule cell, labelling, derivative
- [10] § STAR METHODS › METHOD DETAILS › Spatial tuning ↔ buzcodeAddOns/PlaceFields/get_placeFieldsLinear.m, lines 155–216 · score 0.81 · Spatial coherence, Spatial tuning, place field, firing rate peak, SI, Bits
- [11] § STAR METHODS › METHOD DETAILS › Behavior ↔ buzcodeAddOns/makeRadialMazeMaps.m, the whole file · a weak match · score 0.80 · radial arm maze, rewarded arms, firing rate maps, minute, cm, Behavior
- [12] § STAR METHODS › METHOD DETAILS › Spatial tuning ↔ buzcodeAddOns/PlaceFields/get_placeFieldsOF.m, lines 167–232 · score 0.79 · Spatial coherence, Spatial tuning, place field, firing rate peak, Bits, median
- [13] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ statistical_testing.py, lines 558–632 · score 0.77 · activation probability, optogenetic drive, light intensity, optogenetic stimulation, target population, Opsin expression
- [14] § STAR METHODS › METHOD DETAILS › LFP analysis ↔ buzcodeAddOns/LFP_analysis/DGlayerProfile.m, lines 1–74 · score 0.76 · 5–15 Hz, theta gamma, 125 ms, comodulogram, profiles, CSD
- [15] § STAR METHODS › METHOD DETAILS › Generalized linear model (peer prediction) ↔ buzcodeAddOns/PeerPrediction/peerPredictOpto1sec.m, lines 64–190 · score 0.76 · generalized linear model, peer, fitglm, predicted, R2, interactions
- [16] § STAR METHODS › METHOD DETAILS › Generalized linear model (peer prediction) ↔ buzcodeAddOns/PeerPrediction/CrossValidationAssemblyPrediction.m, the whole file · a weak match · score 0.75 · generalized linear model, Binned spike trains, peer, root, predicted, validation
- [17] § STAR METHODS › METHOD DETAILS › Behavior ↔ buzcodeAddOns/Behavior/OptitrackBehav.m, the whole file · a weak match · score 0.74 · rewarded arms, radial arm, radial maze, barrier, solenoid, cm
- [18] § STAR METHODS › METHOD DETAILS › DG circuit model ↔ DG_protocol.py, lines 2523–2649 · score 0.72 · standard deviation, paradoxical excitation, synaptic weight, optogenetic stimulation, opsin expressing, unchanged
- [19] § Results › Supervised classification of DG cells into four types based on physiological criteria ↔ DG_IN_Figures_final.m, lines 458–511 · score 0.69 · spike asymmetry, ACG rise, spike width, S1d, CV2, wake
- [20] § STAR METHODS › METHOD DETAILS › LFP analysis ↔ DG_IN_Ephys/DG_IN_LFP_Scripts.m, lines 165–249 · score 0.68 · theta gamma comodulogram, CSD, component, profiles, troughs, bands
- [21] § Results › Spatial tuning properties of DG cells ↔ buzcodeAddOns/PlaceFields/get_placeFieldsLinear.m, lines 155–216 · score 0.68 · spatial coherence, spatial tuning, place fields, SI, track, linear
- [22] § STAR METHODS › METHOD DETAILS › Cell classification ↔ DG_IN_Figures_final.m, lines 545–595 · score 0.66 · anatomical location, ground truth, granule cell, waking, SVM, waveforms
- [23] § Results › Identification of dentate interneurons with extracellular electrophysiology and optotagging ↔ DG_IN_Figures_final.m, lines 3203–3290 · score 0.64 · ChR2, eNpHR, PV Cre, SST Cre, mice, classes
- [24] § Results › Mechanisms of paradoxical activation upon DG interneuron stimulation ↔ buzcodeAddOns/PeerPrediction/peerPredictOpto1sec.m, lines 64–190 · score 0.64 · peer prediction, generalized linear models, GLMs, onset, trained, validation
- [25] § Results › Spatial tuning properties of DG cells ↔ buzcodeAddOns/PlaceFields/get_placeFieldsOF.m, lines 167–232 · score 0.63 · spatial coherence, spatial tuning, place fields, properties, behavioral, cells
- [26] § Results › Mechanisms of paradoxical activation upon DG interneuron stimulation ↔ DG_IN_Figures_final.m, lines 63–121 · score 0.61 · PV Cre mice, SST Cre mice, eNpHR, S6e, SVM, trained
- [27] § STAR METHODS › METHOD DETAILS › LFP analysis ↔ buzcodeAddOns/EventDetection/DetectDSpikes_v4.m, lines 1–99 · score 0.60 · 2–50 Hz, molecular layer, hilus, DS2, filtered, threshold
- [28] § STAR METHODS › METHOD DETAILS › LFP analysis ↔ buzcodeAddOns/EventDetection/DetectDSpikes_v5.m, lines 1–102 · score 0.60 · 2–50 Hz, molecular layer, hilus, DS2, filtered, threshold
- [29] § STAR METHODS › METHOD DETAILS › Opto-tagging and optogenetic manipulations ↔ buzcodeAddOns/Utilities/findAmbiguous.m, the whole file · a weak match · score 0.59 · ambiguous response, modulation ratio, stim, firing rate, Opto, classified
- [30] § STAR METHODS › METHOD DETAILS › Surgical Procedures ↔ DG_circuit_optogenetic_optimization.py, lines 2719–2853 · score 0.59 · theta oscillation, theta phase, Diagnostic, depth, parallel, amplitude
- [31] § STAR METHODS › METHOD DETAILS › Putative monosynaptic connections ↔ buzcodeAddOns/analysis/monosynapticPairs/bz_GetMonoSynapticallyConnected.m, the whole file · a weak match · score 0.59 · monosynaptic connections, Poisson, CCG, detection, ms, predictor
- [32] § Results › Synaptic connectivity in the DG network ↔ buzcodeAddOns/MonoSyn/analyzeMonoLTP.m, the whole file · a weak match · score 0.58 · synaptic strength, transmission probability, spike transmission, brain, putative, excitatory
- [33] § Results › Mechanisms of paradoxical activation upon DG interneuron stimulation ↔ buzcodeAddOns/PeerPrediction/CrossValidationAssemblyPrediction.m, the whole file · a weak match · score 0.57 · peer prediction, generalized linear models, validation, trained, spike, cells
- [34] § STAR METHODS › METHOD DETAILS › Opto-tagging and optogenetic manipulations ↔ buzcodeAddOns/Optogenetics/reclassifyOptoResponses2.m, the whole file · a weak match · score 0.56 · half rise, standard deviation, ambiguous, Opto, firing rate, classified
- [35] § STAR METHODS › METHOD DETAILS › Opto-tagging and optogenetic manipulations ↔ buzcodeAddOns/Utilities/findAmbiguous.m, the whole file · a weak match · score 0.54 · eNpHR, standard deviation, ambiguous, firing rate, Opto, opsin
- [36] § Results › Synaptic connectivity in the DG network ↔ buzcodeAddOns/analysis/monosynapticPairs/bz_GetMonoSynapticallyConnected.m, the whole file · a weak match · score 0.54 · monosynaptic connections, synaptic connectivity, likelihoods, CCG, synapses, network
- [37] § Results › Supervised classification of DG cells into four types based on physiological criteria ↔ buzcodeAddOns/CellClassification/trainSVMpvssst.m, the whole file · a weak match · score 0.53 · cross validation, accuracy, fold, CV2, trained, rise
- [38] § STAR METHODS › METHOD DETAILS › Putative monosynaptic connections ↔ buzcodeAddOns/analysis/monosynapticPairs/bz_fitPoissPlasticity.m, lines 1–30 · score 0.53 · monosynaptic connections, Poisson, timescale, postsynaptic, cross, binning
- [39] § STAR METHODS › METHOD DETAILS › Sleep scoring ↔ buzcodeAddOns/detectors/detectStates/SleepScoreMaster/ClusterStates_DetermineStates.m, the whole file · a weak match · score 0.53 · quiet wake, scoring, Sleep, NREM, theta
- [40] § STAR METHODS › METHOD DETAILS › Firing rate distribution equality ↔ DG_IN_Figures_final.m, lines 2790–2840 · score 0.53 · Lorenz curve, S8a, CV, Gini, 1–2, DG
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 3,691 lines · 144 KB · no license · 5 matches
- %% README
- % Download and install 'https://github.com/buzsakilab/buzcode'. Then
- % download this repository. Add all folders and subfolders to your matlab
- % path.
- %
- % Download data from 'https://buzsakilab.nyumc.org/datasets/' to a folder
- % on your computer and replace basedir (example 'Z:\Buzsakilabspace\LabShare\HainmuellerT\')
- % below with the the folder name. Run all scripts under 'preparations'
- % before trying to create any of the figures.
- %
- % [ ] CHANGE 'basedir' TO THE FOLDER WHERE YOU DOWNLOADED THE DATA
- basedir = 'Z:\buzsakilab\Buzsakilabspace\LabShare\HainmuellerT';
- %% Prepare handle and batch_metrics
- % Animal selection
- basedir = 'Z:\buzsakilab\Buzsakilabspace\LabShare\HainmuellerT\';
- ChRmice = {'SST2','SST4','YutaMouse20','YutaMouse21','YutaMouse37','YutaMouse38',...
- 'YutaMouse39','YutaMouse40','PV1','PV3','PV5','PV16','PV18','PV19','PV21','PV29'}; % PV16 1:1, PV18, PV23, SST6 1:3, SST7, others pure, PV28 thalamic injection
- HRmice = {'PV13','PV22','SST3','SST5'}; % 'PV20',
- linear = {'PV19','PV21','YutaMouse21','YutaMouse29'}; % Linear probe mice
- WTmice = {'TH10','TH11','TH12','TH13','TH14','TH15'}; % TH17 once downloaded
- animals = cat(2,ChRmice,HRmice,WTmice);
- % Querry for numbers of units meeting different criteria
- querryCells(1).tag = 'nDG';
- querryCells(1).include = struct('brainRegion','DG');
- querryFiles = {'DS','.DS2.events.mat'};
- handle = makeDShandle('basedir',basedir,'animals',animals,...
- 'querryCells',querryCells,'querryFiles',querryFiles);
- handle = handle([handle(:).hasDS] & [handle(:).hasMetrics]);
- % Load batch
- batch_metrics = LoadCellMetricBatch('basepaths',{handle(:).basepath});
- % Run Waveform and ACG quality metrics
- batch_metrics = get_waveformACGquality('metrics',batch_metrics,'save_results',false);
- % TODO: Rerun opto-tagging assignments
- % batch_metrics = reclassifyOptoResponses(batch_metrics,'maxHalfRise',.005);
- % Rerun Yuta Classifier on final cell selection
- batch_metrics = YutaClassWrapper(batch_metrics); % rng initialized, should be deterministic
- % Add monosyn curation status to batch_metrics
- batch_metrics.monoSynManual = ismember(batch_metrics.batchIDs,...
- find([handle(:).monoSynManual]))*1; % *1 to make double
- % Refine peaks for DS2 (% TODO: incorporate this somewhere else)
- batch_metrics = refinePeaks(batch_metrics);
- % % TODO: New version of excluding ambiguous & 0.1 Hz criterion for HR (Rev1)
- batch_metrics = reclassifyOptoResponses2(batch_metrics); % Added 12/16/2025
- % batch_metrics = addAmbiguousResponse(batch_metrics); % Added 11/14/2025
- batch_metrics = add_evtPeakActivation(batch_metrics,'opto_10ms','InEvent',[0.0005 .01]);
- batch_metrics = add_evtPeakActivation(batch_metrics,'opto_1sec','InEvent',[.05 .95]);
- % Sort fields in alphabetical order
- batch_metrics = orderfields(batch_metrics);
- clear basedir ChRmice HRmice WTmice linear animals querryCells querryFiles
- %% Make 'standard' SVM based on all PV-Cre and SST-Cre mice
- % Make table for classifier learning
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4));
- include = struct('putativeCellType',{'','','Granule Cell','Mossy Cell'},...
- 'groundTruthClassification',{'PV+','SST+','',''},...
- 'brainRegion','DG','geneticLine','Cre',...); % ...
- 'labels','eNpHR'); %-- Toggle this line for HR classifier control Fig S6e
- % Shorthand, will pick up PV-Cre and SST-Cre -- matlab automatically repeats singular entries
- % Get features
- fields = {'cv2','acg_tau_rise','troughToPeak','ab_ratio','firingRate','ds2amplitude','wakeNREMratio'};
- for ff = 1:length(fields)
- Tbl{ff} = get_metricfield(batch_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'tukeyFence',Inf);
- end
- Tbl = cat(2,Tbl{:});
- Tbl = Tbl(:,[1:2:end-1 end]);
- Tbl = array2table(Tbl,'VariableNames',[fields,{'labels'}]);
- % Retrain SVM from classification learner
- % 250126 -- optimizable SVM, 10-fold cv
- % '>> classificationLearner' run 'optimizableSVM' and 'ExportModel'
- rng(0); % Initialize RNG for reproducibility
- [SVMecoc, validationAccuracy, partitionedModel] = trainSVMpvsst(Tbl); % - use this to add posterior fit
- SVM = SVMecoc.ClassificationSVM;
- fprintf('Validation accuracy %.2f%%\n',validationAccuracy*100)
- % Get predictions for high-certainty confusion matrix only
- % [labels,~,~,scoreProb] = resubPredict(SVM);
- % isHQ = max(scoreProb,[],2)>.5;
- % response = Tbl.labels;
- % Perform cross-validation
- % partitionedModel = crossval(SVM, 'KFold', 10);
- % Compute validation predictions
- [labels, ~, ~, scoreProb] = kfoldPredict(partitionedModel);
- isHQ = max(scoreProb,[],2)>.5;
- response = Tbl.labels;
- % All predictions
- figure;
- cm = confusionchart(response, labels);
- cm.RowSummary = 'row-normalized';
- cm.ColumnSummary = 'column-normalized';
- title('All classifications');
- % High-certainty predictions, only
- figure;
- cm = confusionchart(response(isHQ), labels(isHQ));
- cm.RowSummary = 'row-normalized';
- cm.ColumnSummary = 'column-normalized';
- title('High-certainty classifications');
- clear cm labels score pbscore scoreProb SVMecoc Tbl ff fields include exclude...
- validationAccuracy response labels scoreProb isHQ cm partitionedModel
- %% Classify batch_metrics with SVM classifier (keep all cells, set non-classifiable DG to 'Unknown')
- % Load batch metrics first
- clear AllTbl
- celltype = {'PV interneuron','SST interneuron','Granule Cell','Mossy Cell','Unknown'};
- % Remove cells with inverse spikes or bad waveforms
- [~, classIDs] = select_cells(batch_metrics,...
- 'include',struct('brainRegion',{'DG'}),...
- 'exclude',struct('putativeCellType',{'Unknown'},'tags',{{'InverseSpike','Bad'}}));
- class_metrics = batch_metrics;
- isDG = contains(class_metrics.brainRegion,'DG');
- isGood = false(1,length(batch_metrics.UID));
- isGood(classIDs) = true;
- %isGood = ~contains(class_metrics.tags,{{'InverseSpike','Bad'}}) & ~contains(class_metrics.putativeCellType,'Unknown');
- % Get features
- fields = {'cv2','acg_tau_rise','troughToPeak','ab_ratio','firingRate','ds2amplitude','wakeNREMratio'};
- for ff = 1:length(fields)
- AllTbl{ff} = class_metrics.(fields{ff});
- end
- % Assemble data into table
- AllTbl = array2table(cat(1,AllTbl{:})','VariableNames',fields);
- % Set rng for deterministic outcome
- rng(0);
- % Run Classifier
- [labels,~,~,scoreProb] = predict(SVM,AllTbl);
- % Set labels with posterior prob < 50% to 'Unknown'
- labels(max(scoreProb,[],2)<.5) = 5;
- % Set DG labels with bad waveforms to 'Unknown'
- labels(isDG & ~isGood) = 5;
- for ll = 1:5
- theseIDs = find(labels'==ll & isDG);
- for n = theseIDs
- class_metrics.putativeCellType{n} = celltype{ll};
- end
- end
- clear ll n theseIDs labels AllTbl scoreProb fields classIDs celltype ff isDG isGood
- %% Get synaptic parameters for each connected pair
- % TODO: Correct cell-type determination
- % TODO: Make analysis for each CELL (connectivity rates) and each PAIR
- % (mono_analysis)
- reanalyze = false;
- mono_analysis = getMonoConnAnalysis(class_metrics,'reanalyze',reanalyze);
- clear reanalyze;
- %% Connected and non-connected simultaneously recorded pairs and connection rates (class metrics)
- % Create in- and exclude structure
- %criteria = struct('batchIDs',{[5 15]}); % SUBSELECT DATASETS HERE!
- labels = {'PV','SST','GC','MC','MEC PYR','PVo','SSTo'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','Pyramidal Cell','',''},...
- 'brainRegion',{'DG','DG','DG','DG','ENTm','DG','DG'},...
- 'groundTruthClassification',{'','','','','','PV+','SST+'},...
- 'monoSynManual',1);
- exclude = struct('groundTruthClassification',{'','','+','+','+','',''});
- % Get the connectivity data (rates and pair global IDs)
- mono_res = getMonoConnRates(class_metrics,'include',include,'exclude',exclude);
- fprintf('Table rows = pre\n')
- array2table(sum(mono_res.nEcon,3),'RowNames',labels,'VariableNames',labels)
- fprintf('Table rows = pre(%%)\n')
- confrct = round(sum(mono_res.nEcon,3)./sum(mono_res.nEtotal,3)*100,2);
- array2table(confrct,'RowNames',labels,'VariableNames',labels)
- % Make heatmap
- figure('position',[100 100 220 175]); heatmap(log10(confrct(1:5,1:5)));
- colormap(bwyr); caxis([-1 .5]); % For color
- figure('position',[100 100 220 175]); heatmap(confrct(1:5,1:5)); % For values
- clear labels include exclude tbl
- %% Converging and non-converging pairs
- % Create in- and exclude structure
- %criteria = struct('batchIDs',{[5 15]}); % SUBSELECT DATASETS HERE!
- labels = {'PV','SST','GC','MC','MEC PYR','PVo','SSTo'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','Pyramidal Cell','',''},...
- 'brainRegion',{'DG','DG','DG','DG','ENTm','DG','DG'},...
- 'groundTruthClassification',{'','','','','','PV+','SST+'},...
- 'monoSynManual',1);
- exclude = struct('groundTruthClassification',{'','','+','+','+','',''});
- % Get the connectivity data (rates and pair global IDs)
- convg_res = getConvergingPairs(class_metrics,'include',include,'exclude',exclude);
- % fprintf('Table rows = pre\n')
- % array2table(sum(mono_res.nEcon,3),'RowNames',labels,'VariableNames',labels)
- %
- % fprintf('Table rows = pre(%%)\n')
- % array2table((sum(mono_res.nEcon,3)./sum(mono_res.nEtotal,3)*100),...
- % 'RowNames',labels,'VariableNames',labels)
- clear labels include exclude
- %% Load place fields (Figure 4)
- linear = load_LinearBatch(batch_metrics);
- openfield = load_OpenfieldBatch(batch_metrics);
- radial = load_RadialBatch(batch_metrics);
- %% Lii/iii separate connected and non-connected simultaneously recorded pairs and connection rates (class metrics)
- % Separate for MEC Lii and Liii
- %
- % Create in- and exclude structure
- %criteria = struct('batchIDs',{[5 15]}); % SUBSELECT DATASETS HERE!
- labels = {'PV','SST','GC','MC','PYR2','PYR3','PVo','SSTo'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','Pyramidal Cell','Pyramidal Cell','',''},...
- 'brainRegion',{'DG','DG','DG','DG','ENTm2','ENTm3','DG','DG'},...
- 'groundTruthClassification',{'','','','','','','PV+','SST+'},...
- 'monoSynManual',1);
- exclude = struct('groundTruthClassification',{'','','+','+','+','+','',''});
- % Get the connectivity data (rates and pair global IDs)
- mono_res_l23 = getMonoConnRates(class_metrics,'include',include,'exclude',exclude);
- fprintf('Table rows = pre\n')
- array2table(sum(mono_res_l23.nEcon,3),'RowNames',labels,'VariableNames',labels)
- fprintf('Table rows = pre(%%)\n')
- confrct = round(sum(mono_res_l23.nEcon,3)./sum(mono_res_l23.nEtotal,3)*100,2);
- array2table(confrct,'RowNames',labels,'VariableNames',labels)
- % Make heatmap
- figure('position',[100 100 250 205]); heatmap(log10(confrct(1:6,1:6)));
- colormap(bwyr); caxis([-1 .5]); % For color
- %xticklabels(labels(1:6)); xtickangle(45);
- figure('position',[100 100 250 205]); heatmap(confrct(1:6,1:6)); % For values
- clear labels include exclude tbl
- %% Figure 1
- %% 1c(1) Single cell example opto response & ACG (eNpHR - PV)
- % Load cell_metrics, spikes, opto_1sec
- session = 'PV22_240308';
- color = [.56 .39 .93];
- UID = 47; %PV22_240308-UID 47-20ms
- printfig = true;
- % Load stuff
- basepath = local2remote(session);
- basename = bz_BasenameFromBasepath(basepath);
- cell_metrics = load_cellmetrics_TH('basepath',basepath);
- spikes = load_spikes_TH('basepath',basepath);
- load([basepath,filesep,basename,'.opto_20ms.manipulation.mat'],'opto_20ms');
- % ACG
- acgT = cell_metrics.general.ccg_time;
- acgBinSz = mean(diff(acgT));
- acgEdg = [acgT-acgBinSz/2; acgT(end)+acgBinSz/2]';
- % Plot ACG
- f1 = figure('position',[200 200 400 200]);
- subplot(1,2,1); hold on;
- histogram('BinEdges',acgEdg,'BinCounts',...
- cell_metrics.general.ccg(:,UID,UID),...
- 'FaceColor',color,'FaceAlpha',1,'LineStyle','none');
- title(sprintf('%s (%i)',cell_metrics.putativeCellType{UID},UID));
- xlabel('Time (s)');
- yticks([]);
- % Plot Raster
- subplot(1,2,2);
- bz_eventRasterplot(spikes,opto_20ms.timestamps(1:10000,:),UID,'periEvtWdw',.02,...
- 'color',color,'subsample',5);
- sgtitle(cell_metrics.general.basename);
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%s-UID %i-20ms',cell_metrics.general.basename,UID),'-dpdf','-r0')
- end
- clear acgT acgBinSz acgEdg color UID printfig pos f1 session basepath basename...
- cell_metrics spikes opto_20ms
- %% 1c(2) Single cell example opto response & ACG (ChR - SST)
- % Load cell_metrics, spikes, opto_1sec
- session = 'YutaMouse20_140325';
- color = [0 .72 .53];
- UID = 6; % YutaMouse20-140325-UID 6-10ms
- printfig = true;
- % Load stuff
- basepath = strrep(local2remote(session),'_','-'); % bugfix, yuta sessions have '-'
- basename = bz_BasenameFromBasepath(basepath);
- cell_metrics = load_cellmetrics_TH('basepath',basepath);
- spikes = load_spikes_TH('basepath',basepath);
- load([basepath,filesep,basename,'.opto_10ms.manipulation.mat'],'opto_10ms');
- % ACG
- acgT = cell_metrics.general.ccg_time;
- acgBinSz = mean(diff(acgT));
- acgEdg = [acgT-acgBinSz/2; acgT(end)+acgBinSz/2]';
- % Plot ACG
- f1 = figure('position',[200 200 400 200]);
- subplot(1,2,1); hold on;
- histogram('BinEdges',acgEdg,'BinCounts',...
- cell_metrics.general.ccg(:,UID,UID),...
- 'FaceColor',color,'FaceAlpha',1,'LineStyle','none');
- title(sprintf('%s (%i)',cell_metrics.putativeCellType{UID},UID));
- xlabel('Time (s)');
- yticks([]);
- % Plot Raster
- subplot(1,2,2);
- bz_eventRasterplot(spikes,opto_10ms.timestamps,UID,'periEvtWdw',.02,...
- 'color',color,'subsample',5);
- sgtitle(cell_metrics.general.basename);
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%s-UID %i-10ms',cell_metrics.general.basename,UID),'-dpdf','-r0')
- end
- clear acgT acgBinSz acgEdg color UID printfig pos f1 session cell_metrics basepath...
- spikes opto_10ms
- %% 1d PSTH for PV/SST ChR/eNpHR responses 10/20 ms pulses
- baseline = [-Inf -.002]; % [-Inf 0] standard, [4 40] for freq
- minRate = 0; minPrctile = 1; % Minimum percentile of bins during baseline above minRate
- nGr = 4;
- printfig = false;
- % EVENT SELECTION
- type = 'manipulations'; % Manipulations, events
- field = {'opto_20ms','opto_20ms','opto_10ms','opto_10ms'};
- sortCriterion = '_modulationIndex'; % '_modulationSD' (default) or '_peakFreq' for chirp
- % CELL SELECTION
- labels = {'PV-eNpHR','SST-eNpHR','PV-ChR','SST-ChR'};
- include = struct('groundTruthClassification',{'PV+','SST+','PV+','SST+'},...
- 'labels',{'eNpHR','eNpHR','ChR2','ChR2'},...
- 'brainRegion',{'DG','DG','DG','DG'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,nGr),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,nGr));
- % PLOT
- f1 = figure('position',[200 20 130 165*nGr]); % Same abs height
- for gr = 1:4
- subplot(4,1,gr);
- plot_psth(batch_metrics,field{gr},'type',type,'labels',labels(gr),...
- 'include',include(gr),'exclude',exclude(gr),...
- 'colors',[0 0 0],'minRate',minRate,'minPrctile',minPrctile,...
- 'sortCriterion',sortCriterion,'baseline',baseline,'SDrange',[-5 5],...
- 'x_units','ms');
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Opto_pulse_psth.pdf','-dpdf','-r0')
- end
- clear include exclude nGr gr field type labels minRate minPrctile baseline...
- sortCriterion printfig f1 pos colors
- %% 1e Waveforms superimposed
- include = struct('putativeCellType',{'','','Granule Cell','Mossy Cell'},...
- 'groundTruthClassification',{'PV+','SST+','',''},...
- 'brainRegion',{'DG','DG','DG','DG'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4),...
- 'groundTruthClassification',{'~','~','+','+'});
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7];
- printfig = false;
- % Get z-scored waveforms for all cells:
- stdTS = batch_metrics.waveforms.time{1};
- for n = length(class_metrics.UID):-1:1
- % Get z-scored waveforms with standard timestamps
- waveforms(n,:) = zscore(interp1(batch_metrics.waveforms.time{n},...
- batch_metrics.waveforms.filt{n},stdTS));
- % % Filtered waveforms in microvolt
- % waveforms(n,:) = interp1(class_metrics.waveforms.time{n},...
- % class_metrics.waveforms.filt{n},stdTS);
- end
- % Plot all mean waveforms and SEM
- f1 = figure('position',[100 100 170 200]); hold on
- %figure('position',[100 100 800 200]); -- Toggle this for separate plots
- for ct = 1:length(include)
- % subplot(1,length(sel),ct);-- Toggle this for separate plots
- [~,cellIDs] = select_cells(batch_metrics,'include',include(ct),...
- 'exclude',exclude(ct));
- shadedErrorBar(stdTS, nanmean(waveforms(cellIDs,:)),...
- std(waveforms(cellIDs,:))./sqrt(length(cellIDs)),...
- 'lineProps',{'color',colors(ct,:)});
- % Label with N;
- %unitstr = sprintf('N = %i',length(cellIDs));
- %text(prctile(stdTS,10),-3.5,unitstr,'Color','k');
- %title(labels{sel(ct)});
- xlabel('Time (ms)');
- xlim([min(stdTS) max(stdTS)]);
- ylim([-4 2]);
- if ct == 1; ylabel('Amplitude (normalized)'); else; yticks([]); end
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Spike-waveforms.pdf','-dpdf','-r0')
- end
- clear waveforms stdTS sel ct n cellIDs include exclude printfig f1 colors pos
- %% 1f,h, S1d-h ACG rise time, CV2, spike width (troughtopeak), spike Asymmetry (AB)
- printfig = false;
- % Parameter selection
- fields = {'troughToPeak','acg_tau_rise','cv2','ab_ratio',...
- 'firingRate','ds2amplitude','wakeNREMratio'}; % 1e-h
- transformations = {'','log10','','','log10','','log2'}; % 1e-h
- % Cell selection
- labels = {'PV+','SST+','GC','MC'};
- include = struct('putativeCellType',{'','','Granule Cell','Mossy Cell'},...
- 'groundTruthClassification',{'PV+','SST+','',''},...
- 'brainRegion',{'DG','DG','DG','DG'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4),...
- 'groundTruthClassification',{'','','+','+'});
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7];
- % Plot
- f1 = figure('position',[50 450 155*length(fields) 115]); % Same aspect ratio
- %f1 = figure('position',[50 450 240*length(fields) 190]); % Same aspect ratio
- for ff = 1:length(fields)
- figure(f1);
- subplot(1,length(fields),ff);
- [~,~,values] = plot_metricfield(batch_metrics, fields{ff},'labels',labels,...
- 'include',include,'exclude',exclude,'tukeyFence',3,...
- 'colors',colors,'transformation',transformations{ff});
- set(gca,'fontsize',6);
- fprintf('\nDG statistics for %s:\n',fields{ff});
- %kruskalwallisNdunns(catuneven(values,NaN),labels);
- onewayGroupTest(catuneven(values,NaN),labels);
- % Nested glmm statistics
- fprintf('\nDG mixed-effects model statistics for %s:\n',fields{ff});
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'labels',labels, 'transformation',transformations{ff});
- glme_stats(valTbl)
- fprintf('\n ====================================== \n\n');
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig1fhS1d-h_CellParameters.pdf','-dpdf','-r0')
- end
- clear include exclude thiscriteria values field transformation sel f1 printfig...
- pos ff fields labels transformations
- %% 1g ACG superimposed
- include = struct('putativeCellType',{'','','Granule Cell','Mossy Cell'},...
- 'groundTruthClassification',{'PV+','SST+','',''},...
- 'brainRegion',{'DG','DG','DG','DG'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4),...
- 'groundTruthClassification',{'~','~','+','+'});
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7];
- % Get z-scored waveforms for all cells:
- ccgts = batch_metrics.general.batch{1}.acgs.log10;
- acgs = batch_metrics.acg.log10_rate'; % .log10_rate = peak normalized, .log10 = firing rate (Hz)
- % Plot all mean waveforms and SEM
- figure('position',[100 100 200 200]); hold on
- %figure('position',[100 100 800 200]); -- Toggle this for separate plots
- for ct = 1:length(include)
- % subplot(1,length(sel),ct);-- Toggle this for separate plots
- [~,cellIDs] = select_cells(batch_metrics,'include',include(ct),...
- 'exclude',exclude(ct));
- shadedErrorBar(ccgts, nanmean(acgs(cellIDs,:)),...
- std(acgs(cellIDs,:))./sqrt(length(cellIDs)),...
- 'lineProps',{'color',colors(ct,:)});
- set(gca,'XScale','log');
- xlabel('Time (s)');
- xlim([0 1]);
- end
- clear waveforms stdTS sel ct n cellIDs include exclude colors ccgts acgs
- %% 1i TSNE for SVM classified metrics (Include Unknown)
- % To change TSNE parameters in cell explorer, console '>> edit CellExplorer_Preferences'
- fields = {'cv2','acg_tau_rise','troughToPeak','ab_ratio','firingRate','ds2amplitude','wakeNREMratio'};
- % MANU: firing irregularity (CV2), autocorrelogram (ACG) rise time, spike width, anatomical location, waveform asymmetry and firing rate
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .7 .7 .7; .56 .39 .93; 0 .72 .53];
- % Cell selection
- include = struct(...
- 'putativeCellType',{'PV interneuron','SST interneuron','Granule Cell','Mossy Cell','Unknown','',''},...
- 'groundTruthClassification',{'','','','','','PV+','SST+'});
- [include.brainRegion] = deal('DG');
- [include.geneticLine] = deal('Cre'); % 'Cre' for Fig1j, 'Wild type' For supplementary Fig1
- % Remove Inverse spike and Bad waveform metrics
- plot_metrics = select_cells(class_metrics,...
- 'include',struct('brainRegion','DG'),...
- 'exclude',struct('tags',{{'Bad','InverseSpike'}}));
- clear values
- for ff = length(fields):-1:1
- values(:,ff) = plot_metrics.(fields{ff});
- end
- Y = tsne(values,'standardize',true);
- % Bugfix: Remove cells from batch that don't have all features
- plot_metrics.tags((any(isnan(values),2))) = {'incomplete'};
- plot_metrics = select_cells(plot_metrics,'exclude',struct('tags','incomplete'));
- figure('position',[100 100 280 260]); hold on
- for ct = 1:length(include)
- [~,cellIDs] = select_cells(plot_metrics,'include',include(ct));
- if any(ct==[6 7])
- % Use different markers for ChR and HR
- chrIDs = intersect(find(contains(plot_metrics.labels,'ChR')),cellIDs);
- hrIDs = intersect(find(contains(plot_metrics.labels,'eNpHR')),cellIDs);
- scatter(Y(chrIDs,1),Y(chrIDs,2),36,colors(ct,:),'+',...
- 'LineWidth',.5,'MarkerFaceAlpha',1);
- scatter(Y(hrIDs,1),Y(hrIDs,2),36,colors(ct,:),'x',...
- 'LineWidth',.5,'MarkerFaceAlpha',1);
- else
- scatter(Y(cellIDs,1),Y(cellIDs,2),12,colors(ct,:),'o',...
- 'filled','MarkerFaceAlpha',.25);
- end
- end
- clear fields values sel include exclude ct markers cellIDs chrIDs colors hrIDs...
- plot_metrics Y
- %% Supplementary Fig1b: Burst-index vs. ACG-tau (PC-IN classification)
- % Peter CE IN criteria: acg_tau_decay > 30ms; acg_tau_rise>3; troughToPeak <= 0.425ms
- fields = {'troughToPeak','acg_tau_rise','acg_tau_decay'}; % 'acg_tau_rise','acg_tau_decay','burstIndex_Royer2012';
- colors = [.46 .29 .83; 0 .72 .53]; % Opto only
- % Basic cell selection criteria
- include = struct('brainRegion',{'DG'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType','Unknown');
- f1 = figure('position',[200 200 330 350]);
- % PC AND INTERNEURONS (DG ONLY)
- include.putativeCellType = 'Cell';
- [~,PCids] = select_cells(batch_metrics,'include',include,'exclude',exclude);
- % scatter(batch_metrics.(fields{1})(selected), batch_metrics.(fields{2})(selected), 10,...
- % 'ro','filled','MarkerFaceAlpha',.2);
- scatter3(batch_metrics.(fields{1})(PCids), batch_metrics.(fields{3})(PCids),...
- batch_metrics.(fields{2})(PCids), 10, 'ro','filled','MarkerFaceAlpha',.2);
- hold on
- include.putativeCellType = 'Interneuron';
- [~,INids] = select_cells(batch_metrics,'include',include,'exclude',exclude);
- % scatter(batch_metrics.(fields{1})(selected), batch_metrics.(fields{2})(selected), 10,...
- % 'bo','filled','MarkerFaceAlpha',.2);
- scatter3(batch_metrics.(fields{1})(INids), batch_metrics.(fields{3})(INids),...
- batch_metrics.(fields{2})(INids), 10, 'bo','filled','MarkerFaceAlpha',.2);
- % OPTO TYPES
- include.putativeCellType = '';
- include.groundTruthClassification = 'PV+';
- [~,PVids] = select_cells(batch_metrics,'include',include,'exclude',exclude);
- %scatter(batch_metrics.(fields{1})(selected), batch_metrics.(fields{2})(selected),100,'k+');
- scatter3(batch_metrics.(fields{1})(PVids), batch_metrics.(fields{3})(PVids),...
- batch_metrics.(fields{2})(PVids), 50, colors(1,:), '+');
- include.groundTruthClassification = 'SST+';
- [~,SSTids] = select_cells(batch_metrics,'include',include,'exclude',exclude);
- %scatter(batch_metrics.(fields{1})(selected), batch_metrics.(fields{2})(selected),100,'kx');
- scatter3(batch_metrics.(fields{1})(SSTids), batch_metrics.(fields{3})(SSTids),...
- batch_metrics.(fields{2})(SSTids), 50, colors(2,:), '+');
- set(gca,'Yscale','log');
- set(gca,'Zscale','log');
- set(f1,'renderer','painters');
- xlabel('Spike-half-width (ms)');
- ylabel('ACG decay-constant (ms)');
- zlabel('ACG rise-constant (ms)');
- clear pcind inind
- % PIE CHARTS
- figure('position',[100 50 600 300]);
- subplot(1,2,1);
- pie([length(intersect(PVids,INids)) length(intersect(PVids,PCids))]);
- ax = gca;
- ax.Colormap = [0 0 1; 1 0 0];
- title('PV-Cre Opto+')
- subplot(1,2,2);
- pie([length(intersect(SSTids,INids)) length(intersect(SSTids,PCids))]);
- ax = gca;
- ax.Colormap = [0 0 1; 1 0 0];
- title('SST-Cre Opto+')
- legend({'Interneuron','Principal Cell'});
- fprintf('N PV cells: %i, N SST cells: %i\n',length(PVids),length(SSTids))
- clear include exclude criteria PVids SSTids PCids INids colors ax f1 fields
- %% Supplementary Fig 1c: GC/MC classification
- % Run YutClassifier (see preparations above)
- %% Supplementary Fig 1i: TSNE WT only
- % See Fig 1i above
- %% Figure 2
- %% 2a Overall Firing rates for class_metrics (violin)
- % + GLME stats (20251206)
- % + Split IN plots (opto vs. non-opto)
- % Plot parameters
- fields = {'firingRate'};
- transformations = {'log10'}; % set to {''} for mean +/- SEM values in console
- printfig = false;
- % Cell selection
- labels = {'PV','SST','GC','MC','PV+','SST+',};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},'groundTruthClassification',{'','','','','PV+','SST+'});
- [include.brainRegion] = deal('DG');
- exclude = struct('tags',{{'Bad','InverseSpike'}});
- criteria = struct('UID',repmat({[0 Inf]},1,6));
- %[criteria.radialRatePeak] = deal([1 Inf]); % Specific exclusion criteria here
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- for ff = 1:length(fields)
- % PLOTTING
- fi{ff} = figure('position',[200*ff 450 115 115]); % Same aspect ratio
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'splitgroups',[5 1; 6 2]);
- set(gca,'fontsize',6);
- % Save figure
- if printfig
- pos = get(fi{ff},'Position');
- set(fi{ff},'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi{ff},sprintf('%s_svm_opto.pdf',fields{ff}),'-dpdf','-r0')
- end
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:\n',fields{ff});
- %kruskalwallisNdunns(valMtrx(:,1:4),labels(1:4));
- onewayGroupTest(valMtrx(:,1:4),labels(1:4));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:\n',fields{ff});
- onewayGroupTest(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- %kruskalwallisNdunns(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- end
- % LMM nested data stats
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels);
- glme_stats(valTbl)
- end
- % Print mean +/- SEM values in console
- for ct = 1:6
- % fprintf('%s firing rate: %.2f +/- %.2f (mean +/- STD)\n',labels{ct},...
- % nanmean(valMtrx(:,ct)), nanstd(valMtrx(:,ct)))
- fprintf('%s firing rate: Median %.2f (%.2f - %.2f IQR)\n',labels{ct},...
- 10.^nanmedian(valMtrx(:,ct)), 10.^prctile(valMtrx(:,ct),25), 10.^prctile(valMtrx(:,ct),75))
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations
- %% 2b Incl Run/Rest Brain state dependent firing rates class_metrics (PSTH + boxplot)
- printfig = false;
- % Create in- and exclude structure
- labels = {'PV','SST','GC','MC'};
- limrate = [50 25 1.5 4]; % Hard coding here, no easy fix...
- include = struct('putativeCellType',{'PV interneuron','SST interneuron','Granule Cell','Mossy Cell'},...
- 'brainRegion',{'DG','DG','DG','DG'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4));
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7];
- f1 = figure('position',[100 100 1250 200]);
- for ct = 1:4
- [~,cellIDs] = select_cells(class_metrics,'include',include(ct),'exclude',exclude(ct));
- rates = cat(1,class_metrics.firingRateRun(cellIDs),class_metrics.firingRateWake(cellIDs),...
- class_metrics.firingRateNREM(cellIDs),class_metrics.firingRateREM(cellIDs));
- rates = rates(:,~any(isnan(rates),1));
- figure(f1)
- ax(ct) = subplot(1,4,ct); hold(ax(ct),'on');
- % Make rates heatmap in background
- [~,order] = sort(rates(1,:));
- imagesc(1:4, linspace(0, limrate(ct), size(rates,2)), rates(:,order)');
- colormap(bwyr);
- colorbar
- clim([0 limrate(ct)]);
- % Plot boxes
- boxplot(rates','symbol', '');
- h = findobj('LineStyle','--'); set(h, 'LineStyle','-');
- h = findobj(gca,'Tag','Box');
- for j=1:length(h)
- patch(get(h(j),'XData'),get(h(j),'YData'),colors(ct,:),'FaceAlpha',.7);
- end
- % Markup
- title(labels{ct});
- ylabel('Firing Rate (Hz)');
- xticklabels({'Run','Quiet','NREM','REM'});
- xtickangle(45);
- ylim([0 limrate(ct)]);
- % Stats (repeated measures ANOVA on ranks)
- fprintf([labels{ct} '\n'])
- onewayGroupTest(rates',{'Run','Quiet','NREM','REM'});
- end
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('StateRates_psth.pdf'),'-dpdf','-r0')
- end
- clear ct h field j rates f1 wi order pos printfig ax cellIDs colors exclude include labels
- %% Suppl 2a,b: NREM-Wake, REM-Wake ratios
- % Plot parameters
- fields = {'NREMwakeRatio','REMwakeRatio'};
- transformations = {'log2','log2'};
- printfig = false;
- % Cell selection
- labels = {'PV','SST','GC','MC','PV+','SST+',};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},'groundTruthClassification',{'','','','','PV+','SST+'});
- [include.brainRegion] = deal('DG');
- exclude = struct('tags',{{'Bad','InverseSpike'}});
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- for ff = 1:length(fields)
- % PLOTTING
- fi{ff} = figure('position',[200*ff 450 135 135]); % Same aspect ratio
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'markercolors',[repmat([.2 .2 .2],6,1)],... % 'markercolors',[repmat([.2 .2 .2],4,1); colors([1 2],:)]
- 'splitgroups',[5 1; 6 2]);
- set(gca,'fontsize',6);
- plot([0 length(include)+1],[0 0],':','color',[.5 .5 .5]);
- % Save figure
- if printfig
- pos = get(fi{ff},'Position');
- set(fi{ff},'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi{ff},sprintf('%s_svm_opto.pdf',fields{ff}),'-dpdf','-r0')
- end
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:\n',fields{ff});
- onewayGroupTest(valMtrx(:,1:4),labels(1:4));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:\n',fields{ff});
- onewayGroupTest(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- end
- % LMM nested data stats
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'labels',labels);
- glme_stats(valTbl)
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations valTbl
- %% Figure 3
- %% 3a Plot all inputs to given target w/ place fields
- post = 8570; % Global ID (get e.g. from connectivity plot below)
- pairs = class_metrics.putativeConnections.excitatory(...
- class_metrics.putativeConnections.excitatory(:,2) == post,:);
- printfig = false;
- for pp = 1:size(pairs,1)
- f1 = figure('position',[10*pp+100 200 500 700]);
- plot_pairWplacefields(pairs(pp,1),pairs(pp,2),class_metrics);
- drawnow;
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%i-%i_connExample.pdf',pairs(pp,1),pairs(pp,2)),'-dpdf','-r0')
- end
- end
- clear post pairs fs pos
- %% 3b Plot probe layout w/ classified units, connections, etc
- makeConnectivityPlot(class_metrics,'batchID',97,'showIDs',''); % 'global','local'
- %% 3c CCG PSTH
- % TODO: Milliseconds and % for transmission probability
- % TODO: class_metrics.general.batch{1, 1}.ccg , .ccg_times could be used
- % instead getting around the whole mono_analysis thing!
- pairlabels = {'GC-PV','GC-SST','MC-PV','MC-SST','MEC-PV','MEC-SST'};
- prelabels = {'GC','MC','MEC'};
- postlabels = {'PV','SST'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = true;
- preinclude = struct('putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct('putativeCellType',{'PV','SST'},'brainRegion',{'DG','DG'}); % Consider adding opto types extra
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- f1 = figure('Position',[100 10 150 980]); hold on; sp = 0;
- % Plot PSTH
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- sp = sp+1;
- % Get PSTH
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- values = mono_analysis.latency_allspk(isRightPair);
- [~,order] = sort(values,'ascend');
- PairIDs = find(isRightPair);
- thisccg = 100*(mono_analysis.CCG_allspk(PairIDs(order),:) -...
- mono_analysis.pred_allspk(PairIDs(order),:)); % Convert to percent
- ccgts = mono_analysis.ccgTimeStamps * 1000; % Convert to ms
- subplot(6,1,sp);
- plim = [-1 2];
- % Plot PSTH
- imagesc(ccgts, linspace(plim(1), plim(2), size(thisccg,1)), thisccg);
- set(gca,'YDir','normal')
- xlim([-2 6]);
- xlabel('Time (ms)');
- colormap(bwyr);
- clim([plim(1) plim(2)]);
- % Overlay mean +/- SEM
- shadedErrorBar(ccgts, nanmean(thisccg,1), nanstd(thisccg,[],1)./sqrt(size(thisccg,1)),...
- 'lineProps',{'-','color',[0 0 0]});
- % Label with N;
- text(prctile(.002,55), plim(1)+ (plim(2)-plim(1))/10,...
- sprintf('N = %i',size(thisccg,1)),'Color','k')
- ylabel('Transm prob (%)')
- title(pairlabels{sp});
- drawnow
- end
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'MonoSynCCG_psth.pdf','-dpdf','-r0')
- end
- clear globIDs locIDs pre post presel postsel iRightPair f1 sp values ccgts colors...
- isRightPair order PairIDs pairlabels plim postinclude postlabels preinclude...
- prelabels thisccg f1 pos printfig
- %% 3d PV and SST input fractions and stats (svm and opto separately!)
- % Run section 'Get connected and non-connected...' above (preparations) first!
- % TODO: Consider: Opto+ cells should be separate plot (supplement) as the fractions
- % of pairs per session depends on the number of post in session, ergo not
- % same distribution
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = false;
- % Include only sessions w/ manually corrected monosynaptic connections
- % Technically unnecesary, this is already tested when mono_res are created
- nEcon = mono_res.nEcon(:,:,mono_res.monoSynManual);
- nEtotal = mono_res.nEtotal(:,:,mono_res.monoSynManual);
- % Plot MEC,GC,MC connections to svm PV/SST IN
- EinRates = nEcon([3 4 5],[1 2],:)./nEtotal([3 4 5],[1 2],:) * 100;
- EinRatesPl = reshape(permute(EinRates,[2 1 3]),6,[]);
- % Rates for GC,MC connections to opto PV/SST IN
- oEinRates = nEcon([3 4],[6 7],:)./nEtotal([3 4],[6 7],:) * 100;
- oEinRatesPl = reshape(permute(oEinRates,[2 1 3]),4,[]);
- % Get numbers for console
- EconTot = sum(nEcon,3);
- Etot = sum(nEtotal,3);
- ErateTot = EconTot./Etot *100;
- % MAIN FIGURE (3d)
- f1 = figure('position',[100 50 190 220]);
- % Violin plots
- distributionPlot(mat2cell(EinRatesPl,ones(6,1)),...
- 'color',mat2cell(colors([3 3 4 4 5 5],:),ones(6,1)),'showMM',6,'distWidth',.9,...
- 'addSpread',0,'histOpt',1,'divFactor',2,'FaceAlpha',.5);%,'histOri','left','widthDiv',[2 1]);
- plotSpread(mat2cell(EinRatesPl,ones(6,1)),...
- 'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',{[0 0 0]},...%mat2cell(colors([3 3 4 4],:),ones(4,1)),...
- 'distributionMarkerSize',5,'distributionMarkerAlpha',.5,'binWidth',.05);
- plotSpread(mat2cell(oEinRatesPl,ones(4,1)),...
- 'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',{[0 0 0]},...%mat2cell(colors([3 3 4 4],:),ones(4,1)),...
- 'distributionMarkerSize',2,'distributionMarkerAlpha',.5,...
- 'binWidth',.05,'distributionMarkers','+');
- xticks(1:6);
- xticklabels({'GC-DGPV','GC-DGSST','MC-DGPV','MC-DGSST','MEC-DGPV','MEC-DGSST'});
- xtickangle(45);
- ylim([0 55]);
- ylabel('% connected');
- % SEPARATE FIGURE OPTO ONLY FOR SUPPLEMENT (S3d)
- f2 = figure('position',[100 50 140 220]);
- % Violin plots
- distributionPlot(mat2cell(oEinRatesPl,ones(4,1)),...
- 'color',mat2cell(colors([3 3 4 4],:),ones(4,1)),'showMM',6,'distWidth',.9,...
- 'addSpread',0,'histOpt',1,'divFactor',2,'FaceAlpha',.5);
- plotSpread(mat2cell(oEinRatesPl,ones(4,1)),...
- 'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',{[0 0 0]},...%mat2cell(colors([3 3 4 4],:),ones(4,1)),...
- 'distributionMarkerSize',2,'distributionMarkerAlpha',.5,...
- 'binWidth',.05,'distributionMarkers','+');
- xticks(1:4);
- xticklabels({'GC-DGPV','GC-DGSST','MC-DGPV','MC-DGSST'});
- xtickangle(45);
- ylim([0 55]);
- ylabel('% connected');
- % STATS FOR SVM CELL TYPES
- % Print total con/total numbers and stats (ranksum) in console
- fprintf('GC to DG-PV: %i/%i (%.2f%%), to DG-SST %i/%i (%.2f%%)\n',...
- EconTot(3,1),Etot(3,1),ErateTot(3,1),EconTot(3,2),Etot(3,2),ErateTot(3,2));
- pvals(1) = unpairedSampleTest(EinRatesPl(1,:),EinRatesPl(2,:),'labels',{'PV','SST'},'verbose',true);
- fprintf('MC to DG-PV: %i/%i (%.2f%%), to DG-SST %i/%i (%.2f%%)\n',...
- EconTot(4,1),Etot(4,1),ErateTot(4,1),EconTot(4,2),Etot(4,2),ErateTot(4,2));
- pvals(2) = unpairedSampleTest(EinRatesPl(3,:),EinRatesPl(4,:),'labels',{'PV','SST'},'verbose',true);
- fprintf('MEC to DG-PV: %i/%i (%.2f%%), to DG-SST %i/%i (%.2f%%)\n',...
- EconTot(5,1),Etot(5,1),ErateTot(5,1),EconTot(5,2),Etot(5,2),ErateTot(5,2));
- pvals(3) = unpairedSampleTest(EinRatesPl(5,:),EinRatesPl(6,:),'labels',{'PV','SST'},'verbose',true);
- % Multiple-comparison correction
- pvals = multCompCorr(pvals,'method','Dunn-Sidak');
- fprintf('Corrected p-values (Dunn-Sidak)\nGC PV vs. SST: %.4g\nMC PV vs. SST: %.4g\nMEC PV vs. SST: %.4g\n',pvals)
- clear pvals
- % STATS FOR OPTO-TAGGED CELL TYPES
- fprintf('Opto: GC to DG-PV: %i/%i (%.2f%%), to DG-SST %i/%i (%.2f%%)\n',...
- EconTot(3,6),Etot(3,6),ErateTot(3,6),EconTot(3,7),Etot(3,7),ErateTot(3,7));
- pvals(1) = unpairedSampleTest(oEinRatesPl(1,:),oEinRatesPl(2,:),'labels',{'PV','SST'},'verbose',true); % [sic!], EinRates is only 4 categories
- fprintf('Opto: MC to DG-PV: %i/%i (%.2f%%), to DG-SST %i/%i (%.2f%%)\n',...
- EconTot(4,6),Etot(4,6),ErateTot(4,6),EconTot(4,7),Etot(4,7),ErateTot(4,7));
- pvals(2) = unpairedSampleTest(oEinRatesPl(3,:),oEinRatesPl(4,:),'labels',{'PV','SST'},'verbose',true);
- % Multiple-comparison correction (opto)
- pvals = multCompCorr(pvals,'method','Dunn-Sidak');
- fprintf('Corrected p-values (Dunn-Sidak) opto\nGC PV vs. SST: %.4g\nMC PV vs. SST: %.4g\n',pvals)
- % SAVE FIGURE
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'ConnectivityRates.pdf','-dpdf','-r0')
- pos = get(f2,'Position');
- set(f2,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f2,'ConnectivityRatesOptoOnly.pdf','-dpdf','-r0')
- end
- clear EconTot Etot ErateTot EinRates EinRatesPl nEcon nEtotal f1 pos printfig...
- pvals f2
- %% 3e, S3e: Synaptic latencies
- % TODO: Make function to load synaptic results aligned w/ batch_metrics,
- % for now just do sanity check.
- printfig = false;
- field = 'latency_allspk'; % 'peak_allspk','latency_allspk'
- ylims = [0 5]; %[0 .005],[0 .4]
- ylab = 'Latency (ms)'; %'Latency (s)','Transm prob'
- labels = {'GC-PV','GC-SST','MC-PV','MC-SST','MEC-PV','MEC-SST'}; % 'o' = opto! --
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- preinclude = struct(...
- 'putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct(...
- 'putativeCellType',{'PV','SST','',''},...
- 'brainRegion',{'DG','DG','DG','DG'},...
- 'groundTruthClassification',{'','','PV+','SST+'});
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- % Get latencies for desired pair types
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- values{pre,post} = mono_analysis.(field)(isRightPair)*1000;
- end
- end
- % FIGURE (SVM)
- f1 = figure('position',[100 50 250 300]);
- plotSpread(mat2cell(catuneven(reshape(values(:,[1 2])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,... %'spreadFcn',{'lin',75}
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',5,'binWidth',.05);
- plotSpread(mat2cell(catuneven(reshape(values(:,[3 4])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,... % 'spreadFcn',{'lin',10}
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values(:,[1 2])',6,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4 5 5],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- xticklabels(labels);
- xtickangle(45);
- ylim(ylims);
- ylabel(ylab);
- % FIGURE (OPTO) - S3e
- f2 = figure('position',[100 50 180 300]);
- plotSpread(mat2cell(catuneven(reshape(values([1 2],[3 4])',4,1),NaN)',ones(4,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,... % 'spreadFcn',{'lin',10}
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values([1 2],[3 4])',4,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- xticklabels(labels);
- xtickangle(45);
- ylim(ylims);
- ylabel(ylab);
- % STATS
- % Print mean +/- STD in console per cell type
- fprintf('%s values:\n',field);
- for pre = 1:length(preinclude)
- for post = [1 2]
- fprintf('%s: %.2f +/- %.2f\n',labels{post+(pre-1)*2},...
- nanmean(values{pre,post}), nanstd(values{pre,post}))
- end
- end
- % Separate ANOVA for opto and SVM identified interneurons!
- fprintf('\nDG statistics for %s, SVM types:\n',field);
- kruskalwallisNdunns(catuneven(reshape(values(:,[1 2])',6,1),NaN),labels);
- fprintf('\nDG statistics for %s, opto vs GC/MC:\n',field);
- kruskalwallisNdunns(catuneven(reshape(values([1 2],[3 4])',4,1),NaN),...
- labels(1:4)); % Exclude [3] pre, there are no opto in MEC mice
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig3e_SynapticLatencies.pdf','-dpdf','-r0')
- pos = get(f2,'Position');
- set(f2,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f2,'FigS3e_SynapticLatencies_opto.pdf','-dpdf','-r0')
- end
- clear locIDs globIDs presel postsel preinclude postinclude labels isRightPair...
- values f1 post pre printfig pos f1 isRightPair colors labels postinclude...
- preinclude ylab ylims field
- %% 3f, S3f: Transmission probability
- % TODO: Make function to load synaptic results aligned w/ batch_metrics,
- % for now just do sanity check.
- field = 'peak_allspk'; % 'peak_allspk','latency_allspk'
- ylims = [-3 -.5]; %[0 .005],[0 .4]
- ylab = 'Transm prob (%)'; %'Latency (s)','Transm prob'
- labels = {'GC-PV','GC-SST','MC-PV','MC-SST','MEC-PV','MEC-SST'}; % 'o' = opto! --
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = true;
- preinclude = struct(...
- 'putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct(...
- 'putativeCellType',{'PV','SST','',''},...
- 'brainRegion',{'DG','DG','DG','DG'},...
- 'groundTruthClassification',{'','','PV+','SST+'});
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- % Get Transmission probabilities for desired pair types
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- % Get log10 values
- theseVal = log10(mono_analysis.(field)(isRightPair));
- theseVal = real(theseVal(~isnan(theseVal) & ~isinf(theseVal) & ~imag(theseVal)>0));
- values{pre,post} = theseVal;
- clear theseVal
- end
- end
- % FIGURE (SVM)
- f1 = figure('position',[100 50 190 220]);
- plotSpread(mat2cell(catuneven(reshape(values(:,[1 2])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,...
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',5,'binWidth',.05);
- plotSpread(mat2cell(catuneven(reshape(values(:,[3 4])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,... % 'spreadFcn',{'lin',10}
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values(:,[1 2])',6,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4 5 5],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- yticks([-3 -2 -1]);
- yticklabels([.1 1 10]);
- xticklabels(labels);
- xtickangle(45);
- ylim(ylims);
- ylabel(ylab);
- % FIGURE (OPTO)
- f2 = figure('position',[100 50 125 220]);
- plotSpread(mat2cell(catuneven(reshape(values([1 2],[3 4])',4,1),NaN)',ones(4,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,'distributionMarkerAlpha',.3,... % 'spreadFcn',{'lin',10}
- 'distributionColors',{[0 0 0]},...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values([1 2],[3 4])',4,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4 5 5],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- yticks([-3 -2 -1]);
- yticklabels([.1 1 10]);
- xticklabels(labels);
- xtickangle(45);
- ylim(ylims);
- ylabel(ylab);
- % Print mean +/- STD in console per cell type
- fprintf('%s values:\n',field);
- for pre = 1:length(preinclude)
- for post = [1 2]
- fprintf('%s: %.2f +/- %.2f\n',labels{post+(pre-1)*2},...
- 100*nanmean(10.^values{pre,post}), 100*nanstd(10.^values{pre,post}))
- end
- end
- % Separate ANOVA for opto and SVM identified interneurons!
- fprintf('\nDG statistics for %s, SVM types:\n',field);
- kruskalwallisNdunns(catuneven(reshape(values(:,[1 2])',6,1),NaN),labels);
- fprintf('\nDG statistics for %s, opto vs GC/MC:\n',field);
- kruskalwallisNdunns(catuneven(reshape(values([1 2],[3 4])',4,1),NaN),...
- labels(1:4)); % Exclude [3] pre, there are no opto in MEC mice
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig3f_TransmissionProbabilities.pdf','-dpdf','-r0')
- pos = get(f2,'Position');
- set(f2,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f2,'FigS3f_TransmissionProbabilities_opto.pdf','-dpdf','-r0')
- end
- clear locIDs globIDs presel postsel preinclude postinclude labels isRightPair...
- values f1 post pre printfig pos f1 isRightPair colors labels postinclude...
- preinclude ylab ylims field
- %% 3g, S3g: Synaptic facilitation
- burstSpk = 2; % 2 or 3, normalized to first
- ylims = [-3 3]; %[0 .005],[0 .4]
- ylab = 'Facilitation'; %'Latency (s)','Transm prob'
- labels = {'GC-PV','GC-SST','MC-PV','MC-SST','MEC-PV','MEC-SST'}; % 'o' = opto! --
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = false;
- preinclude = struct(...
- 'putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct(...
- 'putativeCellType',{'PV','SST','',''},...
- 'brainRegion',{'DG','DG','DG','DG'},...
- 'groundTruthClassification',{'','','PV+','SST+'});
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- % Get facilitation for desired pair types
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- % Calculate facilitation
- rawTransm{pre,post,1} = mono_analysis.peak(isRightPair,1);
- rawTransm{pre,post,2} = mono_analysis.peak(isRightPair,burstSpk);
- theseval = rawTransm{pre,post,2}./rawTransm{pre,post,1};
- theseval = theseval(theseval>0 & ~isinf(theseval)); % Remove negative transm prob
- values{pre,post} = log2(theseval); % log2 transformation
- end
- end
- % FIGURE 3G (SVM)
- f1 = figure('position',[100 50 190 220]);
- plot([0 7],[0 0],':','Color',[.5 .5 .5]);
- plotSpread(mat2cell(catuneven(reshape(values(:,[1 2])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,...
- 'distributionColors',[.5 .5 .5],'distributionMarkerSize',1,...
- 'distributionMarkerAlpha',.5,'distributionMarkers','o');
- plotSpread(mat2cell(catuneven(reshape(values(:,[3 4])',6,1),NaN)',ones(6,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,...
- 'distributionColors',[.5 .5 .5],...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values(:,[1 2])',6,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4 5 5],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- xticklabels(labels);
- xtickangle(45);
- ylim(ylims);
- yticks(ylims(1):ylims(2));
- yticklabels(round(2.^(ylims(1):ylims(2)),3));
- ylabel(ylab);
- % FIGURE S3G (Opto)
- f2 = figure('position',[100 50 125 220]);
- plot([0 5],[0 0],':','Color',[.5 .5 .5]);
- plotSpread(mat2cell(catuneven(reshape(values([1 2],[3 4])',4,1),NaN)',ones(4,1)),...
- 'spreadFcn',{'xp',[]},'spreadWidth',.9,...
- 'distributionColors',[.5 .5 .5],...
- 'distributionMarkerSize',4,'binWidth',.05,'distributionMarkers','+');
- customErrorBar(catuneven(reshape(values([1 2],[3 4])',4,1),NaN), 'errtype','STD',...
- 'colors',colors([3 3 4 4],:), 'MarkerSize',100, 'alpha',.8, 'LineWidth',1.5);
- xticklabels(labels(1:4));
- xtickangle(45);
- ylim(ylims);
- yticks(ylims(1):ylims(2));
- yticklabels(round(2.^(ylims(1):ylims(2)),3));
- ylabel(ylab);
- % STATS
- % Separate ANOVA for opto and SVM identified interneurons!
- fprintf('\nDG statistics for facilitation spike no %i, SVM types:',burstSpk);
- kruskalwallisNdunns(catuneven(reshape(values(:,[1 2])',6,1),NaN),labels);
- fprintf('\nDG statistics for facilitation spike no %i, opto vs GC/MC:',burstSpk);
- kruskalwallisNdunns(catuneven(reshape(values([1 2],[3 4])',4,1),NaN),...
- labels(1:4)); % Exclude [3] pre, there are no opto in MEC mice
- % Pairwise comparisons for faciliation degree
- fprintf('\n\nSVM cell types:');
- for pre = 1:3
- for post = [1 2]
- if length(rawTransm{pre,post,1})<2; continue; end
- fprintf('\n%s, pairwise comparison spike 1 vs. %i:\n',...
- labels{2*(pre-1)+post},burstSpk)
- pval = pairedSampleTest(rawTransm{pre,post,1},rawTransm{pre,post,2},...
- 'labels',{'spike1',sprintf('spike%i',burstSpk)},'verbose',true);
- % pvals = 1 - (1 - pvals) .^ N; Dunn-Sidak
- fprintf('Corrected p (Dunn-Sidak): %.4g\n',1 - (1-pval)^5);
- end
- end
- % Pairwise comparisons for faciliation (opto only)
- fprintf('\n\nOpto cell types:');
- for pre = 1:2
- for post = [3 4]
- if length(rawTransm{pre,post,1})<2; continue; end
- fprintf('\n%s, pairwise comparison spike 1 vs. %i (opto):\n',...
- labels{2*(pre-1)+post-2},burstSpk)
- pval = pairedSampleTest(rawTransm{pre,post,1},rawTransm{pre,post,2},...
- 'labels',{'spike1',sprintf('spike%i',burstSpk)},'verbose',true);
- fprintf('Corrected p (Dunn-Sidak): %.4g\n',1 - (1-pval)^4);
- end
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig3g_SynapticFacilitationLog2.pdf','-dpdf','-r0')
- pos = get(f2,'Position');
- set(f2,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f2,'FigS3g_SynapticFacilitationLog2_opto.pdf','-dpdf','-r0')
- end
- clear locIDs globIDs presel postsel preinclude postinclude labels isRightPair...
- values f1 post pre ylab ylims pval pp rawTransm theseval
- %% S3a: Synaptic facilitation (CCG)
- prelabels = {'GC','MC','MEC'};
- postlabels = {'PV','SST'};
- printfig = true;
- preinclude = struct('putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct('putativeCellType',{'PV','SST'},'brainRegion',{'DG','DG'}); % Consider adding opto types extra
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- f1 = figure('Position',[100 10 500 980]); hold on; sp = 0;
- % Plot PSTH
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- % Get Proper IDs
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- values = mono_analysis.peak(isRightPair);
- [~,order] = sort(values,'ascend');
- PairIDs = find(isRightPair);
- for bb = 1:3
- sp = sp+1;
- thisccg = (mono_analysis.CCG(PairIDs(order),:,bb) -...
- mono_analysis.pred(PairIDs(order),:,bb)) .* 100; % Convert to percent
- ccgts = mono_analysis.ccgTimeStamps * 1e3; % Convert to ms
- subplot(6,3,sp);
- plim = [-1 3];
- % Plot PSTH
- imagesc(ccgts, linspace(plim(1), plim(2), size(thisccg,1)), thisccg);
- set(gca,'YDir','normal')
- xlim([-2 6]);
- xlabel('Time (ms)');
- colormap(bwyr);
- clim([plim(1) plim(2)]);
- % Overlay mean +/- SEM
- shadedErrorBar(ccgts, nanmean(thisccg,1), nanstd(thisccg,[],1)./sqrt(size(thisccg,1)),...
- 'lineProps',{'-','color',[0 0 0]});
- % Label with N;
- text(prctile(.002,55), plim(1)+ (plim(2)-plim(1))/10,...
- sprintf('N = %i',size(thisccg,1)),'Color','k')
- ylabel('Transm prob (%)')
- drawnow
- end
- end
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Burst_transmission_psth.pdf','-dpdf','-r0')
- end
- clear globIDs locIDs pre post presel postsel iRightPair f1 sp values...
- printfig pos f1 ccgts thisccg isRightPair order PairIDs plim...
- postinclude postlabels preinclude prelabels bb
- %% S3b: Connectivity table
- confrct = round(sum(mono_res.nEcon,3)./sum(mono_res.nEtotal,3)*100,2);
- array2table(confrct,'RowNames',labels,'VariableNames',labels)
- % Make heatmap
- figure('position',[100 100 220 175]); heatmap(log10(confrct(1:5,1:5)));
- colormap(bwyr); caxis([-1 .5]); % For color
- figure('position',[100 100 220 175]); heatmap(confrct(1:5,1:5)); % For values
- % Plot raw numbers / table to console for text
- fprintf('Number connected pairs, rows = pre, columns = post\n')
- array2table(sum(mono_res.nEcon,3),'RowNames',labels,'VariableNames',labels)
- fprintf('Total number simult recorded pairs, rows = pre, columns = post\n')
- array2table(sum(mono_res.nEtotal,3),'RowNames',labels,'VariableNames',labels)
- %% S3c: Facilitation over initial strength
- burstSpk = 2; % 2 or 3, normalized to first
- labels = {'PV','SST','GC','MC','MEC PC'}; % 'o' = opto! --
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = true;
- preinclude = struct(...
- 'putativeCellType',{'Granule Cell','Mossy Cell','Pyramidal Cell'},...
- 'brainRegion',{'DG','DG','ENTm'});
- postinclude = struct(...
- 'putativeCellType',{'PV','SST'},...
- 'brainRegion',{'DG','DG'},...
- 'groundTruthClassification',{'',''});
- % Sanity check, local ID's must be identical for pairs
- globIDs = class_metrics.putativeConnections.excitatory;
- locIDs = class_metrics.UID(class_metrics.putativeConnections.excitatory);
- if ~all(globIDs == mono_analysis.UIDs,'all')
- warning('Mismatch between batch_metrics and mono_analysis, do not continue!');
- return
- end
- % Get facilitation for desired pair types
- f1 = figure('position',[100 100 300 500]);
- for pre = 1:length(preinclude)
- [~,presel] = select_cells(class_metrics,'include',preinclude(pre));
- for post = 1:length(postinclude)
- [~,postsel] = select_cells(class_metrics,'include',postinclude(post));
- isRightPair = ismember(globIDs(:,1),presel) & ismember(globIDs(:,2),postsel);
- % Calculate facilitation
- rawTransm{pre,post,1} = mono_analysis.peak(isRightPair,1);
- rawTransm{pre,post,2} = mono_analysis.peak(isRightPair,burstSpk);
- theseval = rawTransm{pre,post,2}./rawTransm{pre,post,1};
- init{pre,post} = rawTransm{pre,post,1}(theseval>0 & ~isinf(theseval));
- theseval = theseval(theseval>0 & ~isinf(theseval)); % Remove negative transm prob
- fac{pre,post} = log2(theseval); % log2 transformation
- % Scatterplot initial strength vs facilitation
- subplot(3,2,post + (pre-1)*2); hold on
- scatter(init{pre,post}, fac{pre,post}, 4, colors(pre+2,:),...
- 'o','filled','MarkerFaceAlpha',.3);
- title(sprintf('%s-%s',labels{pre+2},labels{post}));
- % Pearson's R & Linear regression
- if ~isempty(init{pre,post})
- % Linear regression
- mxx = max(init{pre,post});
- mny = min(fac{pre,post});
- P = polyfit(init{pre,post},fac{pre,post},1); % m=P(1), b=P(2),
- plot([0 mxx], [P(2) P(2)+P(1)*mxx],'k:');
- % Pearson's R
- [R,pval] = corr(init{pre,post}, fac{pre,post});
- text(.5*mxx, .7*mny, sprintf(...
- 'R = %.2f\np = %.2g',R,pval),'FontSize',8);
- fprintf('%s-%s: R = %.2f p = %.3g, N = %i\n',labels{pre+2},...
- labels{post},R,pval,length(init{pre,post}))
- end
- end
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Facilitation_vs_initialStrength.pdf','-dpdf','-r0')
- end
- clear locIDs globIDs presel postsel preinclude postinclude labels isRightPair...
- values f1 post pre ylab ylims pval pp rawTransm theseval init fac...
- printfig pos f1
- %% S3d-g: Opto only
- % -- see above for 3d-g
- %% Figure 4
- %% Load place fields:
- linear = load_LinearBatch(batch_metrics);
- openfield = load_OpenfieldBatch(batch_metrics);
- radial = load_RadialBatch(batch_metrics);
- %% 4a(1) Linear place field examples
- [~,UIDs] = select_cells(class_metrics,'include',...
- struct('putativeCellType','SST interneuron','groundTruthClassification',{'SST+'}),...
- 'criteria',struct('SIsec1D',[0 Inf]));
- color = [0 .72 .53]; % [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7]
- printfig = false;
- %UIDs = 5521; printfig = true; % Example on the figure, comment out to cycle through others
- for n = 1:length(UIDs)
- batchID = class_metrics.batchIDs(UIDs(n));
- localUID = class_metrics.UID(UIDs(n));
- basepath = class_metrics.general.path{batchID};
- placefields = get_placeFieldsLinear('basepath',basepath);
- f1 = figure('position',[200 200 180 300]); %f1 = figure('position',[200 200 160 350]);
- subplot(2,1,1);
- plot_ACG(class_metrics,UIDs(n),'color',color);
- subplot(2,1,2);
- plot_placefield1D(localUID, placefields, 'xdim','distance');
- title(sprintf('%s-UID%i',class_metrics.sessionName{UIDs(n)},localUID));
- drawnow
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('LinearPFexample-%s-UID%i.pdf',...
- class_metrics.sessionName{UIDs(n)},localUID),'-dpdf','-r0')
- end
- clear basepath radial batchID localUID f1 pos printfig UIDs color placefields n
- %% 4a(2) + S4a-c Linear Spatial tuning parameters
- % Plot parameters
- fields = {'SIspk1D','SIsec1D','SpCoh1D','SesStab1D'}; %3b-c -- CONSIDER ADDING Min peak rate to criteria
- transformations = {'log10','log10','',''};
- printfig = true;
- % Cell selection
- labels = {'PV','SST','GC','MC','PV+','SST+',};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},'groundTruthClassification',{'','','','','PV+','SST+'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- criteria = struct('linearRateMean',repmat({[.5 Inf]},1,6));
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- fi = figure('position',[125 450 145*length(fields) 125]);
- for ff = 1:length(fields)
- % PLOTTING
- figure(fi);
- subplot(1,length(fields),ff);
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'splitgroups',[5 1; 6 2]);
- set(gca,'fontsize',6);
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,1:4),labels(1:4));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- end
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels,...
- 'transformation',transformations{ff});
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s, SVM types:',fields{ff});
- isSVM = cellfun(@(x) (any(x=={'PV','SST','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isSVM,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- fprintf('\nDG LMM statistics for %s, opto vs GC/MC:',fields{ff});
- isOpto = cellfun(@(x) (any(x=={'PV+','SST+','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isOpto,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- end
- % Save figure
- if printfig
- pos = get(fi,'Position');
- set(fi,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi,'Fig4a_Linear_spatialparams_svm_opto.pdf','-dpdf','-r0')
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations valTbl isSVM isOpto thisTbl
- %% 4b(1) Radial place field examples
- [~,UIDs] = select_cells(class_metrics,'include',...
- struct('putativeCellType','PV interneuron'),...%'groundTruthClassification',{'SST+'}),...
- 'criteria',struct('SIsecRadial',[0 Inf]));
- color = [.56 .39 .93]; % [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7]
- printfig = false;
- UIDs = 5985; printfig = true; % Example on the figure, comment out to cycle through others
- for n = 1:length(UIDs)
- batchID = class_metrics.batchIDs(UIDs(n));
- localUID = class_metrics.UID(UIDs(n));
- basepath = class_metrics.general.path{batchID};
- placefields = get_placeFieldsRadial('basepath',basepath);
- f1 = figure('position',[200 200 180 350]);
- subplot(2,1,1);
- plot_ACG(class_metrics,UIDs(n),'color',color);
- subplot(2,1,2);
- plot_placefieldRAD(localUID,placefields);
- title(sprintf('%s-UID%i',class_metrics.sessionName{UIDs(n)},localUID));
- drawnow
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('RadialPFexample-%s-UID%i.pdf',...
- class_metrics.sessionName{UIDs(n)},localUID),'-dpdf','-r0')
- end
- clear basepath radial batchID localUID f1 pos printfig UIDs color placefields n
- %% 4b(2) + S4d-f Radial Spatial tuning parameters
- % Plot parameters
- fields = {'SIspkRadial','SIsecRadial','SpCohRadial','SesStabRadial'};
- transformations = {'log10','log10','',''};
- printfig = false;
- % Cell selection
- labels = {'PV','SST','GC','MC','PV+','SST+',};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},'groundTruthClassification',{'','','','','PV+','SST+'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- criteria = struct('radialRateMean',repmat({[.5 Inf]},1,6));
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- fi = figure('position',[125 450 145*length(fields) 125]);
- for ff = 1:length(fields)
- % PLOTTING
- figure(fi);
- subplot(1,length(fields),ff);
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'overlaygroups',[5 1; 6 2]);
- set(gca,'fontsize',6);
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,1:4),labels(1:4));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- end
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels,...
- 'transformation',transformations{ff});
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s, SVM types:',fields{ff});
- isSVM = cellfun(@(x) (any(x=={'PV','SST','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isSVM,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- end
- % Save figure
- if printfig
- pos = get(fi,'Position');
- set(fi,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi,'Fig4b_Radial_spatialparams_svm_opto.pdf','-dpdf','-r0')
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations isSVM isOpto thisTbl valTbl
- %% 4c(1) Openfield place field examples
- [~,UIDs] = select_cells(class_metrics,'include',...
- struct('putativeCellType','Mossy Cell'),...%'groundTruthClassification',{'SST+'}),...
- 'criteria',struct('openfieldRatePeak',[1 Inf]));
- color = [.9 0 .7]; % [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7]
- printfig = false;
- UIDs = 3292; printfig = true; % Example on the figure, comment out to cycle through others
- for n = 1%:length(UIDs)
- batchID = class_metrics.batchIDs(UIDs(n));
- localUID = class_metrics.UID(UIDs(n));
- basepath = class_metrics.general.path{batchID};
- placefields = get_placeFieldsOF('basepath',basepath);
- f1 = figure('position',[200 200 180 350]);
- subplot(2,1,1);
- plot_ACG(class_metrics,UIDs(n),'color',color);
- subplot(2,1,2);
- plot_placefield2D(localUID,placefields);
- title(sprintf('%s-UID%i',class_metrics.sessionName{UIDs(n)},localUID));
- drawnow
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('OpenfieldPFexample-%s-UID%i.pdf',...
- class_metrics.sessionName{UIDs(n)},localUID),'-dpdf','-r0')
- end
- clear basepath radial batchID localUID f1 pos printfig UIDs color placefields n
- %% 4c(2) + S4g-i Openfield Spatial tuning parameters
- % Plot parameters
- fields = {'SIspk2D','SIsec2D','SpCoh2D','SesStab2D'}; %3b-c -- CONSIDER ADDING Min peak rate to criteria
- transformations = {'log10','log10','',''};
- printfig = false;
- % Cell selection
- labels = {'PV','SST','GC','MC','PV+','SST+',};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},'groundTruthClassification',{'','','','','PV+','SST+'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- criteria = struct('openfieldRateMean',repmat({[.5 Inf]},1,6));
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- fi = figure('position',[125 450 145*length(fields) 125]);
- for ff = 1:length(fields)
- % PLOTTING
- figure(fi);
- subplot(1,length(fields),ff);
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'splitgroups',[5 1; 6 2]);
- set(gca,'fontsize',6);
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,1:4),labels(1:4));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,[5 6 3 4]),labels([5 6 3 4]));
- end
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels,...
- 'transformation',transformations{ff});
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s, SVM types:',fields{ff});
- isSVM = cellfun(@(x) (any(x=={'PV','SST','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isSVM,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- fprintf('\nDG LMM statistics for %s, opto vs GC/MC:',fields{ff});
- isOpto = cellfun(@(x) (any(x=={'PV+','SST+','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isOpto,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- end
- % Save figure
- if printfig
- pos = get(fi,'Position');
- set(fi,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi,'Fig4c_Openfield_spatialparams_svm_opto.pdf','-dpdf','-r0')
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations isSVM isOpto thisTbl valTbl
- %% 4d: Place fields of converging pre synaptic partners on same post
- pre = 4; % 3 = GC, 4 = MC, 5 = MEC PC
- post = 1; % 1 = PV, 2 = SST (svm)
- fieldtype = 'linear'; % 'linear','radial','openfield'
- minpre = 8; % minimum number of converging partners
- minrate = 1;
- ratetype = 'firingRatePeak'; % 'firingRatePeak','firingRateMean'
- cell_types = {'PV','SST','Granule','Mossy','Pyramidal'}; % Do not use 3-5 as post!
- printfig = false;
- goodPost = find(contains(class_metrics.putativeCellType,cell_types{post})' &...
- mono_res.nEinInd(:,pre) >= minpre);
- % pairs = class_metrics.putativeConnections.excitatory(...
- % class_metrics.putativeConnections.excitatory(:,2) == post,:);
- for po = 1:length(goodPost)
- clear placefields
- postLocID = class_metrics.UID(goodPost(po));
- pairs = mono_res.EinInd{goodPost(po),pre};
- batchID = class_metrics.batchIDs(goodPost(po));
- metPath = [class_metrics.general.basepaths{batchID},filesep,...
- class_metrics.general.basenames{batchID} '.' fieldtype '.firingRateMap.mat'];
- % Load stuff
- if isfile(metPath); placefields = load(metPath,'linear'); placefields = placefields.linear; end
- % Continue if no placefields exist
- if ~exist('placefields','var'); continue; end
- % Remove pairs with low rates
- preLocIDs = class_metrics.UID(pairs(:,1));
- isGoodPre = any(placefields.(ratetype)(:,preLocIDs) > minrate, 1);
- pairs = pairs(isGoodPre, :);
- preLocIDs = preLocIDs(isGoodPre);
- % Continue if no placefields left
- if size(pairs,1) < minpre; continue; end
- f1 = figure('position',[50 50 300 65*size(pairs,1)]);
- for pr = 1:size(pairs,1)
- subplot(size(pairs,1),2,1 + (pr-1)*2);
- plot_placefield1D(preLocIDs(pr), placefields,'xdim','distance');
- xlabel('');
- set(gca,'FontSize',6);
- title(sprintf('%s %i',class_metrics.putativeCellType{pairs(pr,1)},pairs(pr,1)));
- end
- % Post: Linear PF
- subplot(size(pairs,1),2,2);
- plot_placefield1D(postLocID, placefields, 'xdim', 'distance')
- title(sprintf('%s %i',class_metrics.putativeCellType{goodPost(po)},goodPost(po)));
- xlabel('');
- set(gca,'FontSize',6);
- set(gcf,'Renderer','Painters');
- drawnow
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%i-_inputPlacefieldExample.pdf',goodPost(pp)),'-dpdf','-r0')
- end
- end
- clear post pairs fs pos cell_types pre printfig pos f1 pr po thisPre...
- batchID linpath radpath ofpath minrate ratetypes fieldtype goodPost...
- metPath minpre postLocID preLocIDs ratetype placefields isGoodPre
- %% 4e Histogram converging pair numbers per cell
- cell_types = {'PV','SST','Granule','Mossy','Pyramidal'}; % Do not use 3-5 as post!
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = true;
- hct = [];
- f1 = figure('position',[100 100 600 250]);
- for post = [1 2]
- subplot(1,2,post); hold on
- for pre = [4 3 5]
- isGoodPost{post} = find(contains(class_metrics.putativeCellType, cell_types{post}));
- %frct(end+1,:) = 100*histcounts(mono_res.nEinInd(isGoodPost,pre),0:22)./length(find(isGoodPost));
- hct(end+1,:) = histcounts(mono_res.nEinInd(isGoodPost{post},pre),0:22);
- histogram('BinEdges',(0:22), 'BinCounts',hct(end,:),...
- 'FaceColor',colors(pre,:),'EdgeColor',colors(pre,:),'FaceAlpha',.5);
- end
- set(gca,'YScale','log');
- ylabel('N pairs');
- xlabel('Partners per cell');
- set(gca,'FontSize',12);
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('NpresynPartnerHist.pdf'),'-dpdf','-r0')
- end
- end
- for pre = [3 4 5]
- [~,p] = unpairedSampleTest(mono_res.nEinInd(isGoodPost{1},pre),...
- mono_res.nEinInd(isGoodPost{2},pre),'labels',{'PV','SST'},'verbose',true);
- %fprintf('%s: PV vs. SST (N input per cell), p = %.4g\n',cell_types{pre},p)
- end
- clear hct isGoodPost cell_types pre post f1 pos p pre
- %% 4f: Place-field correlations between converging presynaptic cells
- % Run section 'Get converging...' above (preparations)
- % first! It runs through all sessions, but non-manual mono res are excluded
- % by 'include' criteria for both connected and unconnected pairs!
- % 1=PV(svm), 2=SST(svm), 3=GC, 4=MC, 5=MEC-PYR, 6=PV(opto), 7=SST(opto)
- labels = {'PV','SST','GC','MC','MEC PYR','PVo','SSTo'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; 1 0 0; 0 0 1];
- printfig = false;
- placefields = {linear,radial,openfield};
- pflabels = {'Linear','Radial','Openfield'};
- maxndots = 1000; % Downsample number of dots for distribution plots
- % Use peak rate (i.e. in place field)
- minrate = 1;
- ratetype = 'peakrates'; % 'meanrates','peakrates'
- pvals = NaN(3,5,7);
- for pre = [3 4 5] % 3 = GC, 4 = MC
- fprintf('\n%s:\n',labels{pre}) % For stats
- for post = [1 2 6 7] % 1,2 PV/SST (svm), 6,7 PV/SST (opto)
- for beh = [1 2 3] % Linear, Radial, Openfield
- ConvCorr{beh,post} = get_PlacefieldCorrelations(convg_res.Econv{pre,post},...
- placefields{beh},'minrate',minrate,'ratetype',ratetype);
- NonConvCorr{beh,post} = get_PlacefieldCorrelations(convg_res.Enoconv{pre,post},...
- placefields{beh},'minrate',minrate,'ratetype',ratetype);
- % Print stats
- fprintf('%s - %s, %s:\n',labels{pre},labels{post},pflabels{beh});
- try
- [~,pvals(beh,pre,post)] = unpairedSampleTest(...
- ConvCorr{beh,post},NonConvCorr{beh,post},...
- 'labels',{'convg','not convg'},'verbose',true);
- end
- end
- end
- % Two-half violin plot
- % Downsample dots
- for beh = 1:3
- for post = 1:7
- if length(NonConvCorr{beh,post})>maxndots
- NonConvCorrPl{beh,post} = randsample(NonConvCorr{beh,post},maxndots);
- else
- NonConvCorrPl{beh,post} = NonConvCorr{beh,post};
- end
- if length(ConvCorr{beh,post})>maxndots
- ConvCorrPl{beh,post} = randsample(ConvCorr{beh,post},maxndots);
- else
- ConvCorrPl{beh,post} = ConvCorr{beh,post};
- end
- end
- end
- % Controls (non-connected SVM pairs)
- f1 = figure('position',[200 100 200 200]); hold on;
- % Plot non-connected pair correlations (left half)
- % NoConnCorr{behavior type, cell type (1=PV,2=SST,6=optoPV,7=optoSST)}
- plotSpread(reshape(NonConvCorrPl([1 2 3],[1 2]),1,6),'spreadFcn',{'lin',8},...
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',1,...
- 'spreadOri','left','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(reshape(NonConvCorr([1 2 3],[1 2]),1,6),...
- 'histOri','left','color',[0 0 0],'widthDiv',[2 1],'showMM',6,...
- 'FaceAlpha',.5,'divFactor',2);
- % Connected opto Pairs (add as + on same plot)
- plotSpread(reshape(ConvCorrPl([1 2 3],[6 7]),1,6),'spreadFcn',{'lin',8},... % [sic!], use wider (10) spread here 2/2 lower n datapoints
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',3,...
- 'spreadOri','right','distributionMarkers','+');
- % Connected SVM pairs
- plotSpread(reshape(ConvCorrPl([1 2 3],[1 2]),1,6),'spreadFcn',{'lin',8},... % [sic!], use wider (10) spread here 2/2 lower n datapoints
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',1,...
- 'spreadOri','right','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(reshape(ConvCorr([1 2 3],[1 2]),1,6),...
- 'histOri','right','color',colors(pre,:),'widthDiv',[2 2],'showMM',6,...
- 'FaceAlpha',.5,'divFactor',2);
- ylabel('Placefield corr (R)');
- ylim([-1 1]);
- xticklabels({'PV Lin','PV Rad','PV OF','SST Lin','SST Rad','SST OF'});
- xtickangle(45);
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('Fig3-%s-pairs-placefieldcorr.pdf',labels{pre}),'-dpdf','-r0')
- end
- end
- % Dunn-Sidak Corrected p-values
- %pvals = reshape(HolmBonferroniCorr(pvals(:)'),size(pvals));
- pvals = multCompCorr(pvals,'method','Dunn-Sidak');
- for pre = [3 4 5]
- for post = [1 2 6 7]
- for beh = [1 2 3]
- fprintf('%s-%s: %s, p = %.4f\n',labels{pre},labels{post},...
- pflabels{beh},pvals(beh,pre,post));
- end
- end
- end
- clear f1 minrate placefields ratetype pre post labels colors printfig pflabels...
- ConvCorr NonConvCorr NonConvCorrPl ConvCorrPl pvals
- %% S4j-l: Spatial coding properties of GC and MC recruiting PV or SST IN
- % Cell selection etc.
- fields = {'SIspk1D','SIspkRadial','SIspk2D'};%,'SIsecRadial','SpCohRadial','SesStabRadial'};
- critfields = {'linearRateMean','radialRateMean','openfieldRateMean'};
- transformation = 'log10';
- printfig = true;
- % Cell selection
- labels = {'GC->PV','GC->SST','MC->PV','MC->SST'};
- include = struct('putativeCellType',{'Granule Cell','Granule Cell','Mossy Cell','Mossy Cell'},...
- 'groundTruthClassification',{'','','',''},'targets',{'PV','SST','PV','SST'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- colors = [.83 .78 .46; .83 .78 .46; .9 0 .7; .9 0 .7];
- % Create plot metrics, add .targetsSST and .targetsPV as metric tags
- M = class_metrics;
- econ = M.putativeConnections.excitatory;
- for n = 1:length(M.UID)
- targets = econ(econ(:,1)==n, 2);
- M.targets{n} = {''};
- if any(contains(M.putativeCellType(targets),'SST'))
- M.targets{n} = cat(2, M.targets{n}, {'SST'});
- end
- if any(contains(M.putativeCellType(targets),'PV'))
- M.targets{n} = cat(2, M.targets{n}, {'PV'});
- %cat(2,metrics.groundTruthClassification{id},{thislabel{id}});
- end
- % M.targetsSST(n) = any(contains(M.putativeCellType(targets),'SST'));
- % M.targetsPV(n) = any(contains(M.putativeCellType(targets),'PV'));
- end
- % PLOT
- fi = figure('position',[125 450 105*length(fields) 125]);
- for ff = 1:length(fields)
- figure(fi);
- subplot(1,length(fields),ff)
- criteria = struct(critfields{ff},[.5 Inf]);
- [~, valMtrx, ~] = plot_metricfield(M, fields{ff},...
- 'include',include,'exclude',exclude, 'criteria',criteria,...
- 'transformation',transformation,'tukeyFence',3,'labels',labels,...
- 'colors',colors);
- set(gca,'fontsize',6);
- set(gca,'YLim',[-2 1]);
- yticks([-2 -1 0 1]);
- yticklabels([.01 .1 1 10]);
- ylabel('SI (bits/spike)');
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx,labels);
- end
- % Save figure
- if printfig
- pos = get(fi,'Position');
- set(fi,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi,'SI_spk_PV_SST_targeting_cells.pdf','-dpdf','-r0')
- end
- clear M n targets econ valMtrx fi fields printfig include exclude criteria...
- colors transformation labels ff critfields
- %% Figure 5
- %% 5c DS PSTH including LII PYR
- labels = {'MECii PYR','DG pPV','DG pSST','DG GC','DG MC'};
- colors = [1 0 0; .56 .39 .93; .28 1 .7; .9 .9 .47; .9 0 .7];
- type = 'events'; % Manipulations, events
- field = 'DS2'; % 'DS2','CA3ripples'
- minRate = 0; minPrctile = 50; % Minimum percentile of bins during baseline above minRate
- printfig = false;
- % Create in- and exclude structure
- % include = struct('putativeCellType',{'Pyramidal Cell','Narrow Interneuron',...
- % 'Wide Interneuron','Granule Cell','Mossy Cell'},...
- % 'brainRegion',{'ENTm2','DG','DG','DG','DG'});
- include = struct('putativeCellType',{'Pyramidal Cell','PV interneuron',...
- 'SST interneuron','Granule Cell','Mossy Cell'},...
- 'brainRegion',{'ENTm2','DG','DG','DG','DG'});
- exclude = struct('tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- % DG plot
- %sel = 1:length(include); % 1:4
- f1 = figure('position',[200 20 180 180*length(include)]);
- [psth, psthNorm, ccgts] = plot_psth(class_metrics,field,'type',type,'labels',labels,...
- 'include',include,'exclude',exclude,...%'criteria',criteria(sel)
- 'orientation','column','SDrange',[-3 3],...
- 'colors',[0 0 0],'minRate',minRate,'minPrctile',minPrctile);
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('DS2_response.pdf'),'-dpdf','-r0')
- end
- f1 = figure('position',[400 20 200 200]);
- for cc = 1:length(include) % Use order of peak delay instead?
- shadedErrorBar(1e3*ccgts, nanmean(psthNorm{cc},1)-1.5*cc, nanstd(psthNorm{cc},[],1)./...
- sqrt(size(psthNorm{cc},1)),'lineProps',{'-','color',colors(cc,:)});
- % shadedErrorBar(ts, [0 diff(nanmean(psthNorm{cc},1))]-1*cc, nanstd(psthNorm{cc},[],1)./...
- % sqrt(size(psthNorm{cc},1)),'lineProps',{'-','color',colors(cc,:)});
- end
- xlim([-50 50]);
- xlabel('Time (ms)');
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('DS2_response_mean50ms.pdf'),'-dpdf','-r0')
- end
- clear include exclude f1 f2 printfig field pos sel type ds ts psth psthNorm...
- ccgts minPrctile cc colors labels minRate
- %% 5d Incl MEC: DS2_modulationPeakResponseTime
- % Plot parameters
- fields = {'DS2_modulationPeakResponseTime'}; % DS2_modulationSD
- transformations = {''}; % -- set 'divFactor' in distribution plot to "1" for peakResponse time!
- printfig = false;
- % Cell selection
- labels = {'MECii PC','PV','SST','GC','MC','PV+','SST+'};
- include = struct('putativeCellType',{'Pyramidal Cell','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},...
- 'groundTruthClassification',{'','','','','','PV+','SST+'},...
- 'brainRegion',{'ENTm2','DG','DG','DG','DG','DG','DG'});
- exclude = struct('tags',{{'Bad','InverseSpike'}});
- criteria = struct('DS2_modulationRatio',[1.5 Inf]);
- colors = [1 0 0; .56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- for ff = 1:length(fields)
- % PLOTTING
- fi{ff} = figure('position',[200*ff 450 150 130]); % Same aspect ratio
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'splitgroups',[6 2; 7 3],'plottype','violin',...
- 'divFactor',1);
- set(gca,'fontsize',6);
- xlim([.25 5.75]);
- % Save figure
- if printfig
- pos = get(fi{ff},'Position');
- set(fi{ff},'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi{ff},sprintf('Fig5d_%s_svm_opto.pdf',fields{ff}),'-dpdf','-r0')
- end
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,1:5), labels(1:5));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,[1 6 7 4 5]), labels([1 6 7 4 5]));
- end
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels);
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s, SVM types:',fields{ff});
- isSVM = cellfun(@(x) (any(x=={'PV','SST','MECii PC','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isSVM,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- fprintf('\nDG LMM statistics for %s, opto vs GC/MC:',fields{ff});
- isOpto = cellfun(@(x) (any(x=={'PV+','SST+','MECii PC','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isOpto,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- end
- % Plot numbers to console
- fprintf('\nLatency to Dentate Spike (ms)\n');
- for ct = 1:length(include)
- % fprintf('%s firing rate: %.2f +/- %.2f (mean +/- STD)\n',labels{ct},...
- % nanmean(valMtrx(:,ct)), nanstd(valMtrx(:,ct)))
- fprintf('%s Latency: Median %.2f (%.2f - %.2f IQR)\n',labels{ct},...
- 1e3*nanmedian(valMtrx(:,ct)), 1e3*prctile(valMtrx(:,ct),25),...
- 1e3*prctile(valMtrx(:,ct),75))
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations valTbl thisTbl isSVM isOpto
- %% 5e Incl MEC: DS2_modulationRatio
- % Plot parameters
- fields = {'DS2_modulationRatio'}; % DS2_modulationSD
- transformations = {'log2'}; % -- set 'divFactor' in distribution plot to "1" for peakResponse time!
- printfig = true;
- % Cell selection
- labels = {'MECii PC','PV','SST','GC','MC','PV+','SST+'};
- include = struct('putativeCellType',{'Pyramidal Cell','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell','',''},...
- 'groundTruthClassification',{'','','','','','PV+','SST+'},...
- 'brainRegion',{'ENTm2','DG','DG','DG','DG','DG','DG'});
- exclude = struct('tags',{{'Bad','InverseSpike'}});
- criteria = struct('UID',[0 Inf]);
- %[criteria.radialRatePeak] = deal([1 Inf]); % Specific exclusion criteria here
- colors = [1 0 0; .56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- for ff = 1:length(fields)
- % PLOTTING
- fi{ff} = figure('position',[200*ff 450 150 130]); % Same aspect ratio
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,'criteria',criteria,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',labels,...
- 'colors',colors,'splitgroups',[6 2; 7 3],'plottype','violin',...
- 'divFactor',1);
- set(gca,'fontsize',6);
- xlim([.25 5.75]);
- % Save figure
- if printfig
- pos = get(fi{ff},'Position');
- set(fi{ff},'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(fi{ff},sprintf('Fig5e_%s_svm_opto.pdf',fields{ff}),'-dpdf','-r0')
- end
- % ANOVA for SVM classified neurons
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,1:5), labels(1:5));
- % ANOVA for optotagged cells only
- if ~all(isnan(valMtrx(:,5:6)),'all')
- fprintf('\nDG statistics for %s, opto vs GC/MC:',fields{ff});
- kruskalwallisNdunns(valMtrx(:,[1 6 7 4 5]), labels([1 6 7 4 5]));
- end
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'labels',labels,...
- 'transformation',transformations{ff});
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s, SVM types:',fields{ff});
- isSVM = cellfun(@(x) (any(x=={'PV','SST','MECii PC','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isSVM,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- fprintf('\nDG LMM statistics for %s, opto vs GC/MC:',fields{ff});
- isOpto = cellfun(@(x) (any(x=={'PV+','SST+','MECii PC','GC','MC'})), table2cell(valTbl(:,2)));
- thisTbl = valTbl(isOpto,:);
- thisTbl.Group = removecats(thisTbl.Group); % Remove unused categories
- glme_stats(thisTbl);
- end
- clear include exclude criteria valGrp valMtrx valCell fields transformation...
- sel fi printfig ff colors labels pos transformations
- %% 5c-f DS rate responses to opto manipulations
- % Control in / out of stim DS
- % ts = randsample(DS2.timestamps(:,1),2000);
- % ts2 = DS2.timestamps(InIntervals(DS2.timestamps(:,1),opto_1sec.timestamps),1);
- % ts3 = DS2.peaks(InIntervals(DS2.peaks(:,1),opto_1sec.timestamps));
- % bz_multishankEventCSD(ts,'window',[-.1 .1]);
- ChRmice = {'SST2','SST4','YutaMouse20','YutaMouse21','YutaMouse37','YutaMouse38',...
- 'YutaMouse39','YutaMouse40','PV1','PV3','PV5','PV16','PV18','PV19','PV21','PV29'};
- HRmice = {'PV13','PV22','SST3','SST5'};
- n = 0;
- minPrctile = 10; % Minimum fraction of bins that is >0
- evname = 'DS2'; % 'DS2','CA3ripples','ripples'
- opsins = {'ChR2','eNpHR'};
- lines = {'PV','SST'};
- % GET DATA
- clear results
- for ds = 1:length(handle)
- basename = handle(ds).basename;
- basepath = handle(ds).basepath;
- if isfile(fullfile(basepath,filesep,[basename '.' evname '.events.mat'])) &&...
- isfile(fullfile(basepath,filesep,[basename '.opto_1sec.manipulation.mat']))
- evt = load(fullfile(basepath,filesep,[basename '.' evname '.events.mat']),evname);
- evt = evt.(evname);
- load(fullfile(basepath,filesep,[basename '.opto_1sec.manipulation.mat']))
- [thisCCG, PSTHts] = CCG({opto_1sec.timestamps(:,1),evt.peaks},[],...
- 'binSize',.05,'duration',4,'norm','rate');
- if ~prctile(thisCCG(:,1,2),100-minPrctile) > 0
- % Exclude session if little or no DS detected.
- continue
- end
- n = n+1;
- results(n).name = basename;
- results(n).PSTH = thisCCG(:,1,2);
- results(n).ts = PSTHts;
- results(n).stimrate = mean(thisCCG(InIntervals(PSTHts,[0 1]),1,2));
- results(n).baserate = mean(thisCCG(~InIntervals(PSTHts,[0 1]),1,2));
- results(n).pctchg = results(n).stimrate / results(n).baserate;
- % Get genetic Line
- if contains(handle(ds).basename,'PV')
- results(n).geneticLine = 'PV-Cre';
- else
- results(n).geneticLine = 'SST-Cre';
- end
- % Get opsin
- if any(strcmp(handle(ds).animal, ChRmice))
- results(n).opsin = 'ChR2';
- elseif any(strcmp(handle(ds).animal, HRmice))
- results(n).opsin = 'eNpHR';
- end
- else
- fprintf('%s does not have all files, continue...\n',basename);
- end
- end
- % PLOT FIGURE
- figure('position',[200 50 270 800]);
- for op = 1:2
- for li = 1:2
- isSes = contains({results.geneticLine},lines{li}) &...
- contains({results.opsin},opsins{op});
- allPSTH = cat(2,results(isSes).PSTH);
- plID = 1 + 3*(li-1) + 6*(op-1);
- subplot(4, 3, plID:plID+1)
- hold on;
- % Baseline normalization / zscoring
- isBsl = InIntervals(results(1).ts,[-1 0]); % Assume uniform timestamps
- allPSTHz = (allPSTH - mean(allPSTH(isBsl,:),1)) ./ std(allPSTH(isBsl,:),[],1);
- % PSTH (BSL-ZSCORED) & TIMECOURSE (HZ)
- imagesc(results(1).ts, linspace(0,1,size(allPSTHz,1)), allPSTHz'); % Keeping y-range simple 0-1 Hz is a good range
- colormap(bwyr);%'hot');
- caxis([-4 4]);
- set(gca,'YDir','normal')
- % Overlay mean (Hz)
- %plot(results(1).ts, mean(allPSTH,2), 'k', 'lineWidth',1);
- shadedErrorBar(results(1).ts, mean(allPSTH,2), std(allPSTH,[],2)./sqrt(length(find(isSes))));
- % Label with N;
- unitstr = sprintf('N = %i',length(find(isSes)));
- text(prctile(results(1).ts,70), .1, unitstr,'Color','k') % gn-gn/15
- title(sprintf('%s-%2',lines{li},opsins{op}));
- xlabel('Time from Stim (s)');
- xlim([-1 2]);
- ylabel(sprintf('%s rate (Hz)',evname));
- % BOXPLOTS
- subplot(4,3,plID+2);
- hold on;
- plot(cat(1,[results(isSes).baserate],[results(isSes).stimrate]),'color',[0 0 0 .5],'LineWidth',1);
- boxplot(cat(1,[results(isSes).baserate],[results(isSes).stimrate])','symbol', '');
- xticklabels({'Pre','Stim'});
- ylim([0 1]);
- % STATISTICS
- fprintf('%s - %s, opto 1 sec DS rate\n',lines{li},opsins{op});
- pairedSampleTest([results(isSes).baserate],[results(isSes).stimrate],...
- 'labels',{'Baseline','Stim'},'verbose',true);
- changes{op,li} = 100*[results(isSes).pctchg];
- end
- end
- % ChR reduction numbers & comparison (text)
- fprintf('\nPV-ChR DS rate stim/bsl: %.2f +/- %.2f; SST-ChR DS rate stim/bsl: %.2f +/- %.2f\n',...
- nanmean(changes{1,1}), nanstd(changes{1,1}), nanmean(changes{1,2}), nanstd(changes{1,2}));
- unpairedSampleTest(changes{1,1},changes{1,2},'verbose',true);
- clear PSTHts n thisCCG Epath sess DS2 pulses mouse a animals Ebase sf subf...
- allPSTH ChRmice HRmice li op lines opsins allPSTHz basename basepath...
- ds evname evt isBsl isSes minPrctile opto_1sec plID unitstr changes
- %% Supplementary 5a(1) theta CSD
- % DS and Theta CSD, see LFP_analysis/LFP_scripts and Analysis/LFP folder in
- % each dataset for code and figures, respectively.
- %% Supplementary 5a(2) Theta-gamma CFC
- % see LFP_analysis/LFP_scripts
- % Load session.mat and Analysis/LFP/.THetaGammaCFC.mat e.g. from
- % TH15_220706
- spkg = [5 11 12];
- figure('position',[100 100 1400 300]); hold on
- for sh = 1:length(spkg)
- cfcg = CFC.comod(:,:,session.extracellular.spikeGroups.channels{spkg(sh)});
- cfcg = reshape(cfcg,size(cfcg,1),[]);
- subplot(1,length(spkg),sh);
- contourf(CFC.amp_bincenters, 1:size(cfcg,2), flipud(cfcg'), 40, 'LineColor','none');
- colormap(jet);
- clim([0 1e-3]);
- end
- clear shanks sh
- %% Supplementary 5b: DS2 modulation Lii vs. Liii MEC
- type = 'events'; % Manipulations, events
- field = 'DS2'; % 'DS2','CA3ripples'
- metrics = class_metrics; % batch_metrics;
- minRate = 0; minPrctile = 50; % Minimum percentile of bins during baseline above minRate
- printfig = false;
- % Create in- and exclude structure
- include = struct('brainRegion',{'ENTm2','ENTm2','ENTm3','ENTm3'},...
- 'putativeCellType',{'Pyramidal','Interneuron','Pyramidal','Interneuron'});
- labels = {'Lii PYR','Lii IN','Liii PYR','Liii IN'};
- colors = [1 0 0; 0 0 1; 1 1 0; 0 1 1];
- sel = 1:length(include); % 1:4
- % include = struct('putativeCellType',cell_types,'groundTruthClassification',incl_opto);
- % exclude = struct('groundTruthClassification',excl_opto);
- % PSTH
- f1 = figure('position',[200 20 150 180*length(sel)]);
- plot_psth(metrics,field,'type',type,'labels',labels(sel),...
- 'include',include(sel),...%'exclude',exclude(sel),'criteria',criteria(sel),...
- 'orientation','column','SDrange',[-3 3],'overlay',true,...
- 'colors',[0 0 0],'minRate',minRate,'minPrctile',minPrctile); %colors(sel,:)
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('DS2_response_MEC.pdf'),'-dpdf','-r0')
- end
- % PIE CHARTS
- f2 = figure('position',[400 20 200 180*length(sel)]);
- plot_response_piechart(metrics,'field','DS2','labels',labels(sel),'alpha',.001,...
- 'include',include(sel));%,'exclude',exclude(sel),'criteria',criteria(sel));
- if printfig
- pos = get(f2,'Position');
- set(f2,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f2,sprintf('DS2_response_MECpie.pdf'),'-dpdf','-r0')
- end
- clear include exclude f1 f2 printfig field pos sel type ds ts psth psthNorm metrics
- %% Supplementary 5c: MEC brain-state-dependent firing rates
- printfig = false;
- % Create in- and exclude structure
- labels = {'MECii PC','MECii IN','MECiii PC','MECiii IN'};
- %limrate = [8 40 8 40]; % Hard coding here, no easy fix...
- %limrate = [-.5 1.2; -.5 2; -.5 1.2; -.5 2]; Log10
- limrate = [0 8; 0 40; 0 8; 0 40]; % Linear
- include = struct('brainRegion',{'ENTm2','ENTm2','ENTm3','ENTm3'},...
- 'putativeCellType',{'Pyramidal','Interneuron','Pyramidal','Interneuron'});
- exclude = struct('putativeCellType',repmat({'Unknown'},1,4),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,4));
- colors = [1 0 0; 0 0 1; 1 0 0; 0 0 1];
- f1 = figure('position',[100 100 1250 200]);
- for ct = 1:4
- [~,cellIDs] = select_cells(class_metrics,'include',include(ct),'exclude',exclude(ct));
- rates = cat(1, class_metrics.firingRateWake(cellIDs),...
- class_metrics.firingRateNREM(cellIDs), class_metrics.firingRateREM(cellIDs));
- % rates = log10(rates);
- rates = rates(:,~any(isnan(rates),1));
- figure(f1)
- ax(ct) = subplot(1,4,ct); hold(ax(ct),'on');
- % Make rates heatmap in background
- [~,order] = sort(rates(1,:));
- imagesc(1:3, linspace(limrate(ct,1), limrate(ct,2), size(rates,2)), rates(:,order)');
- colormap(bwyr);
- colorbar
- %clim([0 prctile(rates(:),98)]);
- clim([limrate(ct,1) limrate(ct,2)]);
- % % Plot lines
- % plot(rates,'color',[0 0 0 .1],'LineWidth',.3);
- % Plot boxes
- boxplot(rates','symbol', '');
- h = findobj('LineStyle','--'); set(h, 'LineStyle','-');
- h = findobj(gca,'Tag','Box');
- for j=1:length(h)
- patch(get(h(j),'XData'),get(h(j),'YData'),colors(ct,:),'FaceAlpha',.7);
- end
- % Markup
- title(labels{ct});
- ylabel('Firing Rate (Hz)');
- % yticklabels('');
- xticklabels({'Wake','NREM','REM'});
- xtickangle(45);
- ylim([limrate(ct,1) limrate(ct,2)]);
- % else
- % % subplot(1,4,ct-4);
- % % Just add lines for opto-positive cells
- % plot(ax(ct-4),rates,'color',[colors(ct,:) .25],'LineWidth',.5);
- % end
- % Stats (repeated measures ANOVA on ranks)
- fprintf([labels{ct} '\n'])
- kruskalwallisNdunns(rates',{'Wake','NREM','REM'});
- % TODO: Log transform and repeated measures
- %rates = rates(:,~any(rates == 0,1)); % Remove zeros to avoid prob w/ log transform
- %rates = log10(rates);
- %rates = array2table(rates','VariableNames',{'Wake','NREM','REM'});
- %anovan(rates);
- end
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('StateRates_psth.pdf'),'-dpdf','-r0')
- end
- clear ct h field j rates f1 wi order pos printfig ax cellIDs colors exclude...
- include labels limrate
- %% Figure 6
- %% 6a,c PSTH 1 sec pulses - row-wise, all, include direct-activated cells
- % TODO: Run class_metrics = reclassifyOptoResponses2(class_metrics); prior
- % to this! -- make sure addAmbiguousResponse was run
- type = 'manipulations'; % Manipulations, events
- field = 'opto_1sec'; %'opto_chirp_freq','opto_1sec'
- sortCriterion = '_modulationSD'; % '_modulationSD' (default) or '_peakFreq' for chirp
- baseline = [-Inf -.005]; % [-Inf 0] standard, [4 40] for freq
- lines = {'PV-Cre','SST-Cre'};
- opsins = {'eNpHR','ChR2'};%'eNpHR' 'ChR2'
- printfig = true;
- minRate = 0; minPrctile = 1; % Minimum percentile of bins during baseline above minRate
- % Create in- and exclude structure
- %labels = {'PV','SST','GC','MC'};
- include = struct('putativeCellType',{'','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'}, 'brainRegion','DG',...
- 'groundTruthClassification',cat(2,{'+'},repmat({''},1,4)));
- exclude = struct('groundTruthClassification',cat(2,{''},repmat({{'+','~'}},1,4)),... % {{'+'}},{{'+','~'}}
- 'tags',repmat({{'Bad','InverseSpike'}},1,5),'putativeCellType',repmat({'Unknown'},1,5));
- % Plot
- f1 = figure('position',[200 200 600 550]);
- for op = 1:2
- [include.labels] = deal(opsins{op});
- for li = 1:2
- [include.geneticLine] = deal(lines{li});
- for ct = 1:5
- subplot(4,5,ct + 5*(li-1) + 10*(op-1));
- plot_psth(class_metrics,field,'type',type,'labels',{''},...%labels(ct),...
- 'include',include(ct),'exclude',exclude(ct),...
- 'colors',[0 0 0],'minRate',minRate,'minPrctile',minPrctile,... %'colors',colors(sel,:)
- 'sortCriterion',sortCriterion,'baseline',baseline,'shadedErrorBar',false);
- if ~(op == 2 && li == 2); xlabel(''); end
- if ~(ct == 1); ylabel(''); end
- end
- end
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1, '1secPSTH_all.pdf','-dpdf','-r0')
- end
- clear include exclude f1 f2 printfig field pos sel type ds ts psth psthNorm ct li op...
- lines opsins include exclude minRate minPrctile sortCriterion
- %% 6b,d Firing rate ratio during / pre 1 sec pulses (PV vs. SST)
- fields = {'opto_1sec_modulationRatio'}; % 4c,d 'DS2_modulationSD','opto_1sec_modulationSD','opto_1sec_modulationIndex'
- transformations = {'log2'}; % 4c,d -- set 'divFactor' in distribution plot to "1" for peakResponse time!
- opsin = 'eNpHR'; % 'eNpHR' for b), 'ChR' for d)
- printfig = false;
- % Create in- and exclude structure
- labels = {'PV-Cre','SST-Cre'};
- statlabels = cat(1,strcat({'PV','SST','GC','MC'},'-',labels{1}),...
- strcat({'PV','SST','GC','MC'},'-',labels{2}));
- include = struct('putativeCellType',{'PV','PV','SST','SST',...
- 'Granule','Granule','Mossy','Mossy'});
- [include(1:2:end).geneticLine] = deal('PV-Cre');
- [include(2:2:end).geneticLine] = deal('SST-Cre');
- [include.labels] = deal(opsin);
- exclude = struct('groundTruthClassification',{{'+','~'}},...
- 'tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- for ff = 1:length(fields)
- % Plotting
- f1 = figure('position',[200*ff 450 200 230]); % Same aspect ratio
- hold on
- [~, valMtrx, ~] = plot_metricfield(class_metrics,fields{ff},...
- 'include',include,'exclude',exclude,...
- 'transformation',transformations{ff},'tukeyFence',3,'labels',repmat(labels,1,4),...
- 'colors',colors([1 1 2 2 3 3 4 4],:),'plottype','violin',...
- 'divFactor',1);
- % Zero-line
- plot([0 length(include)+1],[0 0],':','color',[.5 .5 .5]);
- % Statistics
- fprintf('\nDG statistics for %s, SVM types:',fields{ff});
- kruskalwallisNdunns(valMtrx,strcat(repmat(...
- {'PV-Cre:','SST-Cre:'},1,4),{include.putativeCellType}));
- % LMM nested data stats (SVM & Opto separately)
- valTbl = get_metricfieldTbl(class_metrics, fields{ff}, 'include',include,...
- 'exclude',exclude, 'labels',statlabels(:), 'transformation',transformations{ff});
- %glme_stats(valTbl)
- fprintf('\nDG LMM statistics for %s:',fields{ff});
- glme_stats(valTbl);
- end
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('Fig6b+d_%s_1sec_ratioViolin.pdf',opsin),'-dpdf','-r0')
- end
- clear include exclude thiscriteria values fields transformations valCell...
- valGrp valMtrx ff opsin colors labels f1 pos
- %% 6e,f + S8a-d: 1 sec single-trial Lorenz Curves, gini-diff & CV
- % Create in- and exclude structure
- printfig = false;
- labels = {'PV-HR','SST-HR','PV-ChR','SST-ChR'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'});
- %exclude = struct('groundTruthClassification',{{'+'},{'+'},{'+'},{'+'}});
- exclude = struct('groundTruthClassification',{{'+','~'}},...
- 'tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- lines = {'PV-Cre','SST-Cre'};
- opsins = {'eNpHR','ChR2'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- fields = {'gini','CV'}; % For errorbar plots (diff stim vs bsl)
- % Get Lorenz curves, gini, CV
- if ~exist('LorRes','var') % Takes long to load
- for li = [1 2] % PV-Cre / SST-Cre
- [include.geneticLine] = deal(lines{li});
- for op = [1 2] % eNpHR / ChR
- [include.labels] = deal(opsins{op});
- fprintf('%s, %s\n',lines{li},opsins{op});
- LorRes{li,op} = get_1sec_Lorenz_Curves(class_metrics,...
- 'include',include,'exclude',exclude,'show_results',false,...
- 'minNspikes',1, 'minNcells',4);
- end
- end
- end
- % LORENZ CURVES
- f1= figure('position',[100 100 500 450]); hold on;
- for li = 1:2
- for op = 1:2
- for ct = 1:length(include)
- subplot(4,length(include),ct + (op-1)*length(include) + (li-1)*2*length(include))
- % Plot eNpHR results
- plot([0 100],[0 1],':','color',[.5 .5 .5]);
- nSess = length(find(LorRes{li,op}.nCells(:,ct)>0));
- shadedErrorBar(1:100, nanmean(LorRes{li,op}.MeanLorenzCurveNorm(:,:,ct,1),1),...
- nanstd(LorRes{li,1}.MeanLorenzCurveNorm(:,:,ct,1),1)./sqrt(nSess),...
- 'lineprops',{'color',colors(ct,:)});
- shadedErrorBar(1:100, nanmean(LorRes{li,op}.MeanLorenzCurveNorm(:,:,ct,2),1),...
- nanstd(LorRes{li,1}.MeanLorenzCurveNorm(:,:,ct,2),1)./sqrt(nSess),...
- 'lineprops',{'color',[.5 .5 .5]});
- text(10,.8,sprintf('%s\n%s',lines{li},opsins{op}),'FontSize',8);
- drawnow
- end
- end
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig_6e_S7a_LorenzCurves.pdf','-dpdf','-r0')
- end
- % PLOT GINI, CV, ETC
- for ff = 1:2
- % GET VALUES
- stvals = cat(1, LorRes{1,1}.(fields{ff})(:,:,1), LorRes{2,1}.(fields{ff})(:,:,1),...
- LorRes{1,2}.(fields{ff})(:,:,1), LorRes{2,2}.(fields{ff})(:,:,1)); % To sort by condition, cat(2,... and omit reshape
- blvals = cat(1, LorRes{1,1}.(fields{ff})(:,:,2), LorRes{2,1}.(fields{ff})(:,:,2),...
- LorRes{1,2}.(fields{ff})(:,:,2), LorRes{2,2}.(fields{ff})(:,:,2));
- stvals = reshape(stvals, size(LorRes{1,1}.gini,1), length(include)*length(lines)*length(opsins));
- blvals = reshape(blvals, size(LorRes{1,1}.gini,1), length(include)*length(lines)*length(opsins));
- % RAW VALUES (DUAL VIOLIN PLOTS)
- figure('position',[100 100 500 150]); hold on;
- % baseline (left, grey)
- plotSpread(blvals,'spreadFcn',{'lin',10},...
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',3,...
- 'spreadOri','left','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(blvals,'histOri','left','color',[0 0 0],...
- 'widthDiv',[2 1],'showMM',6,'FaceAlpha',.5);
- % Stim (right)
- plotSpread(stvals,'spreadFcn',{'lin',10},... % [sic!], use wider (10) spread here 2/2 lower n datapoints
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',3,...
- 'spreadOri','right','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(stvals,'histOri','right','color',num2cell(colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:),2),...
- 'widthDiv',[2 2],'showMM',6,'FaceAlpha',.5);
- %ylim([.4 1.1]);
- ylabel(fields{ff});
- % STIM-BSL DELTA PLOT
- f1 = figure('position',[100 100 400 250]); hold on;
- % distributionPlot(stvals-blvals,'showMM',6,'FaceAlpha',.5,'histOpt',1,'divFactor',1,...
- % 'color',num2cell(colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:),2));
- plot([0 size(stvals,2)+1],[0 0],'--','Color',[.5 .5 .5]); % Zero line
- plotSpread(stvals-blvals,'spreadFcn',{'lin',5},...
- 'spreadWidth',.9,'distributionColors',[0 0 0],'distributionMarkerSize',4,...
- 'distributionMarkerAlpha',1,'distributionMarkers','o');
- customErrorBar(stvals-blvals, 'errtype','STD', 'alpha',.7,...
- 'markerSize',100, 'LineWidth',1.2,...
- 'colors',colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:));
- xlim([0 size(stvals,2)+1]);
- %ylim([-.3 .4]);
- ylabel(sprintf('%s (stim-bsl)',fields{ff}));
- xticklabels(repmat(labels,1,4));
- xtickangle(45);
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('Opto_1sec_%s_change.pdf',fields{ff}),'-dpdf','-r0')
- end
- % STATISTICS
- for ct = 1:length(include)
- clear blvals stvals groupVals
- % Statistics @console
- fprintf('\n%s:',include(ct).putativeCellType)
- fprintf('\n%s (raw p):\n',fields{ff}) % For statistics in console
- for li = 1:2
- for op = 1:2
- blvals(:,li,op) = LorRes{li,op}.(fields{ff})(:,ct,2); % nSess x nGroup(ct) x [1 (stim) 2 (bsl)]
- stvals(:,li,op) = LorRes{li,op}.(fields{ff})(:,ct,1);
- try
- pvals(ct,li,op) = pairedSampleTest(blvals(:,li,op), stvals(:,li,op),...
- 'labels',{'baseline','stim'},'verbose',true);
- catch
- pvals(ct,li,op) = NaN;
- fprintf('\n');
- end
- end
- end
- % ANOVA
- groupVals = reshape(stvals-blvals, size(stvals,1), size(stvals,2)*size(stvals,3));
- fprintf('%s ANOVA:\n',fields{ff})
- kruskalwallisNdunns(groupVals, labels);
- end
- % Multi-Comparison Corrected p-values
- padj = multCompCorr(pvals,'method','Dunn-Sidak'); % 'Holm-Bonferroni', 'Dunn-Sidak'
- fprintf('%s (adjusted p-values):\n',fields{ff});
- for op = [1 2]
- for li = [1 2]
- for ct = 1:length(include)
- fprintf('%s-%s: %s (stim vs. bsl), p = %.4g\n',lines{li}, opsins{op},...
- include(ct).putativeCellType, padj(ct,li,op));
- end
- end
- end
- end
- clear labels include exclude lines opsins li ct op f1 f2 colors color...
- limrate pvals ncolors labels baseMLD stimMLD isGoodID baserates blvals...
- stimrates stvals f1 fields ff pos nSess printfig
- %% 6g + S6k: Scatter baseline vs. stim rates & Correlation
- % Create in- and exclude structure
- labels = {'PV','SST','GC','MC'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'});
- %exclude = struct('groundTruthClassification',{{'+'},{'+'},{'+'},{'+'}});
- exclude = struct('groundTruthClassification',{{'+','~'}},...
- 'tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- lines = {'PV-Cre','SST-Cre'};
- opsins = {'eNpHR','ChR2'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- printfig = true;
- f1 = figure('position',[100 150 600 600]);
- % Plot Lorenz curves
- for li = [1 2] % PV-Cre / SST-Cre
- [include.geneticLine] = deal(lines{li});
- for op = [1 2] % eNpHR / ChR
- [include.labels] = deal(opsins{op});
- for ct = 1:length(include)
- [~,baserates{ct,li,op},~] = get_metricfield(class_metrics,...
- 'firingRate',... % 'firingRate', opto_1sec_baseRate
- 'include',include(ct),'exclude',exclude,'omitnan',false,...
- 'tukeyFence',Inf);
- [~,stimrates{ct,li,op},~] = get_metricfield(class_metrics,...
- 'opto_1sec_modulationRatio','include',include(ct),...
- 'exclude',exclude,'omitnan',false,'tukeyFence',Inf);
- stimrates{ct,li,op} = stimrates{ct,li,op}.* baserates{ct,li,op};
- baserates{ct,li,op} = baserates{ct,li,op}(...
- ~isnan(stimrates{ct,li,op}) & ~isinf(stimrates{ct,li,op}));
- stimrates{ct,li,op} = stimrates{ct,li,op}(...
- ~isnan(stimrates{ct,li,op}) & ~isinf(stimrates{ct,li,op}));
- % PLOT Rate scatter
- figure(f1);
- subplot(4,4,op+(ct-1)*4+(li-1)*2); hold on
- title(sprintf('%s %s, %s',labels{ct},lines{li},opsins{op}))
- scatter(baserates{ct,li,op},stimrates{ct,li,op},...
- 3, colors(ct,:), 'o', 'filled', 'MarkerFaceAlpha',.5);
- set(gca,'XScale','log');
- set(gca,'YScale','log');
- xlim([1e-3 1e2])
- ylim([1e-3 1e2])
- if ct == 4; xlabel('Bsl Rate (log)'); end
- if li==1 & op == 1; ylabel('Stim Rate (log)'); end
- set(gca,'fontsize',10);
- drawnow
- clear plotrates baseplot stimplot
- if ~isempty(baserates{ct,li,op})
- [R,pval] = corr(baserates{ct,li,op}, stimrates{ct,li,op});
- text(1e-2,1e-2,sprintf(...
- 'R = %.2f\np = %.2g',R,pval),'FontSize',10);
- fprintf('%s-%s, %s: R = %.2f p = %.4g, N = %i\n',lines{li},...
- opsins{op},labels{ct},R,pval,length(baserates{ct,li,op}))
- end
- end
- end
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'Fig6g_FigS8g_BslStimRateScatter.pdf','-dpdf','-r0')
- end
- clear labels include exclude lines opsins li ct op f1 f2 colors color...
- limrate pvals ncolors labels baseMLD stimMLD isGoodID baserates blvals...
- stimrates stvals
- %% Suppl 6a Examples of direct and indirect light-responsive cells
- % direct: PV3_230502 UID 108 (pPV, PV+); indirect: PV1_230426, UID 4 (MC)
- % Load cell_metrics, spikes, opto_1sec
- color = colors(1,:); % 4=MC, 1 = pPV
- UID = 108;
- printfig = true;
- % ACG
- acgT = cell_metrics.general.ccg_time;
- acgBinSz = mean(diff(acgT));
- acgEdg = [acgT-acgBinSz/2; acgT(end)+acgBinSz/2]';
- % Plot ACG
- f1 = figure('position',[200 200 400 215]);
- subplot(1,2,1); hold on;
- histogram('BinEdges',acgEdg,'BinCounts',...
- cell_metrics.general.ccg(:,UID,UID),...
- 'FaceColor',color,'FaceAlpha',1,'LineStyle','none');
- title(sprintf('%s (%i)',cell_metrics.putativeCellType{UID},UID));
- xlabel('Time (s)');
- % Plot Raster
- subplot(1,2,2);
- bz_eventRasterplot(spikes,opto_1sec.timestamps(1:200,:),UID,'periEvtWdw',.5,...
- 'color',color,'subsample',5);
- sgtitle(cell_metrics.general.basename);
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%s-UID %i',cell_metrics.general.basename,UID),'-dpdf','-r0')
- end
- clear acgT acgBinSz acgEdg color UID printfig pos f1
- %% Suppl 6b: 10 ms - 1 sec side by side w/ correlations
- geneticLine = '';%'PV-Cre';
- opsin = 'ChR2'; % 'eNpHR','ChR2'
- field = 'opto_10ms';
- labels = {'rapid','delayed pPV','delayed pSST','delayed pGC','delayed pMC'};
- nGr = 5;
- printfig = true;
- % EVENT SELECTION
- type = 'manipulations'; % Manipulations, events
- sortCriterion = '_modulationIndex'; % '_modulationSD' '_modulationIndex'(default) or '_peakFreq' for chirp
- % CELL SELECTION
- include = struct('putativeCellType',{'','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'}, 'brainRegion',repmat({'DG'},1,nGr),...
- 'groundTruthClassification',{{'+'},{''},{''},{''},{''}},...
- 'labels',repmat({opsin},1,nGr),'geneticLine',repmat({geneticLine},1,nGr));
- exclude = struct('putativeCellType',repmat({'Unknown'},1,nGr),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,nGr), 'groundTruthClassification',...
- {{},{'+','~'},{'+','~'},{'+','~'},{'+','~'}});
- % {{},{'+'},{'+'},{'+'},{'+'}});
- criteria = struct('UID',repmat({[0 Inf]},1,nGr),...
- 'opto_1sec_modulationSignificanceLevelevt',repmat({[0 .01]},1,nGr),...
- 'opto_1sec_modulationRatio',repmat({[1.1 Inf]},1,nGr));
- % Get timestamps
- for b = 1:length(class_metrics.general.batch)
- if isfield(class_metrics.general.batch{b},'manipulations') &...
- isfield(class_metrics.general.batch{b}.manipulations,field)
- %hasfield(b) = isfield(metrics.general.batch{b}.(type),field);
- tss = class_metrics.general.batch{b}.manipulations.(field).x_bins;
- tsl = class_metrics.general.batch{b}.manipulations.opto_1sec.x_bins; % ASSUME 1 sec is in all opto recordings
- end
- end
- % PLOT
- f1 = figure('position',[200 20 650 145*nGr]); % Same abs height
- for gr = 1:nGr
- % Get PSTHs
- [short_psth, ~, sUIDs] = extract_psth(class_metrics, field, 'type',type,...
- 'include',include(gr),'exclude',exclude(gr),'criteria',criteria(gr),...
- 'sortCriterion',sortCriterion);
- [long_psth, ~, lUIDs] = extract_psth(class_metrics, 'opto_1sec', 'type',type,...
- 'include',include(gr),'exclude',exclude(gr),'criteria',criteria(gr),...
- 'sortCriterion',sortCriterion);
- % Match IDs between plots
- overlap = intersect(sUIDs, lUIDs);
- [~,lLoc] = ismember(sUIDs,lUIDs);
- lLoc = lLoc(lLoc>0);
- % Plot Short PSTH
- subplot(5,4,[4*(gr-1)+1 4*(gr-1)+2]);
- display_psth(short_psth(ismember(sUIDs,overlap),:),'ts',tss*1e3,...
- 'minPrctile',0,'x_units','ms','minSD',.5);
- xlim([-10 30]);
- % Plot Long PSTH
- subplot(5,4,4*(gr-1)+3);
- display_psth(long_psth(lLoc,:),'ts',tsl,'x_units','s',...
- 'minPrctile',0,'minSD',.5); % Take out long-only entries
- % Plot Modulation-Ratio correlations
- subplot(5,4,4*(gr-1)+4);
- % Rank-order correlations
- sranks = tiedrank(class_metrics.([field sortCriterion])(overlap));
- lranks = tiedrank(class_metrics.(['opto_1sec' sortCriterion])(overlap));
- isvalid = ~isnan(sranks) & ~isnan(lranks);
- N(gr) = length(find(isvalid));
- scatterWreg(sranks(isvalid)',lranks(isvalid)');
- if gr == nGr; xlabel('Rank 5 ms'); end
- ylabel('Rank 1 sec');
- [R(gr),pRank(gr)] = corr(sranks(isvalid)',lranks(isvalid)');
- end
- % Save figure if desired
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'FigS6b_Opto_shortVSlong.pdf','-dpdf','-r0')
- end
- % Multi-comparison correction for correlation p-values to console
- pRanks = multCompCorr(pRank,'method','Dunn-Sidak');
- for gr = 1:nGr
- fprintf('%s: N = %i, R = %.2f, p(raw) = %.4g, p(Dunn-Sidak) = %.4g\n',...
- labels{gr}, N(gr), R(gr), pRank(gr), pRanks(gr));
- end
- clear include exclude nGr gr field type labels minRate minPrctile baseline...
- sortCriterion printfig f1 pos colors R labels pRank pRanks lranks sranks...
- long_psth short_psth tsl tss N
- %% Suppl 6c Pie-Chart 1 sec pulses - row-wise, all
- lines = {'PV-Cre','SST-Cre'};
- opsins = {'eNpHR','ChR2'};%'eNpHR' 'ChR2'
- printfig = true;
- % Create in- and exclude structure
- %labels = {'PV','SST','GC','MC'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'},'brainRegion','DG');
- exclude = struct('groundTruthClassification',{{'+','~'}},...
- 'tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- % Plot
- f1 = figure('position',[200 200 700 700]);
- for op = 1:2
- [include.labels] = deal(opsins{op});
- for li = 1:2
- [include.geneticLine] = deal(lines{li});
- for ct = 1:4
- subplot(4,4,ct + 4*(li-1) + 8*(op-1));
- plot_response_piechart(class_metrics,'labels',{''},'alpha',.01,...
- 'signfield','_modulationSignificanceLevelevt','minchange',.1,...
- 'include',include(ct),'exclude',exclude);
- drawnow
- end
- end
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'FigS6c_ChR_eNpHR_1sec_piechart.pdf','-dpdf','-r0')
- end
- clear include exclude f1 f2 printfig field pos sel type ds ts psth psthNorm ct li op...
- lines opsins include exclude
- %% Suppl 6d,f: Classification of direct- and indirect responding cells
- % For S6d, run this with metrics classified on all PV and SST data
- % (see below for instructions for eNpHR trained classifier control).
- % General
- labels = {'PV','SST','GC','MC'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7];
- printfig = true;
- % CELL SELECTION
- classinclude = struct('putativeCellType',{'PV interneuron','SST interneuron','Granule Cell','Mossy Cell'},...
- 'labels',repmat({'ChR2'},1,4),'brainRegion',repmat({'DG'},1,4));
- trueinclude = struct('putativeCellType',{'','','Granule Cell','Mossy Cell'},...
- 'groundTruthClassification',{{'PV+'},{'SST+'},{''},{''}},...
- 'labels',repmat({'ChR2'},1,4),'brainRegion',repmat({'DG'},1,4));
- exclude = struct('putativeCellType',{'Unknown'},'tags',{{'InverseSpike','Bad'}});
- % GET TRAINING AND CLASSIFIER LABELS
- trueLbl = NaN(1,length(batch_metrics.UID));
- classLbl = NaN(1,length(class_metrics.UID));
- for ii = 4:-1:1 % Do reverse to make sure opto+ can overwrite classifier results (1 MC opto+ in PV mice).
- [~,selected] = select_cells(batch_metrics,'include',trueinclude(ii),...
- 'exclude',exclude);
- trueLbl(selected) = ii;
- end
- for ii = 4:-1:1
- [~,selected] = select_cells(class_metrics,'include',classinclude(ii),...
- 'exclude',exclude);
- classLbl(selected) = ii;
- end
- % Make confusion matrix
- figure; cm = confusionchart(confusionmat(...
- trueLbl,classLbl),{'1 PV','2 SST','3 GC','4 MC'});
- cm.RowSummary = 'row-normalized';
- cm.ColumnSummary = 'column-normalized';
- % PIE CHART FOR 10ms AND 1 sec RESPONSIVE CELLS
- [~,ChRpv] = select_cells(batch_metrics,'include',trueinclude(1),'exclude',exclude);
- [~,ChRsst] = select_cells(batch_metrics,'include',trueinclude(2),'exclude',exclude);
- % Cells w/ pos response during 1 sec stimulus (PV- and SST-ChR2 mice, respectively)
- [~,pv1secResp] = select_cells(class_metrics,...
- 'include',struct('brainRegion',{'DG'},'labels',{'ChR2'},'geneticLine',{'PV-Cre'}),...
- 'exclude',struct('groundTruthClassification',{{'+','~'}},'putativeCellType',{'Unknown'},...
- 'tags',{{'InverseSpike','Bad'}}),...
- 'criteria',struct('opto_1sec_modulationSignificanceLevel',[0 .01],...
- 'opto_1sec_modulationRatio',[1.1 Inf]));
- [~,sst1secResp] = select_cells(class_metrics,...
- 'include',struct('brainRegion',{'DG'},'labels',{'ChR2'},'geneticLine',{'SST-Cre'}),...
- 'exclude',struct('groundTruthClassification',{{'+','~'}},...
- 'putativeCellType',{'Unknown'},'tags',{{'InverseSpike','Bad'}}),...
- 'criteria',struct('opto_1sec_modulationSignificanceLevel',[0 .01],...
- 'opto_1sec_modulationRatio',[1.1 Inf]));
- % Make pie chart w/ labels
- f1 = figure('position',[200 200 300 300]);
- groups = {ChRpv,ChRsst,pv1secResp,sst1secResp};
- titles = {'PV-Cre direct','SST-Cre direct','PV-Cre indirect','SST-Cre indirect'};
- for gr = 1:4
- subplot(2,2,gr);
- theselbl = classLbl(groups{gr});
- theselbl = theselbl(~isnan(theselbl));
- Ncells = histcounts(theselbl,[.5 1.5 2.5 3.5 4.5]);
- pie(Ncells);%,labels);
- ax = gca; ax.Colormap = colors;
- title(titles{gr},'FontSize',8);
- fprintf('%s: %s: %i/%i, %s: %i/%i, %s: %i/%i, %s: %i/%i\n',titles{gr},...
- labels{1},Ncells(1),sum(Ncells),labels{2},Ncells(2),sum(Ncells),...
- labels{3},Ncells(3),sum(Ncells),labels{4},Ncells(4),sum(Ncells))
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'1sec_direct_indirect_Pie.pdf','-dpdf','-r0')
- end
- clear colors labels classinclude ChRpv ChRsst sst1secResp pv1secResp classLbl trueLbl...
- groups title pos printfig f1 theselbl Ncells ax cellIDs chrIDs sstIDs
- %% Suppl 6e: eNpHR -> ChR cross validation
- % Re-run classifier training (DG_IN_Scripts/Make table for classifier
- % learning and include 'labels',{'eNpHR'} in include criteria for PV+ and
- % SST+ cells. Apply SVM across full dataset (include all cells).
- % Then run the section above (Fig 6d,f, 'Classification of direct and indirect
- % responding cells').
- %% Suppl 6g,h: opto_1sec_modulationPeakResponseTime, spikeJitter
- field = 'opto_1sec_modulationPeakResponseTime'; % 'opto_1sec_modulationPeakResponseTime','opto_1sec_spikeJitter' 'opto_1sec_peak_ratio'
- thisYlabel = 'Peak Response Time (s)'; % 'Peak Response Time (s)', 'Spike jitter (s)'
- labels = {'rapid','PV','SST','GC','MC'};
- transformation = ''; % '', 'log2', 'log10'
- printfig = true;
- nGr = 5;
- include = struct('putativeCellType',{'','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'}, 'brainRegion',repmat({'DG'},1,nGr),...
- 'groundTruthClassification',{{'+'},{''},{''},{''},{''}},...
- 'labels',repmat({'ChR2'},1,5));
- exclude = struct('groundTruthClassification',{{},{'+','~'},{'+','~'},{'+','~'},{'+','~'}},...
- 'putativeCellType',repmat({'Unknown'},1,5),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,nGr));
- criteria = struct('opto_1sec_modulationSignificanceLevelevt',...
- {[0 1],[0 .01],[0 .01],[0 .01],[0 .01]},...
- 'opto_1sec_modulationRatio',{[-Inf Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf]});
- colors = {[1 .2 .2],[.56 .39 .93], [0 .72 .53], [.83 .78 .46], [.9 0 .7]};
- [valGrp, valMtrx, valCell] = get_metricfield(class_metrics,field,...
- 'include',include, 'exclude',exclude, 'criteria',criteria,...
- 'transformation',transformation, 'tukeyFence',3);
- % Plotting
- f1 = figure('position',[200 450 140 170]); % Same aspect ratio
- hold on
- % Plot spread for SVM classified cell types
- plotSpread(valGrp(:,1),'distributionIdx',...
- valGrp(:,2),'spreadFcn',{'xp',[]},'spreadWidth',.9,...
- 'distributionColors',[0 0 0],...
- 'distributionMarkerSize',1,'binWidth',.05);
- % Plot only svm classified cell types as violin plots
- distributionPlot(valCell,'color',colors,...
- 'showMM',6,'distWidth',.9,'addSpread',0,'histOpt',1,'divFactor',1,...
- 'FaceAlpha',.5);
- xticklabels(labels);
- xtickangle(45);
- ylabel(thisYlabel); % 'Peak Response Time (s)', 'Spike jitter (s)'
- ylim([-.5 1.5]); % [-.5 1.5] For peak response time, [-.1 .4] for jitter
- % % Stats
- fprintf('Direct vs. indirect excited cells ChR2\n');
- kruskalwallisNdunns(valMtrx,labels);
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('%s_direct_vs_indirect.pdf',field),'-dpdf','-r0')
- end
- clear valCell valGrp include exclude criteria field printfig pos f1 nGr colors...
- labels thisYlabel transformation valMtrx
- %% Suppl 6i,j: Peer-prediction opto_1sec
- % CELL SELECTION
- nGr = 5;
- labels = {'rapid','PV','SST','GC','MC'};
- include = struct('putativeCellType',{'','PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'}, 'brainRegion',repmat({'DG'},1,nGr),...
- 'groundTruthClassification',{{'+'},{''},{''},{''},{''}},...
- 'labels',repmat({'ChR2'},1,5));
- exclude = struct('groundTruthClassification',{{},{'+','~'},{'+','~'},{'+','~'},{'+','~'}},...
- 'putativeCellType',repmat({'Unknown'},1,5),...
- 'tags',repmat({{'InverseSpike','Bad'}},1,nGr));
- criteria = struct('opto_1sec_modulationSignificanceLevelevt',...
- {[0 1],[0 .01],[0 .01],[0 .01],[0 .01]},...
- 'opto_1sec_modulationRatio',{[-Inf Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf]});
- %'opto_1sec_modulationRatio',{[-Inf Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf],[1.1 Inf]});
- RsqThr = 0; % Min adjusted Rsq on training data for inclusion -- was 0.25 on 1/31/2026
- colors = {[1 .2 .2],[.56 .39 .93], [0 .72 .53], [.83 .78 .46], [.9 0 .7]};
- % PEER PREDICTION
- if ~exist('peerpred','var')
- peerpred = peerPredictOpto1sec(class_metrics, 'include',include,...
- 'exclude',exclude, 'criteria',criteria, 'binsz',.25); %.02
- end
- % Extract fit quality values
- errfield = 'MSE'; % 'R', 'Rsq', 'MSE'
- valMtrx = peerpred.(['val' errfield]);
- stimMtrx = peerpred.(['stim' errfield]);
- % Get training Rsq and exclude below threshold
- RsqTrng = -Inf(size(peerpred.Glm));
- for gr = 1:5
- for n = 1:size(peerpred.Glm,2)
- if ~isempty(peerpred.Glm{gr,n})
- RsqTrng(gr,n) = peerpred.Glm{gr,n}.Rsquared.Adjusted;
- end
- end
- valMtrx{gr} = valMtrx{gr}(RsqTrng(gr,:) > RsqThr);
- stimMtrx{gr} = stimMtrx{gr}(RsqTrng(gr,:) > RsqThr);
- end
- valMtrx = cellfun(@sqrt, valMtrx, 'UniformOutput',false);
- stimMtrx = cellfun(@sqrt, stimMtrx, 'UniformOutput',false);
- valMtrx = cellfun(@log10, valMtrx, 'UniformOutput',false);
- stimMtrx = cellfun(@log10, stimMtrx, 'UniformOutput',false);
- for gr = 1:5
- [~,isoutlierVal] = tukeyOutlierRemoval(valMtrx{gr},3);
- [~,isoutlierStim] = tukeyOutlierRemoval(stimMtrx{gr},3);
- % Remove major outliers
- valMtrx{gr} = valMtrx{gr}(~isoutlierVal & ~isoutlierStim);
- stimMtrx{gr} = stimMtrx{gr}(~isoutlierVal & ~isoutlierStim);
- end
- % PLOT LOG MSE (VIOLIN PLOTS)
- f1 = figure('position',[200 450 280 220]); % Same aspect ratio
- hold on
- valGrp = cell2groupedvector(valMtrx);
- stimGrp = cell2groupedvector(stimMtrx);
- plotSpread(valGrp(:,1),'distributionIdx',...
- (valGrp(:,2)-1)*2+1,'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',[0 0 0],...
- 'distributionMarkerSize',1,'binWidth',.05);
- plotSpread(stimGrp(:,1),'distributionIdx',...
- stimGrp(:,2)*2,'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',[0 0 0],...
- 'distributionMarkerSize',1,'binWidth',.05);
- % Plot direct and indirect responding cell's peer prediction quality
- combMtrx = cat(1,valMtrx,stimMtrx);
- distributionPlot(combMtrx,'color',{[1 .2 .2],[1 .2 .2],[.56 .39 .93],[.56 .39 .93],...
- [0 .72 .53],[0 .72 .53],[.83 .78 .46],[.83 .78 .46],[.9 0 .7],[.9 0 .7]},...
- 'showMM',6,'distWidth',.9,'addSpread',0,'histOpt',1,'divFactor',1,...
- 'FaceAlpha',.5);
- xticks([1.5 3.5 5.5 7.5 9.5]);
- xticklabels({'rapid','PV','SST','GC','MC'});
- xtickangle(45);
- ylabel(['Log' errfield ' validation']);
- ylim([-1 3]);
- % PLOT LOG MSE DIFFERENCE VAL TO STIM
- f4 = figure('position',[200 450 140 170]); % Same aspect ratio
- hold on
- diffMtrx = cellfun(@minus, stimMtrx, valMtrx, 'UniformOutput',false);
- diffGrp = cell2groupedvector(diffMtrx);
- plotSpread(diffGrp(:,1),'distributionIdx',...
- diffGrp(:,2),'spreadFcn',{'lin',10},'spreadWidth',.9,...
- 'distributionColors',[0 0 0],...
- 'distributionMarkerSize',1,'binWidth',.05);
- % Plot direct and indirect responding cell's peer prediction quality
- distributionPlot(diffMtrx,'color',{[1 .2 .2],[.56 .39 .93],[0 .72 .53],[.83 .78 .46],[.9 0 .7]},...
- 'showMM',6,'distWidth',.9,'addSpread',0,'histOpt',1,'divFactor',1,...
- 'FaceAlpha',.5);
- xticklabels({'rapid','PV','SST','GC','MC'});
- xtickangle(45);
- ylabel(['Log' errfield ' difference (Stim-Val)']);
- %ylim([-1 3]);
- % Stats (error difference)
- fprintf('Direct vs. indirect excited cells ChR2, prediction error difference');
- kruskalwallisNdunns(catuneven(diffMtrx,NaN),labels);
- % CORRELATION PLOTS (Actual rate / predicted rate during stim and
- % validation).
- f2 = figure('position',[100 100 950 350]); hold on;
- for gr = 1:5
- %Plot Stim data
- subplot(2, 5, gr);
- stimActual = real(log10(peerpred.stimActual{gr}(RsqTrng(gr,:) > RsqThr)));
- stimPred = real(log10(peerpred.stimPred{gr}(RsqTrng(gr,:) > RsqThr)));
- scatterWreg(stimActual,stimPred,'MarkerSz',8,'MarkerSymbol','o',...
- 'MarkerFaceAlpha',.5,'MarkerFaceColor',colors{gr});
- xlabel('Stim Observed'); ylabel('Stim Predicted');
- xlim([-3 2]); ylim([-3 2]);
- xticks([-3:2]); yticks([-3:2]);
- xticklabels([.001 .01 .1 1 10 100]);
- yticklabels([.001 .01 .1 1 10 100]);
- xtickangle(45);
- [R(gr,1),p(gr,1)] = corr(stimActual,stimPred);
- N(gr,1) = length(stimActual);
- % Plot Validation data
- subplot(2, 5, gr+5);
- valActual = real(log10(peerpred.valActual{gr}(RsqTrng(gr,:) > RsqThr)));
- valPred = real(log10(peerpred.valPred{gr}(RsqTrng(gr,:) > RsqThr)));
- scatterWreg(valActual,valPred,'MarkerSz',8,'MarkerSymbol','o',...
- 'MarkerFaceAlpha',.5,'MarkerFaceColor',colors{gr});
- xlabel('Validation Observed'); ylabel('Validation Predicted');
- xlim([-3 2]); ylim([-3 2]);
- xticks([-3:2]); yticks([-3:2]);
- xticklabels([.001 .01 .1 1 10 100]);
- yticklabels([.001 .01 .1 1 10 100]);
- xtickangle(45);
- [R(gr,2),p(gr,2)] = corr(valActual,valPred);
- N(gr,2) = length(valActual);
- end
- % Plot corrected p-values:
- pcorr = multCompCorr(p,'method','Dunn-Sidak');
- fprintf('\nActivity correlation bsl-stim\n');
- for gr = 1:5
- fprintf('%s, validation: N = %i, R = %.2f, p(raw) = %.4g, p(corr) = %.4g\n',...
- labels{gr},N(gr,2),R(gr,2),p(gr,2),pcorr(gr,2))
- fprintf('%s, stim: N = %i, R = %.2f, p(raw) = %.4g, p(corr) = %.4g\n',...
- labels{gr},N(gr,1),R(gr,1),p(gr,1),pcorr(gr,1))
- end
- clear include exclude criteria valGrp stimGrp valMtrx stimMtrx gr R R2 p n...
- colors errfield f1 f2 f3 f4 nGr RsqThr RsqTrng stimActual stimPred valActual valPred...
- actualRatio predRatio combMtrx diffMtrx diffGrp labels isoutlierStim isoutlierVal...
- pcorr transformation N
- %% Supplementary Figure 8
- %% Suppl 8a-c: Lorenz curves, gini differences, CV differences
- % Run Fig 6e,f code above
- %% Suppl 8d-f: Spike-subsample control for Lorenz curves, gini differences, CV differences
- % Create in- and exclude structure
- printfig = true;
- labels = {'PV-HR','SST-HR','PV-ChR','SST-ChR'};
- include = struct('putativeCellType',{'PV interneuron','SST interneuron',...
- 'Granule Cell','Mossy Cell'});
- %exclude = struct('groundTruthClassification',{{'+'},{'+'},{'+'},{'+'}});
- exclude = struct('groundTruthClassification',{{'+','~'}},...
- 'tags',{{'Bad','InverseSpike'}},'putativeCellType',{'Unknown'});
- lines = {'PV-Cre','SST-Cre'};
- opsins = {'eNpHR','ChR2'};
- colors = [.56 .39 .93; 0 .72 .53; .83 .78 .46; .9 0 .7; .56 .39 .93; 0 .72 .53];
- fields = {'gini','CV'}; % For errorbar plots (diff stim vs bsl)
- % Get Lorenz curves, gini, CV
- if ~exist('LorRes','var') % Takes long to load
- for li = [1 2] % PV-Cre / SST-Cre
- [include.geneticLine] = deal(lines{li});
- for op = [1 2] % eNpHR / ChR
- [include.labels] = deal(opsins{op});
- fprintf('%s, %s\n',lines{li},opsins{op});
- LorRes{li,op} = get_1sec_Lorenz_Curves_rateMatch(class_metrics,...
- 'include',include,'exclude',exclude,'show_results',false,...
- 'minNspikes',1, 'minNcells',4);
- end
- end
- end
- % LORENZ CURVES
- f1= figure('position',[100 100 500 450]); hold on;
- for li = 1:2
- for op = 1:2
- for ct = 1:length(include)
- subplot(4,length(include),ct + (op-1)*length(include) + (li-1)*2*length(include))
- % Plot eNpHR results
- plot([0 100],[0 1],':','color',[.5 .5 .5]);
- nSess = length(find(LorRes{li,op}.nCells(:,ct)>0));
- shadedErrorBar(1:100, nanmean(LorRes{li,op}.MeanLorenzCurveNorm(:,:,ct,1),1),...
- nanstd(LorRes{li,1}.MeanLorenzCurveNorm(:,:,ct,1),1)./sqrt(nSess),...
- 'lineprops',{'color',colors(ct,:)});
- shadedErrorBar(1:100, nanmean(LorRes{li,op}.MeanLorenzCurveNorm(:,:,ct,2),1),...
- nanstd(LorRes{li,1}.MeanLorenzCurveNorm(:,:,ct,2),1)./sqrt(nSess),...
- 'lineprops',{'color',[.5 .5 .5]});
- text(10,.8,sprintf('%s\n%s',lines{li},opsins{op}),'FontSize',8);
- drawnow
- end
- end
- end
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,'SpikeNoControl_LorenzCurves.pdf','-dpdf','-r0')
- end
- % PLOT GINI, CV, ETC
- for ff = 1:2
- % GET VALUES
- stvals = cat(1, LorRes{1,1}.(fields{ff})(:,:,1), LorRes{2,1}.(fields{ff})(:,:,1),...
- LorRes{1,2}.(fields{ff})(:,:,1), LorRes{2,2}.(fields{ff})(:,:,1)); % To sort by condition, cat(2,... and omit reshape
- blvals = cat(1, LorRes{1,1}.(fields{ff})(:,:,2), LorRes{2,1}.(fields{ff})(:,:,2),...
- LorRes{1,2}.(fields{ff})(:,:,2), LorRes{2,2}.(fields{ff})(:,:,2));
- stvals = reshape(stvals, size(LorRes{1,1}.gini,1), length(include)*length(lines)*length(opsins));
- blvals = reshape(blvals, size(LorRes{1,1}.gini,1), length(include)*length(lines)*length(opsins));
- % RAW VALUES (DUAL VIOLIN PLOTS)
- figure('position',[100 100 500 150]); hold on;
- % baseline (left, grey)
- plotSpread(blvals,'spreadFcn',{'lin',10},...
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',3,...
- 'spreadOri','left','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(blvals,'histOri','left','color',[0 0 0],...
- 'widthDiv',[2 1],'showMM',6,'FaceAlpha',.5);
- % Stim (right)
- plotSpread(stvals,'spreadFcn',{'lin',10},... % [sic!], use wider (10) spread here 2/2 lower n datapoints
- 'spreadWidth',.9,'distributionColors',[.5 .5 .5],'distributionMarkerSize',3,...
- 'spreadOri','right','distributionMarkerAlpha',.5,'distributionMarkers','o');
- distributionPlot(stvals,'histOri','right','color',num2cell(colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:),2),...
- 'widthDiv',[2 2],'showMM',6,'FaceAlpha',.5);
- %ylim([.4 1.1]);
- ylabel(fields{ff});
- % STIM-BSL DELTA PLOT
- f1 = figure('position',[100 100 400 250]); hold on;
- % distributionPlot(stvals-blvals,'showMM',6,'FaceAlpha',.5,'histOpt',1,'divFactor',1,...
- % 'color',num2cell(colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:),2));
- plot([0 size(stvals,2)+1],[0 0],'--','Color',[.5 .5 .5]); % Zero line
- plotSpread(stvals-blvals,'spreadFcn',{'lin',5},...
- 'spreadWidth',.9,'distributionColors',[0 0 0],'distributionMarkerSize',4,...
- 'distributionMarkerAlpha',1,'distributionMarkers','o');
- customErrorBar(stvals-blvals, 'errtype','STD', 'alpha',.7,...
- 'markerSize',100, 'LineWidth',1.2,...
- 'colors',colors([1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4],:));
- xlim([0 size(stvals,2)+1]);
- %ylim([-.3 .4]);
- ylabel(sprintf('%s (stim-bsl)',fields{ff}));
- xticklabels(repmat(labels,1,4));
- xtickangle(45);
- % Save figure
- if printfig
- pos = get(f1,'Position');
- set(f1,'PaperPositionMode','Auto','PaperUnits','points',...
- 'PaperSize',[pos(3), pos(4)],'Renderer','Painters')
- print(f1,sprintf('SpikeNoControl_Opto_1sec_%s_change.pdf',fields{ff}),'-dpdf','-r0')
- end
- % STATISTICS
- for ct = 1:length(include)
- clear blvals stvals groupVals
- % Statistics @console
- fprintf('\n%s:',include(ct).putativeCellType)
- fprintf('\n%s (raw p):\n',fields{ff}) % For statistics in console
- for li = 1:2
- for op = 1:2
- blvals(:,li,op) = LorRes{li,op}.(fields{ff})(:,ct,2); % nSess x nGroup(ct) x [1 (stim) 2 (bsl)]
- stvals(:,li,op) = LorRes{li,op}.(fields{ff})(:,ct,1);
- try
- pvals(ct,li,op) = pairedSampleTest(blvals(:,li,op), stvals(:,li,op),...
- 'labels',{'baseline','stim'},'verbose',true);
- catch
- pvals(ct,li,op) = NaN;
- fprintf('\n');
- end
- end
- end
- % ANOVA
- groupVals = reshape(stvals-blvals, size(stvals,1), size(stvals,2)*size(stvals,3));
- fprintf('%s ANOVA:\n',fields{ff})
- kruskalwallisNdunns(groupVals, labels);
- end
- % Multi-Comparison Corrected p-values
- padj = multCompCorr(pvals,'method','Dunn-Sidak'); % 'Holm-Bonferroni', 'Dunn-Sidak'
- fprintf('%s (adjusted p-values):\n',fields{ff});
- for op = [1 2]
- for li = [1 2]
- for ct = 1:length(include)
- fprintf('%s-%s: %s (stim vs. bsl), p = %.4g\n',lines{li}, opsins{op},...
- include(ct).putativeCellType, padj(ct,li,op));
- end
- end
- end
- end
- clear labels include exclude lines opsins li ct op f1 f2 colors color...
- limrate pvals ncolors labels baseMLD stimMLD isGoodID baserates blvals...
- stimrates stvals f1 fields ff pos nSess printfig statlabels valTbl groupVals padj
- %% Suppl 8d: Baseline vs. Stim firing rate correlations
- % Runf FIg 6g code above
DG_IN_Figures_final.m at commit 1566f35, no license · at the source
Overview
- Neuroscience Institute, New York University Langone Medical Center, New York, NY 10016, USA
- Department of Psychiatry, New York University Langone Medical Center, New York, NY 10016, USA
- Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Palo Alto, CA 94305, USA
- Department of Neurosurgery, Stanford University School of Medicine, Palo Alto, CA 94305, USA
- Department of Neurology, New York University Langone Medical Center, New York, NY 10016, USA
- Lead contact
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repositories
Its files are read in the Code ↔ Paper reader above, with 40 matches between paragraphs and lines of code.
ThomasHainmueller/HainmuellerHeynold_et_al_2025
1566f35fc1522f1cefd7a3f59b85e76a9925df3d, 22 March 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
597 files
- DG_IN_Ephys/
AddStateRates.m , MATLAB, 92 lines - DG_IN_Ephys/
AddWakeRunStillRates.m , MATLAB, 103 lines - DG_IN_Ephys/
DG_IN_LFP_Scripts.m , MATLAB, 860 lines, 1 match - DG_IN_Ephys/
Ivan_Model_weight_script , MATLAB, 527 lines.m - DG_IN_Figures_final.m, MATLAB, 3,691 lines, 5 matches
- buzcodeAddOns/
AssemblyReactivationScri , MATLAB, 14 linespts.m - buzcodeAddOns/
BackupServer_scripts.m , MATLAB, 39 lines - buzcodeAddOns/
Behavior/ , MATLAB, 259 linesBehaviorSummaryScripts.m - buzcodeAddOns/
Behavior/ , MATLAB, 114 linesCSV2Tracking.m - buzcodeAddOns/
Behavior/ , MATLAB, 193 linesLoadMocap2.m - buzcodeAddOns/
Behavior/ , MATLAB, 147 lines, 1 matchOptitrackBehav.m - buzcodeAddOns/
Behavior/ , MATLAB, 78 linesalign_tracking.m - buzcodeAddOns/
BehaviorTrackingSession. , MATLAB, 442 linesm - buzcodeAddOns/
CellClassification/ , MATLAB, 56 linesCellClassificationScript s.m - buzcodeAddOns/
CellClassification/ , MATLAB, 112 linesTSNEcellType.m - buzcodeAddOns/
CellClassification/ , MATLAB, 163 linesYutaClassWrapper.m - buzcodeAddOns/
CellClassification/ , MATLAB, 123 lines, 1 matchYutaClassifier.m - buzcodeAddOns/
CellClassification/ , MATLAB, 175 linesaddYutaClassParams.m - buzcodeAddOns/
CellClassification/ , MATLAB, 94 lines, 2 matchestrainSVMpvssst.m - buzcodeAddOns/
CellClassification/ , MATLAB, 99 lines, 1 matchtrainSVMpvsst.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 43 linesL_Ratio_rh.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 334 linesPhy2Neurosuite.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 71 linesalign_KSfeatures.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 93 linesget_clusterQuality.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 184 linesget_optoWaveform.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 126 linesget_qualityMetrics.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 262 linesget_qualityMetricsKS-bac kup240310.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 437 linesget_qualityMetricsKS-bac kup240331.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 422 linesget_qualityMetricsKS.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 48 linesget_refractoryPeriodViol ations.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 32 linesget_std_projection.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 58 linesget_waveformACGquality.m - buzcodeAddOns/
ClusterQuality/ , MATLAB, 60 linesget_waveformCorrelations .m - buzcodeAddOns/
CreateNeuroscopeEvents.m , MATLAB, 24 lines - buzcodeAddOns/
DSrateMap.m , MATLAB, 94 lines - buzcodeAddOns/
DecodingScripts.m , MATLAB, 186 lines - buzcodeAddOns/
EventDetection/ , MATLAB, 86 linesDS2_rate_relationship.m - buzcodeAddOns/
EventDetection/ , MATLAB, 115 linesDetectDSpikes_CSD-backup _240514.m - buzcodeAddOns/
EventDetection/ , MATLAB, 404 linesDetectDSpikes_CSD.m - buzcodeAddOns/
EventDetection/ , MATLAB, 86 linesDetectDSpikes_Tort-backu p_240531.m - buzcodeAddOns/
EventDetection/ , MATLAB, 116 linesDetectDSpikes_Tort.m - buzcodeAddOns/
EventDetection/ , MATLAB, 197 linesDetectDSpikes_peakwidth. m - buzcodeAddOns/
EventDetection/ , MATLAB, 276 linesDetectDSpikes_troughs.m - buzcodeAddOns/
EventDetection/ , MATLAB, 438 lines, 1 matchDetectDSpikes_v4.m - buzcodeAddOns/
EventDetection/ , MATLAB, 442 lines, 1 matchDetectDSpikes_v5.m - buzcodeAddOns/
EventDetection/ , MATLAB, 719 linesLFP_analysis_scripts.m - buzcodeAddOns/
EventDetection/ , MATLAB, 92 linesaddPeakRiseAmp.m - buzcodeAddOns/
EventDetection/ , MATLAB, 98 linesautoCA3rippleDetection.m - buzcodeAddOns/
EventDetection/ , MATLAB, 191 linesautoDSdetection.m - buzcodeAddOns/
EventDetection/ , MATLAB, 94 linesbz_findIEDs.m - buzcodeAddOns/
EventDetection/ , MATLAB, 217 linesbz_findRippleBursts.m - buzcodeAddOns/
EventDetection/ , MATLAB, 131 linesdetectIEDrise.m - buzcodeAddOns/
EventDetection/ , MATLAB, 122 linesdetectIEDsimple.m - buzcodeAddOns/
EventDetection/ , MATLAB, 1,212 linesdetect_hfos.m - buzcodeAddOns/
EventDetection/ , MATLAB, 55 linesevents_over_time.m - buzcodeAddOns/
EventDetection/ , MATLAB, 137 linesevt_rate_relationship.m - buzcodeAddOns/
EventDetection/ , MATLAB, 161 linesfindDownstates.m - buzcodeAddOns/
EventDetection/ , MATLAB, 122 linesfindMolecularLayers.m - buzcodeAddOns/
EventDetection/ , MATLAB, 279 linesfindRippleBursts.m - buzcodeAddOns/
EventDetection/ , MATLAB, 96 linesfindThetaCycles.m - buzcodeAddOns/
ExplainedVariance.m , MATLAB, 16 lines - buzcodeAddOns/
ExplainedVarianceWrapper , MATLAB, 86 lines.m - buzcodeAddOns/
GammaMap.m , MATLAB, 299 lines - buzcodeAddOns/
ImportOptostimData.m , MATLAB, 102 lines - buzcodeAddOns/
Kilosort_database.m , MATLAB, 216 lines - buzcodeAddOns/
Kilosort_database_FirstG , MATLAB, 151 lineseneration.m - buzcodeAddOns/
LED2Tracking.m , MATLAB, 521 lines - buzcodeAddOns/
LFP_analysis/ , MATLAB, 264 lines, 1 matchDGlayerProfile.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 34 linesICA_applyTransform.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 180 linesICA_selectGammaICs.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 142 linesICA_spikeLFPspectrogram. m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 149 linesICA_tutorial.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 364 linesLFP_scripts.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 125 linesML_spikeLFPcoupling.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 137 linesML_spikeLFPspectrogram.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 36 linesSpikeLFPcouplingTests.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 123 linesThetaCSDprofile.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 264 linesThetaProfile.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 133 linesbz_CSDmultishank-v202406 27.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 133 linesbz_CSDmultishank.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 209 linesbz_RunIca.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 201 linesbz_eventCSDmultishank.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 198 linesbz_eventCSDmultishank2.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 204 linesbz_eventCSDsingleshank.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 31 linesbz_eventTriggeredEMG.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 108 linesdsCSDprofile.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 34 linesfind_gamma_chan.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 125 linesfind_osc_troughs.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 38 linesfind_peak_osc_chan.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 44 linesfind_rest_interval.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 36 linesfind_theta_chan.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 46 linesget_osc_intervals.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 11 linesmakeDGmap.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 43 linesmake_CFC_map.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 90 linesplot_multishankCSD.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 257 linespowerSpectrumProfile.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 95 linesthetaGammaCFC.m - buzcodeAddOns/
LFP_analysis/ , MATLAB, 57 linestopoPlotCFC.m - buzcodeAddOns/
LinearBehav.m , MATLAB, 252 lines - buzcodeAddOns/
MonoSyn/ , MATLAB, 183 linesConnectivityPlotScript.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 25 linesManualCurationScripts.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 550 linesMonoSynScripts.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 138 lines, 1 matchanalyzeMonoLTP.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 128 lines, 1 matchanalyzeMonoSyn.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 90 lines, 1 matchburstCCG.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 121 linesgetConvergingPairs.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 113 linesgetMonoConnAnalysis.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 116 linesgetMonoConnRates-outdate d.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 156 linesgetMonoConnRates.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 65 linesgetMonoConnectome.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 28 lineshasMFinput.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 106 linesmakeConnectivityPlot.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 145 linesplot_pairWplacefields.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 280 linesrecalculateMonoSyn.m - buzcodeAddOns/
MonoSyn/ , MATLAB, 19 linesset_manualMonoSyn.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 21 linesCLoseLoopScripts.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 23 linesOptogeneticsScripts.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 67 linesTHaddOptoPulses.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 110 linesaddOptopulseStatistics.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 125 linesadd_chirpFreqResponse.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 86 linesadd_halfRiseLatency.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 177 linesadd_optopulse_stats.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 28 linesanalogpulse2events.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 123 linesclosedLoopPulses2events. m - buzcodeAddOns/
Optogenetics/ , MATLAB, 43 linesgetManipulationIntervals .m - buzcodeAddOns/
Optogenetics/ , MATLAB, 26 linesgetToneStimuli.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 114 linesget_closedLoopStim.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 134 linesget_stimWaveforms.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 19 linesloadStimEvents.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 195 linesoptopulse2events.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 96 linesreclassifyOptoResponses. m - buzcodeAddOns/
Optogenetics/ , MATLAB, 99 lines, 1 matchreclassifyOptoResponses2 .m - buzcodeAddOns/
Optogenetics/ , MATLAB, 17 linesshift_events.m - buzcodeAddOns/
Optogenetics/ , MATLAB, 25 linessimpleDigitalLowpass.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 34 linesComputePeerPrediction.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 31 linesComputePeerPredictionRoo t.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 140 lines, 2 matchesCrossValidationAssemblyP rediction.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 94 linesCrossValidationAssemblyP rediction_Cells.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 22 linesPeerPredTestScripts.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 23 linesSpkTrainLogLikelihood.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 187 linesgetAllPeerPredict.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 32 linesmakeSpikeRaster.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 4 linesmodifiedExp.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 5 linesmodifiedExpDer.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 5 linesmodifiedExpInv.m - buzcodeAddOns/
PeerPrediction/ , MATLAB, 190 lines, 2 matchespeerPredictOpto1sec.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 200 linesPlaceFieldPlots.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 23 linesSpatialAnalysisScripts.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 60 linesget_PlacefieldCorrelatio ns.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 299 linesget_placeFieldsLinear-ba ckup.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 294 lines, 2 matchesget_placeFieldsLinear.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 305 lines, 2 matchesget_placeFieldsOF.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 306 linesget_placeFieldsRadial.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 276 lineslinearSpatialAnalysis.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 64 linesload_LinearBatch.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 64 linesload_OpenfieldBatch.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 64 linesload_RadialBatch.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 121 linesplot_ConnectedPlacefield s.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 112 linesplot_placefield1D.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 35 linesplot_placefield2D.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 69 linesplot_placefieldRAD.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 95 linesplot_placefields1D.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 61 linesplot_placefields2D.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 89 linesplot_placefieldsRAD.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 357 linesradialSpatialAnalysis.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 8 linesspatial_coherence.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 27 linesspatial_coherence2.m - buzcodeAddOns/
PlaceFields/ , MATLAB, 44 linesstraighten_plot.m - buzcodeAddOns/
Process_IntanDigitalChan , MATLAB, 37 linesnels.m - buzcodeAddOns/
RadialBatch.m , MATLAB, 271 lines - buzcodeAddOns/
RadialBehav - 200121.m , MATLAB, 290 lines - buzcodeAddOns/
RadialBehav-backup210603 , MATLAB, 524 lines.m - buzcodeAddOns/
RadialBehav.m , MATLAB, 544 lines - buzcodeAddOns/
RadialPlots.m , MATLAB, 160 lines - buzcodeAddOns/
RadialSession.m , MATLAB, 421 lines - buzcodeAddOns/
THpipeline.m , MATLAB, 986 lines - buzcodeAddOns/
UnitLFPanalysisScripts.m , MATLAB, 241 lines - buzcodeAddOns/
Utilities/ , MATLAB, 142 linesConditionalHist.m - buzcodeAddOns/
Utilities/ , MATLAB, 33 linesFConv.m - buzcodeAddOns/
Utilities/ , MATLAB, 61 linesFindIntsNextToInts.m - buzcodeAddOns/
Utilities/ , MATLAB, 55 linesFindPeakInWin.m - buzcodeAddOns/
Utilities/ , MATLAB, 10 linesGauss.m - buzcodeAddOns/
Utilities/ , MATLAB, 16 linesHolmBonferroniCorr.m - buzcodeAddOns/
Utilities/ , MATLAB, 42 linesIntersectIntervals.m - buzcodeAddOns/
Utilities/ , MATLAB, 58 linesMergeSeparatedInts.m - buzcodeAddOns/
Utilities/ , MATLAB, 17 linesNanPadJumps.m - buzcodeAddOns/
Utilities/ , MATLAB, 130 linesNormToInt.m - buzcodeAddOns/
Utilities/ , MATLAB, 47 linesOUNoise.m - buzcodeAddOns/
Utilities/ , MATLAB, 226 linesPhyAutoClusterCleanup.m - buzcodeAddOns/
Utilities/ , MATLAB, 139 linesPr2Radon.m - buzcodeAddOns/
Utilities/ , MATLAB, 63 linesRestrictInts.m - buzcodeAddOns/
Utilities/ , MATLAB, 46 linesSpikeTriggeredEvts.m - buzcodeAddOns/
Utilities/ , MATLAB, 72 linesaddAnalogDigitalChInfo.m - buzcodeAddOns/
Utilities/ , MATLAB, 58 linesaddKSfolders.m - buzcodeAddOns/
Utilities/ , MATLAB, 98 linesadjustPulseToADC.m - buzcodeAddOns/
Utilities/ , MATLAB, 51 linesautoCutDatFragment.m - buzcodeAddOns/
Utilities/ , MATLAB, 23 linesbackup_file.m - buzcodeAddOns/
Utilities/ , MATLAB, 54 linesbeeswarmplot.m - buzcodeAddOns/
Utilities/ , MATLAB, 236 linesbz_BimodalThresh.m - buzcodeAddOns/
Utilities/ , MATLAB, 114 linesbz_CollapseStruct.m - buzcodeAddOns/
Utilities/ , MATLAB, 351 linesbz_CreateMergePoints.m - buzcodeAddOns/
Utilities/ , MATLAB, 91 linesbz_Diff.m - buzcodeAddOns/
Utilities/ , MATLAB, 68 linesbz_FindBasePaths.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linesbz_FindCatableDims.m - buzcodeAddOns/
Utilities/ , MATLAB, 128 linesbz_IDXtoINT.m - buzcodeAddOns/
Utilities/ , MATLAB, 125 linesbz_INTtoIDX.m - buzcodeAddOns/
Utilities/ , MATLAB, 89 linesbz_LoadBinaryEvt.m - buzcodeAddOns/
Utilities/ , MATLAB, 198 linesbz_LoadPhy.m - buzcodeAddOns/
Utilities/ , MATLAB, 96 linesbz_Matchfields.m - buzcodeAddOns/
Utilities/ , MATLAB, 49 linesbz_RandomWindowInInterva ls.m - buzcodeAddOns/
Utilities/ , MATLAB, 102 linesbz_RunAnalysis.m - buzcodeAddOns/
Utilities/ , MATLAB, 91 linesbz_SpikeTriggeredEvts.m - buzcodeAddOns/
Utilities/ , MATLAB, 33 linesbz_eventIntervals.m - buzcodeAddOns/
Utilities/ , MATLAB, 92 linesbz_eventRasterplot.m - buzcodeAddOns/
Utilities/ , MATLAB, 30 linesbz_hartigansdipsigniftes t.m - buzcodeAddOns/
Utilities/ , MATLAB, 311 linesbz_hartigansdiptest.m - buzcodeAddOns/
Utilities/ , MATLAB, 37 linesbz_isBehavior.m - buzcodeAddOns/
Utilities/ , MATLAB, 27 linesbz_isBuzcode.m - buzcodeAddOns/
Utilities/ , MATLAB, 26 linesbz_isCellInfo.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linesbz_isEvents.m - buzcodeAddOns/
Utilities/ , MATLAB, 29 linesbz_isLFP.m - buzcodeAddOns/
Utilities/ , MATLAB, 27 linesbz_isPopInfo.m - buzcodeAddOns/
Utilities/ , MATLAB, 33 linesbz_isSession.m - buzcodeAddOns/
Utilities/ , MATLAB, 69 linesbz_isSessionInfo.m - buzcodeAddOns/
Utilities/ , MATLAB, 59 linesbz_mergeSpikes.m - buzcodeAddOns/
Utilities/ , MATLAB, 4 linesbz_shuffleCellID.m - buzcodeAddOns/
Utilities/ , MATLAB, 6 linesbz_shuffleCircular.m - buzcodeAddOns/
Utilities/ , MATLAB, 41 linesbz_splitSpikes.m - buzcodeAddOns/
Utilities/ , MATLAB, 43 linesbz_wrap.m - buzcodeAddOns/
Utilities/ , MATLAB, 17 linescatLFPstruct.m - buzcodeAddOns/
Utilities/ , MATLAB, 153 linescatstruct.m - buzcodeAddOns/
Utilities/ , MATLAB, 49 linescatuneven.m - buzcodeAddOns/
Utilities/ , MATLAB, 30 linescatuneven_231122.m - buzcodeAddOns/
Utilities/ , MATLAB, 18 linescell2groupedvector.m - buzcodeAddOns/
Utilities/ , MATLAB, 78 linescenterOfMass.m - buzcodeAddOns/
Utilities/ , MATLAB, 36 linescenters2edges.m - buzcodeAddOns/
Utilities/ , MATLAB, 19 lineschanMap2tiles.m - buzcodeAddOns/
Utilities/ , MATLAB, 15 linesconv_edgerep.m - buzcodeAddOns/
Utilities/ , MATLAB, 20 linesconv_sym.m - buzcodeAddOns/
Utilities/ , MATLAB, 9 linesconvert_events.m - buzcodeAddOns/
Utilities/ , MATLAB, 96 linescustomErrorBar.m - buzcodeAddOns/
Utilities/ , MATLAB, 6 linescustom_colormaps/ bwr.m - buzcodeAddOns/
Utilities/ , MATLAB, 260 linescustom_colormaps/ bwyr.m - buzcodeAddOns/
Utilities/ , MATLAB, 9 linescustom_colormaps/ makeLinearColormap.m - buzcodeAddOns/
Utilities/ , MATLAB, 32 linesdelete_local_recordings. m - buzcodeAddOns/
Utilities/ , MATLAB, 70 linesdigitalIN_to_evt.m - buzcodeAddOns/
Utilities/ , MATLAB, 226 linesdirwalk.m - buzcodeAddOns/
Utilities/ , MATLAB, 110 linesdisplay_psth.m - buzcodeAddOns/
Utilities/ , MATLAB, 57 linesdistrBootstrapComp.m - buzcodeAddOns/
Utilities/ , MATLAB, 25 linesdownsamplePerGroup.m - buzcodeAddOns/
Utilities/ , MATLAB, 60 linesevt2neuroscope.m - buzcodeAddOns/
Utilities/ , MATLAB, 95 linesextract_raw_psth.m - buzcodeAddOns/
Utilities/ , MATLAB, 8 linesfPolyFit.m - buzcodeAddOns/
Utilities/ , MATLAB, 117 linesfastrms.m - buzcodeAddOns/
Utilities/ , MATLAB, 84 linesfastsmooth.m - buzcodeAddOns/
Utilities/ , MATLAB, 202 linesfileConversions/ ConvertKilosort2Neurosui te.m - buzcodeAddOns/
Utilities/ , MATLAB, 276 linesfileConversions/ ConvertKlusta2Matlab.m - buzcodeAddOns/
Utilities/ , MATLAB, 287 linesfileConversions/ ConvertKlusta2Neurosuite .m - buzcodeAddOns/
Utilities/ , MATLAB, 214 linesfileConversions/ ConvertMountainsort2Neur osuite.m - buzcodeAddOns/
Utilities/ , MATLAB, 379 linesfileConversions/ ConvertPhyKilo2Neurosuit e.m - buzcodeAddOns/
Utilities/ , MATLAB, 963 linesfileConversions/ ConvertSpykingCircus2Neu rosuite.m - buzcodeAddOns/
Utilities/ , MATLAB, 264 linesfileConversions/ ConvertToPlexon/ Intan2PLX.m - buzcodeAddOns/
Utilities/ , MATLAB, 189 linesfileConversions/ ConvertToPlexon/ checkPLXData.m - buzcodeAddOns/
Utilities/ , MATLAB, 17 linesfileConversions/ ConvertToPlexon/ defineSortingConstants.m - buzcodeAddOns/
Utilities/ , MATLAB, 129 linesfileConversions/ ConvertToPlexon/ extractSpikes.m - buzcodeAddOns/
Utilities/ , MATLAB, 19 linesfileConversions/ ConvertToPlexon/ getAllIntanFiles.m - buzcodeAddOns/
Utilities/ , MATLAB, 395 linesfileConversions/ ConvertToPlexon/ readPLXHeaders.m - buzcodeAddOns/
Utilities/ , MATLAB, 174 linesfileConversions/ ConvertToPlexon/ read_intan_data.m - buzcodeAddOns/
Utilities/ , MATLAB, 160 linesfileConversions/ ConvertToPlexon/ writePLXFile.m - buzcodeAddOns/
Utilities/ , MATLAB, 71 linesfileConversions/ LinuxBasedPCAForFets/ MakeClassicFet.m - buzcodeAddOns/
Utilities/ , MATLAB, 93 linesfileConversions/ LinuxBasedPCAForFets/ firfilter.m - buzcodeAddOns/
Utilities/ , MATLAB, 76 linesfileConversions/ convertClu2Kwik.m - buzcodeAddOns/
Utilities/ , MATLAB, 75 linesfileConversions/ convertFMAT2Matlab.m - buzcodeAddOns/
Utilities/ , MATLAB, 11 linesfileConversions/ kwx2spk.m - buzcodeAddOns/
Utilities/ , MATLAB, 204 linesfileConversions/ pos2behav.m - buzcodeAddOns/
Utilities/ , MATLAB, 139 lines, 2 matchesfindAmbiguous.m - buzcodeAddOns/
Utilities/ , MATLAB, 13 linesfindClosestTS.m - buzcodeAddOns/
Utilities/ , MATLAB, 161 linesfindOptoModulated.m - buzcodeAddOns/
Utilities/ , MATLAB, 161 linesfindOptoModulated2.m - buzcodeAddOns/
Utilities/ , MATLAB, 34 linesfindRemotePath.m - buzcodeAddOns/
Utilities/ , MATLAB, 6 linesgather_try.m - buzcodeAddOns/
Utilities/ , MATLAB, 46 linesgausskernel.m - buzcodeAddOns/
Utilities/ , MATLAB, 71 linesget_arg_names.m - buzcodeAddOns/
Utilities/ , MATLAB, 97 linesget_metricfield--groupEd its250327.m - buzcodeAddOns/
Utilities/ , MATLAB, 110 linesget_metricfield.m - buzcodeAddOns/
Utilities/ , MATLAB, 121 linesget_metricfieldTbl.m - buzcodeAddOns/
Utilities/ , MATLAB, 28 linesget_tone_responses.m - buzcodeAddOns/
Utilities/ , MATLAB, 104 linesginicoeff.m - buzcodeAddOns/
Utilities/ , MATLAB, 129 linesglme_stats.m - buzcodeAddOns/
Utilities/ , MATLAB, 70 lineshasCuratedMonoSyn.m - buzcodeAddOns/
Utilities/ , MATLAB, 40 lineshas_cellmetrics_TH.m - buzcodeAddOns/
Utilities/ , MATLAB, 28 lineshas_manual_sleep.m - buzcodeAddOns/
Utilities/ , MATLAB, 34 lineshas_spikes_TH.m - buzcodeAddOns/
Utilities/ , MATLAB, 68 linesheatmapOverlay.m - buzcodeAddOns/
Utilities/ , MATLAB, 66 lineshist2D.m - buzcodeAddOns/
Utilities/ , MATLAB, 138 lineshistcn.m - buzcodeAddOns/
Utilities/ , MATLAB, 18 linesind2subND.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linesisCompleteDat.m - buzcodeAddOns/
Utilities/ , MATLAB, 53 lineskruskalwallisNdunns.m - buzcodeAddOns/
Utilities/ , MATLAB, 16 linesloadAs.m - buzcodeAddOns/
Utilities/ , MATLAB, 41 linesload_cellmetrics_TH.m - buzcodeAddOns/
Utilities/ , MATLAB, 37 linesload_spikes_TH.m - buzcodeAddOns/
Utilities/ , MATLAB, 60 lineslogAxisTicks.m - buzcodeAddOns/
Utilities/ , MATLAB, 34 lineslogical_lowpass.m - buzcodeAddOns/
Utilities/ , MATLAB, 28 linesmakeBayesWeightedCorr1.m - buzcodeAddOns/
Utilities/ , MATLAB, 47 linesmakeBayesWeightedCorrBat ch1.m - buzcodeAddOns/
Utilities/ , MATLAB, 69 linesmakeDShandle.m - buzcodeAddOns/
Utilities/ , MATLAB, 195 linesmakeIndividualDShandle.m - buzcodeAddOns/
Utilities/ , MATLAB, 10 linesmakeQForWeightedCorr.m - buzcodeAddOns/
Utilities/ , MATLAB, 22 linesmoving_zscore.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linesmultCompCorr.m - buzcodeAddOns/
Utilities/ , MATLAB, 114 linesnanconv.m - buzcodeAddOns/
Utilities/ , MATLAB, 96 linesneuroscope2evt.m - buzcodeAddOns/
Utilities/ , MATLAB, 127 linesonewayGroupTest.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linespairedSampleTest.m - buzcodeAddOns/
Utilities/ , MATLAB, 119 linesplotDat.m - buzcodeAddOns/
Utilities/ , MATLAB, 32 linesplot_2Dratemaps.m - buzcodeAddOns/
Utilities/ , MATLAB, 34 linesplot_ACG.m - buzcodeAddOns/
Utilities/ , MATLAB, 45 linesplot_dat.m - buzcodeAddOns/
Utilities/ , MATLAB, 261 linesplot_metricfield.m - buzcodeAddOns/
Utilities/ , MATLAB, 172 linesplot_psth-231104.m - buzcodeAddOns/
Utilities/ , MATLAB, 143 linesplot_psth-pre231104.m - buzcodeAddOns/
Utilities/ , MATLAB, 225 linesplot_psth.m - buzcodeAddOns/
Utilities/ , MATLAB, 95 linesplot_response_piechart.m - buzcodeAddOns/
Utilities/ , MATLAB, 68 linesprobeLayoutMap.m - buzcodeAddOns/
Utilities/ , MATLAB, 54 linesrecover_file.m - buzcodeAddOns/
Utilities/ , MATLAB, 4 linesremoveEmptyCells.m - buzcodeAddOns/
Utilities/ , MATLAB, 18 linesremoveFolderWithContent. m - buzcodeAddOns/
Utilities/ , MATLAB, 32 linesremove_short_segments.m - buzcodeAddOns/
Utilities/ , MATLAB, 66 linesrestoreOriginalKwik.m - buzcodeAddOns/
Utilities/ , MATLAB, 10 linesrestrict_events.m - buzcodeAddOns/
Utilities/ , MATLAB, 15 linesrsquared.m - buzcodeAddOns/
Utilities/ , MATLAB, 62 linesrunBatchAnalysis.m - buzcodeAddOns/
Utilities/ , MATLAB, 50 linessaveAsFMAevt.m - buzcodeAddOns/
Utilities/ , MATLAB, 38 linesscatterWreg.m - buzcodeAddOns/
Utilities/ , MATLAB, 22 linesselect_events.m - buzcodeAddOns/
Utilities/ , MATLAB, 39 linessession2chanMap.m - buzcodeAddOns/
Utilities/ , MATLAB, 28 linesset_analysisTagValue.m - buzcodeAddOns/
Utilities/ , MATLAB, 209 linesshadedErrorBar.m - buzcodeAddOns/
Utilities/ , MATLAB, 70 linessigmoid.m - buzcodeAddOns/
Utilities/ , MATLAB, 52 linessort_cells.m - buzcodeAddOns/
Utilities/ , MATLAB, 21 linesspikes2sorted.m - buzcodeAddOns/
Utilities/ , MATLAB, 25 linessplitEventsByAmp.m - buzcodeAddOns/
Utilities/ , MATLAB, 53 linesstakeplot.m - buzcodeAddOns/
Utilities/ , MATLAB, 176 linesstandardPlot.m - buzcodeAddOns/
Utilities/ , MATLAB, 18 linessub2indND.m - buzcodeAddOns/
Utilities/ , MATLAB, 20 linessubsample_histcounts.m - buzcodeAddOns/
Utilities/ , MATLAB, 53 linestukeyOutlierRemoval.m - buzcodeAddOns/
Utilities/ , MATLAB, 51 linesunpairedSampleTest.m - buzcodeAddOns/
Utilities/ , MATLAB, 104 linesupdatePaths.m - buzcodeAddOns/
Utilities/ , MATLAB, 106 linesupdate_AnalysisTags.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 43 linesBehaviorScripts.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 67 linesYS_getBehavior.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 121 linesYS_getMazeLabels.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 99 linesYS_updateCellMetrics.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 63 linesYS_updateSessionEpochs.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 164 linesYSplots.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 947 linesYSprocessing.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 78 linesYutaBehavior.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 45 linesYutaData_batchdisplay.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 339 linesYutaGetAllWaveforms.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 295 linesYutaSpikeTrigAvg.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 123 linesYuta_AddSynapses.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 71 linesYuta_ConvertSleepStates. m - buzcodeAddOns/
YutaDataset/ , MATLAB, 125 linesYuta_GetDigitalIn.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 81 linesYuta_GetPulseStims.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 48 linesYuta_LoadPulses.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 14 linesanalog2TTL.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 73 linesforThomas.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 220 lineslocal_process_script_DG. m - buzcodeAddOns/
YutaDataset/ , MATLAB, 135 linesprocessYSopto.m - buzcodeAddOns/
YutaDataset/ , MATLAB, 142 linespulsestims2events.m - buzcodeAddOns/
add_regions.m , MATLAB, 86 lines - buzcodeAddOns/
analysis/ , MATLAB, 41 linesContents.m - buzcodeAddOns/
analysis/ , MATLAB, 235 linesCrossFrequencyCoupling/ bz_CFCPhaseAmp.m - buzcodeAddOns/
analysis/ , MATLAB, 207 linesCrossFrequencyCoupling/ bz_Comodulogram.m - buzcodeAddOns/
analysis/ , MATLAB, 186 linesCrossFrequencyCoupling/ bz_PhaseAmpCouplingByAmp .m - buzcodeAddOns/
analysis/ , MATLAB, 131 linesCrossFrequencyCoupling/ bz_PhaseAmplitudeDist.m - buzcodeAddOns/
analysis/ , MATLAB, 494 linesRankOrder/ bz_RankOrder.m - buzcodeAddOns/
analysis/ , MATLAB, 430 linesSharpWaveRipples/ bz_FindRipples.m - buzcodeAddOns/
analysis/ , MATLAB, 21 linesSharpWaveRipples/ bz_GetBestRippleChan.m - buzcodeAddOns/
analysis/ , MATLAB, 216 linesSharpWaveRipples/ bz_PlotRippleStats.m - buzcodeAddOns/
analysis/ , MATLAB, 127 linesSharpWaveRipples/ bz_RippleStats.m - buzcodeAddOns/
analysis/ , MATLAB, 165 linesSharpWaveRipples/ bz_getRipSpikes.m - buzcodeAddOns/
analysis/ , MATLAB, 1,488 linesSharpWaveRipples/ detect_swr/ bz_DetectSWR.m - buzcodeAddOns/
analysis/ , MATLAB, 1,202 linesSharpWaveRipples/ detect_swr/ detect_swr.m - buzcodeAddOns/
analysis/ , MATLAB, 243 linesSharpWaveRipples/ detect_swr/ private/ LoadBinary.m - buzcodeAddOns/
analysis/ , MATLAB, 109 linesSharpWaveRipples/ detect_swr/ private/ LoadXml.m - buzcodeAddOns/
analysis/ , MATLAB, 26 linesSharpWaveRipples/ detect_swr/ private/ firfilt.m - buzcodeAddOns/
analysis/ , MATLAB, 122 linesSharpWaveRipples/ detect_swr/ private/ logAnalysisFile.m - buzcodeAddOns/
analysis/ , MATLAB, 116 linesSharpWaveRipples/ detect_swr/ private/ makefir.m - buzcodeAddOns/
analysis/ , MATLAB, 35 linesSharpWaveRipples/ detect_swr/ private/ makegausslpfir.m - buzcodeAddOns/
analysis/ , MATLAB, 41 linesSharpWaveRipples/ detect_swr/ private/ parseArgs.m - buzcodeAddOns/
analysis/ , MATLAB, 25 linesSharpWaveRipples/ detect_swr/ private/ suprathresh.m - buzcodeAddOns/
analysis/ , MATLAB, 362 linesSharpWaveRipples/ detect_swr/ private/ v2struct.m - buzcodeAddOns/
analysis/ , MATLAB, 142 linesSharpWaveRipples/ detect_swr/ private/ v2structDemo1.m - buzcodeAddOns/
analysis/ , MATLAB, 77 linesSharpWaveRipples/ detect_swr/ private/ v2structDemo2.m - buzcodeAddOns/
analysis/ , MATLAB, 470 linesSharpWaveRipples/ detect_swr/ private/ xmltools.m - buzcodeAddOns/
analysis/ , MATLAB, 39 linesSpectralAnalyses/ MorletWavelet.m - buzcodeAddOns/
analysis/ , MATLAB, 188 linesSpectralAnalyses/ bz_MTCoherogram.m - buzcodeAddOns/
analysis/ , MATLAB, 210 linesSpectralAnalyses/ bz_WaveSpec.m - buzcodeAddOns/
analysis/ , MATLAB, 211 linesSpectralAnalyses/ bz_eventWavelet.m - buzcodeAddOns/
analysis/ , MATLAB, 139 linesSpectralAnalyses/ bz_whitenLFP.m - buzcodeAddOns/
analysis/ , MATLAB, 144 linesassemblies/ bz_peerPrediction.m - buzcodeAddOns/
analysis/ , MATLAB, 112 linescellTypeClassification/ BrendonClassificationFro mStark2013/ ClusterPointsBoundaryOut BW.m - buzcodeAddOns/
analysis/ , MATLAB, 40 linescellTypeClassification/ BrendonClassificationFro mStark2013/ DefaultArgs.m - buzcodeAddOns/
analysis/ , MATLAB, 62 linescellTypeClassification/ BrendonClassificationFro mStark2013/ PointInput.m - buzcodeAddOns/
analysis/ , MATLAB, 223 linescellTypeClassification/ BrendonClassificationFro mStark2013/ bz_CellClassification.m - buzcodeAddOns/
analysis/ , MATLAB, 414 linescellTypeClassification/ BrendonClassificationFro mStark2013/ getWavelet.m - buzcodeAddOns/
analysis/ , MATLAB, 153 linescellTypeClassification/ bz_CellMetricsSimple.m - buzcodeAddOns/
analysis/ , MATLAB, 148 lineslfp_general/ bz_CSD.m - buzcodeAddOns/
analysis/ , MATLAB, 15 lineslfp_general/ bz_DownsampleLFP.m - buzcodeAddOns/
analysis/ , MATLAB, 291 lineslfp_general/ bz_Filter.m - buzcodeAddOns/
analysis/ , MATLAB, 170 lineslfp_general/ bz_GradDescCluster.m - buzcodeAddOns/
analysis/ , MATLAB, 165 lineslfp_general/ bz_LFPPowerDist.m - buzcodeAddOns/
analysis/ , MATLAB, 310 lineslfp_general/ bz_LFPSpecToExternalVar. m - buzcodeAddOns/
analysis/ , MATLAB, 333 lineslfp_general/ bz_PowerSpectrumSlope.m - buzcodeAddOns/
analysis/ , MATLAB, 95 lineslfp_general/ bz_RunIca.m - buzcodeAddOns/
analysis/ , MATLAB, 172 lineslfp_general/ bz_eventCSD.m - buzcodeAddOns/
analysis/ , MATLAB, 126 lineslfp_general/ bz_multishankEventCSD.m - buzcodeAddOns/
analysis/ , MATLAB, 166 linesmonosynapticPairs/ CCG.m - buzcodeAddOns/
analysis/ , C, 203 linesmonosynapticPairs/ CCGHeart.c - buzcodeAddOns/
analysis/ , MATLAB, 99 lines, 2 matchesmonosynapticPairs/ bz_GetMonoSynapticallyCo nnected.m - buzcodeAddOns/
analysis/ , MATLAB, 227 linesmonosynapticPairs/ bz_GetSynapsembles.m - buzcodeAddOns/
analysis/ , MATLAB, 328 linesmonosynapticPairs/ bz_MonoSynConvClick.m - buzcodeAddOns/
analysis/ , MATLAB, 173 linesmonosynapticPairs/ bz_PlotMonoSyn.m - buzcodeAddOns/
analysis/ , MATLAB, 143 linesmonosynapticPairs/ bz_cch_conv.m - buzcodeAddOns/
analysis/ , MATLAB, 294 lines, 1 matchmonosynapticPairs/ bz_fitPoissPlasticity.m - buzcodeAddOns/
analysis/ , MATLAB, 29 linesmonosynapticPairs/ utils/ calculate_X.m - buzcodeAddOns/
analysis/ , MATLAB, 44 linesmonosynapticPairs/ utils/ getCubicBSplineBasis.m - buzcodeAddOns/
analysis/ , MATLAB, 21 linesmonosynapticPairs/ utils/ nll_poissPlasticity.m - buzcodeAddOns/
analysis/ , MATLAB, 213 linesplaceFields/ KalmanVel.m - buzcodeAddOns/
analysis/ , MATLAB, 344 linesplaceFields/ bz_findPlaceFields1D.m - buzcodeAddOns/
analysis/ , MATLAB, 163 linesplaceFields/ bz_findPlaceFieldsTempla te.m - buzcodeAddOns/
analysis/ , MATLAB, 130 linesplaceFields/ bz_firingMap1D.m - buzcodeAddOns/
analysis/ , MATLAB, 154 linesplaceFields/ bz_firingMapAvg.m - buzcodeAddOns/
analysis/ , MATLAB, 84 linesplaceFields/ bz_getPlaceFields.m - buzcodeAddOns/
analysis/ , MATLAB, 106 linesplaceFields/ bz_getPlaceFields1D.m - buzcodeAddOns/
analysis/ , MATLAB, 275 linespositionDecoding/ bz_positionDecodingBayes ian.m - buzcodeAddOns/
analysis/ , MATLAB, 214 linespositionDecoding/ bz_positionDecodingGLM.m - buzcodeAddOns/
analysis/ , MATLAB, 218 linespositionDecoding/ bz_positionDecodingGLM_g auss.m - buzcodeAddOns/
analysis/ , MATLAB, 314 linespositionDecoding/ bz_positionDecodingMaxCo rr.m - buzcodeAddOns/
analysis/ , MATLAB, 216 linespositionDecoding/ bz_positionDecodingTheta Seq.m - buzcodeAddOns/
analysis/ , MATLAB, 40 linespositionDecoding/ placeBayes.m - buzcodeAddOns/
analysis/ , MATLAB, 309 linesspikeLFPcoupling/ PhaseModulation.m - buzcodeAddOns/
analysis/ , MATLAB, 778 linesspikeLFPcoupling/ bz_GenSpikeLFPCoupling.m - buzcodeAddOns/
analysis/ , MATLAB, 264 linesspikeLFPcoupling/ bz_ISILFPMap.m - buzcodeAddOns/
analysis/ , MATLAB, 305 linesspikeLFPcoupling/ bz_PhaseModulation.m - buzcodeAddOns/
analysis/ , MATLAB, 181 linesspikeLFPcoupling/ bz_PowerPhaseRatemap.m - buzcodeAddOns/
analysis/ , MATLAB, 116 linesspikes/ bz_PETH_Spikes.m - buzcodeAddOns/
analysis/ , MATLAB, 7 linesspikes_general/ Contents.m - buzcodeAddOns/
analysis/ , MATLAB, 57 linesspikes_general/ GetSNR.m - buzcodeAddOns/
analysis/ , MATLAB, 35 linesspikes_general/ InterSpikeIntervals/ GSASmodel.m - buzcodeAddOns/
analysis/ , MATLAB, 504 linesspikes_general/ InterSpikeIntervals/ bz_FitISISharedGammaMode s.m - buzcodeAddOns/
analysis/ , MATLAB, 452 linesspikes_general/ InterSpikeIntervals/ bz_ISIStats.m - buzcodeAddOns/
analysis/ , MATLAB, 28 linesspikes_general/ InterSpikeIntervals/ convertGSASparms.m - buzcodeAddOns/
analysis/ , MATLAB, 26 linesspikes_general/ InterSpikeIntervals/ ksstat.m - buzcodeAddOns/
analysis/ , MATLAB, 53 linesspikes_general/ IsolationDistance.m - buzcodeAddOns/
analysis/ , MATLAB, 42 linesspikes_general/ L_Ratio.m - buzcodeAddOns/
analysis/ , MATLAB, 157 linesspikes_general/ burst_cls_kmeans.m - buzcodeAddOns/
analysis/ , MATLAB, 292 linesspikes_general/ bz_ConditionalISI.m - buzcodeAddOns/
analysis/ , MATLAB, 148 linesspikes_general/ bz_FindPopBursts.m - buzcodeAddOns/
analysis/ , MATLAB, 59 linesspikes_general/ bz_JitterSpiketimes.m - buzcodeAddOns/
analysis/ , MATLAB, 190 linesspikes_general/ bz_SpktToSpkmat.m - buzcodeAddOns/
analysis/ , MATLAB, 174 linesspikes_general/ bz_compareReplay.m - buzcodeAddOns/
analysis/ , MATLAB, 87 linesspikes_general/ bz_olypherInfo.m - buzcodeAddOns/
analysis/ , MATLAB, 107 linesspikes_general/ bz_phaseMap1D.m - buzcodeAddOns/
analysis/ , MATLAB, 121 linesspikes_general/ calc_PSTH.m - buzcodeAddOns/
bz_ExplainedVariance.m , MATLAB, 110 lines - buzcodeAddOns/
bz_SelectRegions.m , MATLAB, 34 lines - buzcodeAddOns/
chi2tbltest.m , MATLAB, 19 lines - buzcodeAddOns/
collect_results.m , MATLAB, 36 lines - buzcodeAddOns/
customBoxPlot.m , MATLAB, 51 lines - buzcodeAddOns/
detectors/ , MATLAB, 297 linesbz_EMGFromLFP.m - buzcodeAddOns/
detectors/ , MATLAB, 484 linesdetectBehavior/ detect_pupilDilation/ GetPupilDilation.m - buzcodeAddOns/
detectors/ , MATLAB, 15 linesdetectBehavior/ detect_vocalizations/ chirpDetector.m - buzcodeAddOns/
detectors/ , MATLAB, 487 linesdetectBehavior/ detect_whisking/ GetWhiskFromEMG.m - buzcodeAddOns/
detectors/ , MATLAB, 263 linesdetectBehavior/ detect_whisking/ GetWhiskFromPiezo.m - buzcodeAddOns/
detectors/ , MATLAB, 887 linesdetectEvents/ DetectSlowWaves.m - buzcodeAddOns/
detectors/ , MATLAB, 358 linesdetectEvents/ detectUD.m - buzcodeAddOns/
detectors/ , MATLAB, 134 lines, 1 matchdetectStates/ SleepScoreMaster/ ClusterStates_DetermineS tates.m - buzcodeAddOns/
detectors/ , MATLAB, 380 linesdetectStates/ SleepScoreMaster/ ClusterStates_GetMetrics .m - buzcodeAddOns/
detectors/ , MATLAB, 272 linesdetectStates/ SleepScoreMaster/ ClusterStates_MakeFigure .m - buzcodeAddOns/
detectors/ , MATLAB, 114 linesdetectStates/ SleepScoreMaster/ ConvertTwoLFPFilessToOne .m - buzcodeAddOns/
detectors/ , MATLAB, 23 linesdetectStates/ SleepScoreMaster/ IDStateEpisode.m - buzcodeAddOns/
detectors/ , MATLAB, 508 linesdetectStates/ SleepScoreMaster/ PickSWTHChannel.m - buzcodeAddOns/
detectors/ , MATLAB, 333 linesdetectStates/ SleepScoreMaster/ SleepScoreMaster.m - buzcodeAddOns/
detectors/ , MATLAB, 47 linesdetectStates/ SleepScoreMaster/ StateEditorToInts.m - buzcodeAddOns/
detectors/ , MATLAB, 143 linesdetectStates/ SleepScoreMaster/ StatesToEpisodes.m - buzcodeAddOns/
detectors/ , MATLAB, 113 linesdetectStates/ SleepScoreMaster/ TestsAndExamples/ CompareRecordingPC1.m - buzcodeAddOns/
detectors/ , MATLAB, 127 linesdetectStates/ SleepScoreMaster/ TestsAndExamples/ CompareScore.m - buzcodeAddOns/
detectors/ , MATLAB, 40 linesdetectStates/ SleepScoreMaster/ private/ DefaultArgs_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 14 linesdetectStates/ SleepScoreMaster/ private/ FileExists_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 35 linesdetectStates/ SleepScoreMaster/ private/ IDXtoINT_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 256 linesdetectStates/ SleepScoreMaster/ private/ LoadBinary_Down_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 87 linesdetectStates/ SleepScoreMaster/ private/ LoadPar_SleepScore.m - buzcodeAddOns/
detectors/ , MATLAB, 109 linesdetectStates/ SleepScoreMaster/ private/ LoadXml_SleepScore.m - buzcodeAddOns/
detectors/ , MATLAB, 38 linesdetectStates/ SleepScoreMaster/ private/ LogScale_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 34 linesdetectStates/ SleepScoreMaster/ private/ MergeSeparatedInts_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 68 linesdetectStates/ SleepScoreMaster/ private/ RainbowColors_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 49 linesdetectStates/ SleepScoreMaster/ private/ ReadBadChannels_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 19 linesdetectStates/ SleepScoreMaster/ private/ chkinputdatatype_SleepSc ore.m - buzcodeAddOns/
detectors/ , MATLAB, 22 linesdetectStates/ SleepScoreMaster/ private/ diptest/ hartigansdiptestdemo.m - buzcodeAddOns/
detectors/ , MATLAB, 919 linesdetectStates/ SleepScoreMaster/ private/ findpeaks_SleepScore.m - buzcodeAddOns/
detectors/ , MATLAB, 30 linesdetectStates/ SleepScoreMaster/ private/ hartigansdipsigniftest_s s.m - buzcodeAddOns/
detectors/ , MATLAB, 302 linesdetectStates/ SleepScoreMaster/ private/ hartigansdiptest_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 57 linesdetectStates/ SleepScoreMaster/ private/ isdscalar_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 61 linesdetectStates/ SleepScoreMaster/ private/ isiscalar_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 75 linesdetectStates/ SleepScoreMaster/ private/ isivector_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 42 linesdetectStates/ SleepScoreMaster/ private/ isstring_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 48 linesdetectStates/ SleepScoreMaster/ private/ readmulti_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 467 linesdetectStates/ SleepScoreMaster/ private/ xmltools_ss.m - buzcodeAddOns/
detectors/ , MATLAB, 110 linesdetectStates/ bz_ThetaStates.m - buzcodeAddOns/
discrete_radon.m , MATLAB, 155 lines - buzcodeAddOns/
discrete_radon_wRandomiz , MATLAB, 123 linesation.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 40 linescolorCode2rgb.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 134 linescountEntries.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 152 linesdistinguishable_colors.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 966 linesdistributionPlot.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 25 linesisEven.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 264 linesmyErrorbar.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 212 linesmyHistogram.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 703 linesplotSpread.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 140 linesrepeatEntries.m - buzcodeAddOns/
distributionPlot/ , MATLAB, 154 linesweightedStats.m - buzcodeAddOns/
findClosestTS.m , MATLAB, 11 lines - buzcodeAddOns/
find_HSE.m , MATLAB, 217 lines - buzcodeAddOns/
find_HSE2.m , MATLAB, 109 lines - buzcodeAddOns/
infer_behavior_type.m , MATLAB, 42 lines - buzcodeAddOns/
io/ , MATLAB, 32 linesSaveFeatures.m - buzcodeAddOns/
io/ , MATLAB, 22 linesbz_BasenameFromBasepath. m - buzcodeAddOns/
io/ , MATLAB, 223 linesbz_GetLFP.m - buzcodeAddOns/
io/ , MATLAB, 546 linesbz_GetSpikes.m - buzcodeAddOns/
io/ , MATLAB, 111 linesbz_GetWidebandData.m - buzcodeAddOns/
io/ , MATLAB, 253 linesbz_LFPfromDat.m - buzcodeAddOns/
io/ , MATLAB, 125 linesbz_LoadAnalysisResults.m - buzcodeAddOns/
io/ , MATLAB, 54 linesbz_LoadBehavior.m - buzcodeAddOns/
io/ , MATLAB, 260 linesbz_LoadBinary.m - buzcodeAddOns/
io/ , MATLAB, 158 linesbz_LoadCellinfo.m - buzcodeAddOns/
io/ , MATLAB, 56 linesbz_LoadEvents.m - buzcodeAddOns/
io/ , MATLAB, 218 linesbz_LoadPhy.m - buzcodeAddOns/
io/ , MATLAB, 46 linesbz_LoadStates.m - buzcodeAddOns/
io/ , MATLAB, 242 linesbz_getAnalogPulses.m - buzcodeAddOns/
io/ , MATLAB, 146 linesbz_getDigitalIn.m - buzcodeAddOns/
io/ , MATLAB, 207 linesbz_getIntanAccel.m - buzcodeAddOns/
io/ , MATLAB, 102 linesbz_getSessionInfo.m - buzcodeAddOns/
io/ , MATLAB, 105 linesbz_getZeitgeberTime.m - buzcodeAddOns/
io/ , MATLAB, 42 linesbz_tagChannel.m - buzcodeAddOns/
isupdated.m , MATLAB, 25 lines - buzcodeAddOns/
local2remote.m , MATLAB, 19 lines - buzcodeAddOns/
makeRadialMazeMaps.m , MATLAB, 111 lines, 1 match - buzcodeAddOns/
radial_reactivation.m , MATLAB, 210 lines - buzcodeAddOns/
run_THpipeline.m , MATLAB, 352 lines - buzcodeAddOns/
spatial_info.m , MATLAB, 25 lines - buzcodeAddOns/
sync_datasets.m , MATLAB, 94 lines - buzcodeAddOns/
template.m , MATLAB, 45 lines - buzcodeAddOns/
upsample_cellMetrics.m , MATLAB, 39 lines - buzcodeAddOns/
visualization/ , MATLAB, 59 linesBoxAndScatterPlot.m - buzcodeAddOns/
visualization/ , MATLAB, 55 linesColorbarWithAxis.m - buzcodeAddOns/
visualization/ , MATLAB, 146 linesLogScale.m - buzcodeAddOns/
visualization/ , MATLAB, 44 linesNiceSave.m - buzcodeAddOns/
visualization/ , MATLAB, 104 linesScatterWithLinFit.m - buzcodeAddOns/
visualization/ , MATLAB, 17 linesSpecColorRange.m - buzcodeAddOns/
visualization/ , MATLAB, 23 linesUnityLine.m - buzcodeAddOns/
visualization/ , MATLAB, 195 linesbarweb.m - buzcodeAddOns/
visualization/ , MATLAB, 359 linesboundedline.m - buzcodeAddOns/
visualization/ , MATLAB, 26 linesbz_Counter.m - buzcodeAddOns/
visualization/ , MATLAB, 281 linesbz_MultiLFPPlot.m - buzcodeAddOns/
visualization/ , MATLAB, 40 linesbz_NormToRange.m - buzcodeAddOns/
visualization/ , MATLAB, 15 linesbz_ScaleBar.m - buzcodeAddOns/
visualization/ , MATLAB, 28 linesbz_piTickLabel.m - buzcodeAddOns/
visualization/ , MATLAB, 172 linesbz_plotEphys.m - buzcodeAddOns/
visualization/ , MATLAB, 34 linesbz_plotRasterTrial.m - buzcodeAddOns/
visualization/ , MATLAB, 53 linesbz_plotTrials.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ BlueColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ BlueGreenColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ GrayColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ GreenColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ OrangeColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ OrangeConfinedColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ OrangeRedColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ PurpleColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ RedColors.m - buzcodeAddOns/
visualization/ , MATLAB, 16 linescolormaps/ ColorPaletteGenerators/ RedPurpleColors.m - buzcodeAddOns/
visualization/ , MATLAB, 14 linescolormaps/ ColorPaletteGenerators/ StateColors.m - buzcodeAddOns/
visualization/ , MATLAB, 122 linescolormaps/ bluewhitered.m - buzcodeAddOns/
visualization/ , MATLAB, 158 linescolormaps/ crameri/ crameri.m - buzcodeAddOns/
visualization/ , MATLAB, 114 linescolormaps/ crameri/ crameri_documentation.m - buzcodeAddOns/
visualization/ , MATLAB, 94 linescolormaps/ makeColorMap/ makeColorMap.m - buzcodeAddOns/
visualization/ , MATLAB, 120 linesdemo_sigstar.m - buzcodeAddOns/
visualization/ , MATLAB, 164 linesmtit.m - buzcodeAddOns/
visualization/ , MATLAB, 515 linesplotSpikeRaster.m - buzcodeAddOns/
visualization/ , MATLAB, 85 linesrasterplot.m - buzcodeAddOns/
visualization/ , MATLAB, 120 linesscattercloud.m - buzcodeAddOns/
visualization/ , MATLAB, 307 linessigstar.m - buzcodeAddOns/
visualization/ , MATLAB, 61 linestight_subplot.m - readme.md, Text, 3 lines
soltesz-lab/DG-Interneurons
160ca41868460bbf0770ff6e842b2da10d2b8eed, 16 March 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
30 files
- DG_analysis.py, Python, 4,013 lines
- DG_batch_circuit_dendrit
ic_somatic_transfer.py , Python, 899 lines - DG_circuit_dendritic_som
atic_transfer.py , Python, 1,479 lines, 1 match - DG_circuit_optimization.
py , Python, 2,008 lines - DG_circuit_optogenetic_o
ptimization.py , Python, 2,951 lines, 1 match - DG_optimization_analysis
.py , Python, 1,615 lines - DG_protocol.py, Python, 3,776 lines, 1 match
- DG_visualization.py, Python, 2,933 lines
- ablation_tests.py, Python, 2,376 lines
- adaptive_pso.py, Python, 911 lines
- demo_adaptive_pso.py, Python, 330 lines
- dendritic_somatic_networ
k_clamp.py , Python, 969 lines, 1 match - dendritic_somatic_transf
er.py , Python, 674 lines, 1 match - effect_size_decision_fra
mework.py , Python, 862 lines - gradient_adaptive_steppe
r.py , Python, 404 lines - hdf5_storage.py, Python, 485 lines
- nested_effect_size.py, Python, 947 lines
- nested_experiment.py, Python, 3,798 lines
- nested_weights_analysis.
py , Python, 1,851 lines - nested_weights_dist_anal
ysis.py , Python, 2,919 lines - optogenetic_experiment.p
y , Python, 1,576 lines, 1 match - pca_input_weight_pattern
s.py , Python, 1,294 lines - statistical_testing.py, Python, 4,277 lines, 1 match
- statistical_testing_weig
hts.py , Python, 713 lines - test_adaptive_batch_opti
mization.py , Python, 105 lines - test_adaptive_optimizati
on.py , Python, 81 lines - test_adaptive_optogeneti
c_optimization.py , Python, 905 lines - test_adaptive_pso.py, Python, 704 lines
- LICENSE, License, 674 lines
- README.md, Text, 470 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 624 scripts, each with its path and the digest of its content;
- 40 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Code and data availability statement
The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: soltesz-lab/
DG-Interneurons , ThomasHainmueller/HainmuellerHeynold_et_al _2025 - it says that the data are available on request
- it says that the code is available on request
Read it in the paper: doi.org/10.1016/j.neuron.2026.03.034.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 9 keywords, 13 MeSH terms, 8 funders, 91 references.
Cite
This paper
Hainmueller, T., Heynold, E. A., Paleologos, N., Raikov, I. G., Soltesz, I., & Buzsáki, G. (2026). Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice. Neuron, 114(17), 3280-3294.e7. https://
BibTeX
@article{hainmueller2026
author = {Hainmueller, Thomas and Heynold, Elisabeth A. and Paleologos, Nicholas and Raikov, Ivan G. and Soltesz, Ivan and Buzsáki, György},
title = {{Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice}},
journal = {Neuron},
year = {2026},
month = apr,
volume = {114},
number = {17},
pages = {3280--3294.e7},
publisher = {Cell Press},
issn = {0896-6273},
doi = {10.1016/
url = {https://
pmid = {42013854},
pmcid = {PMC13186253}
}
RIS
TY - JOUR
AU - Hainmueller, Thomas
AU - Heynold, Elisabeth A.
AU - Paleologos, Nicholas
AU - Raikov, Ivan G.
AU - Soltesz, Ivan
AU - Buzsáki, György
TI - Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice
T2 - Neuron
J2 - Neuron
PY - 2026
DA - 2026/
VL - 114
IS - 17
SP - 3280
EP - 3294.e7
SN - 0896-6273
PB - Cell Press
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice",
"container-title": "Neuron",
"author": [
{
"family": "Hainmueller",
"given": "Thomas"
},
{
"family": "Heynold",
"given": "Elisabeth A."
},
{
"family": "Paleologos",
"given": "Nicholas"
},
{
"family": "Raikov",
"given": "Ivan G."
},
{
"family": "Soltesz",
"given": "Ivan"
},
{
"family": "Buzsáki",
"given": "György"
}
],
"container-title-short":
"volume": "114",
"issue": "17",
"page": "3280-3294.e7",
"DOI": "10.1016/
"PMID": "42013854",
"PMCID": "PMC13186253",
"ISSN": "0896-6273",
"publisher": "Cell Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
20
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1523/jneurosci.2001-25.2026 [code]
- Dynamics of Dentate Gyrus Place Cells and Dentate Spikes during Spatial and Nonspatial Changes in Environments.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: Chronux, CircStat, Curve Fitting Toolbox, 9 other tools, systems, 11 references
- [2] doi:10.1016/j.celrep.2026.117646 [code]
- Medial entorhinal-hippocampal desynchronization parallels the emergence of memory impairment in a mouse model of Alzheimer's disease pathology.Journal: Cell reportsIn common: Chronux, boundedline, CircStat, 11 other tools, systems, mouse, 4 references
- [3] doi:10.1038/s41593-026-02357-2 [code]
- Experience reorganizes content-specific memory traces in macaques.Journal: Nature neuroscienceIn common: Chronux, boundedline, CircStat, 13 other tools, 3 references
- [4] doi:10.1038/s41467-026-75347-4 [code]
- Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.Journal: Nature communicationsIn common: Chronux, boundedline, CircStat, 13 other tools, systems, mouse, 2 references
- [5] doi:10.1038/s41467-026-73106-z [code]
- Respiratory pauses highlight sleep architecture in mice.Journal: Nature communicationsIn common: Chronux, boundedline, CircStat, 11 other tools, mouse, 2 references
- [6] doi:10.64898/2026.03.12.710517 [code]
- Cortical excitability inversely modulates fMRI connectivity via low-frequency neuronal couplingJournal: bioRxiv (preprint)In common: Chronux, shadedErrorBar, CircStat, 11 other tools, systems, 1 reference
- [7] doi:10.1016/j.patter.2026.101590 [code]
- Density-based longitudinal neuron tracking in high-density electrophysiological recordings.Journal: Patterns (New York, N.Y.)In common: shadedErrorBar, CircStat, Optimization Toolbox, 11 other tools, 2 references
- [8] doi:10.1038/s41593-026-02388-9 [code]
- Hippocampal CA3 connectomics reveals a gradient of mossy fiber inputs and selective feedforward inhibition onto pyramidal cells.Journal: Nature neuroscienceIn common: NetworkX, PyTorch, seaborn, 5 other tools, systems, mouse, 7 references
- [9] doi:10.1126/sciadv.aeh7220 [code]
- Central complex representations of self-movement are sufficient to compute wind direction in flight.Journal: Science advancesIn common: shadedErrorBar, CircStat, Curve Fitting Toolbox, 11 other tools
- [10] doi:10.1038/s41467-026-76581-6 [code]
- Thalamocortical bursts encode reward contingencies and drive associative learning.Journal: Nature communicationsIn common: CircStat, Curve Fitting Toolbox, h5py, 8 other tools, systems, mouse, 3 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 624 scripts, and 40 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:cf0ec29bae1bdda8…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
