Skip to content

Commit

Permalink
Merge pull request #109 from SaraMati/DisplayIntervalMonoSyn
Browse files Browse the repository at this point in the history
display interval CCGs for MonoSyn. fix bug in save metrics
  • Loading branch information
petersenpeter authored Dec 3, 2024
2 parents 3f39141 + d1dc06f commit fab2efd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions CellExplorer.m
Original file line number Diff line number Diff line change
Expand Up @@ -12363,7 +12363,13 @@ function adjustMonoSyn_UpdateMetrics(~,~)
end
end

MonoSynFile = fullfile(path1,[basename1,'.mono_res.cellinfo.mat']);
if isfield(general,'saveAs')
saveAs = general.saveAs;
MonoSynFile = fullfile(path1,[basename1,'.mono_res',erase(saveAs,'cell_metrics'),'.cellinfo.mat']);
else
MonoSynFile = fullfile(path1,[basename1,'.mono_res.cellinfo.mat']);
end

if exist(MonoSynFile,'file')
ce_waitbar = waitbar(0,'Loading MonoSyn file','name','CellExplorer');
load(MonoSynFile,'mono_res');
Expand Down Expand Up @@ -12419,7 +12425,7 @@ function adjustMonoSyn_UpdateMetrics(~,~)
[a,b]=hist(cell_session.cell_metrics.putativeConnections.excitatory(:,2),unique(cell_session.cell_metrics.putativeConnections.excitatory(:,2)));
cell_session.cell_metrics.synapticConnectionsIn(b) = a; cell_session.cell_metrics.synapticConnectionsIn = cell_session.cell_metrics.synapticConnectionsIn(1:cell_session.cell_metrics.general.cellCount);

saveStruct(cell_session,'cellinfo','basename',basename1,'basepath',path1,'dataName',saveAs);
saveStruct(cell_session.cell_metrics,'cellinfo','basename',basename1,'basepath',path1,'dataName',saveAs);

if ishandle(ce_waitbar)
waitbar(0.9,ce_waitbar,'Updating session');
Expand Down
6 changes: 5 additions & 1 deletion calc_CellMetrics/saveStruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
case 'mat'
% MATLABs own mat format
% Saving to a struct to maintain intented variable name
S.(dataName) = data;
if contains(dataName,'cell_metrics') % this is to not create cell_metrics.intervalName fir intervals (if the saveAs is cell_metrics.intervalName, e.g.cell_metrics_NREM)
S.('cell_metrics') = data;
else
S.(dataName) = data;
end

% Checks byte size of struct to determine optimal mat format
structSize = whos('S');
Expand Down

0 comments on commit fab2efd

Please sign in to comment.