Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitattributes

This file was deleted.

271 changes: 36 additions & 235 deletions GUIs/CellDataCurator.m

Large diffs are not rendered by default.

1,003 changes: 1,003 additions & 0 deletions GUIs/CellDataCurator_newer.m

Large diffs are not rendered by default.

84 changes: 4 additions & 80 deletions GUIs/LabDataGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

%copy newer versions of local cellData files to server
if SYNC_TO_SERVER
syncLocalCellDataToServer();
%syncLocalCellDataToServer();
end

%read in CellTags.txt file
Expand All @@ -93,7 +93,7 @@

obj.buildUIComponents();
obj.loadCellNames();
try % this will error when displays are weird
try % this will error when
obj.loadTree();
catch
disp('loadTree stumbled on multi-display configuration. Resize the window to continue');
Expand Down Expand Up @@ -458,11 +458,6 @@ function buildUIComponents(obj)
'String', 'Load filter', ...
'FontSize', 12, ...
'Callback', @(uiobj,evt)obj.loadFilter);
obj.handles.loadFilterListButton = uicontrol('Parent', L_filterControls, ...
'Style', 'pushbutton', ...
'String', 'Load list & analyze', ...
'FontSize', 10, ...
'Callback', @(uiobj,evt)obj.loadFilterList);

set(L_filterBox, 'Sizes', [-1, 25, -2, 25, 25, -2, 25, 40]);

Expand Down Expand Up @@ -616,11 +611,8 @@ function cellSelectedFcn(obj)
obj.updateCellPositionTable();

%set online label
if ~iscell(obj.curCellData.get('label'))
set(obj.handles.labelTextVal, 'String', sprintf('Label: %s', obj.curCellData.get('label')));
else
set(obj.handles.labelTextVal, 'String', sprintf('S2 Online Type: %s',obj.curCellData.get('type')));
end
set(obj.handles.labelTextVal, 'String', obj.curCellData.get('label'));

%set notes
set(obj.handles.notesTextVal, 'String', obj.curCellData.notes);

Expand Down Expand Up @@ -867,74 +859,6 @@ function loadFilter(obj)
end
end

function loadFilterList(obj)
disp(obj.labData.allCellTypes)
global ANALYSIS_FOLDER;
[fname,fpath] = uigetfile(ANALYSIS_FOLDER,'Load filter file');
if ~isempty(fname) %if selected something
load(fullfile(fpath, fname))

for fi = 1:length(filterFileNames)
fname = filterFileNames{fi};
fprintf('Loading filter %g of %g, %s\n', fi, length(filterFileNames), fname);

% load filter
load(fname, 'filterData', 'filterPatternString','analysisType', 'cellType');

epochFilt = SearchQuery();
% epochFilter.fieldnames = {};
% epochFilter.operators = {};
for i=1:size(filterData,1)
if ~isempty(filterData{i,1})
epochFilt.fieldnames{i} = filterData{i,1};
epochFilt.operators{i} = filterData{i,2};

value_str = filterData{i,3};
if isempty(value_str)
value = [];
elseif strfind(value_str, ',')
z = 1;
r = value_str;
while ~isempty(r)
[token, r] = strtok(r, ',');
value{z} = strtrim(token);
z=z+1;
end
else
value = str2num(value_str); %#ok<ST2NM>
end

epochFilt.values{i} = value;
end
end
epochFilt.pattern = filterPatternString;

if strcmp(cellType, 'All')
cellType = obj.labData.allCellTypes;
end

cellFilt = [];

% analysisType
% epochFilt
tempTree = obj.labData.collectAnalysis(analysisType, cellType, cellFilt, epochFilt);

% save tree

analysisTree = tempTree;

sfile = fullfile('analysisTrees/automaticData/treeData/', num2str(fi));
save(sfile, 'analysisTree');
disp(['Saved analysis tree to ' sfile]);

end
disp('Done with all files');

end
end



function loadCellNames(obj)
cellDataFolder = obj.cellData_folder;

Expand Down
4 changes: 0 additions & 4 deletions GUIs/SpikeDetectorGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,6 @@ function updateUI(obj)
plot(obj.handles.ax, 1:length(obj.data), obj.data, 'k');
hold(obj.handles.ax, 'on');
plot(obj.handles.ax, obj.spikeTimes, obj.data(obj.spikeTimes), 'rx', 'MarkerSize', 15, 'linewidth', 4);
if strcmp(obj.mode, 'Simple threshold')
xax = xlim();
line(xax, [1,1]*obj.threshold, 'LineStyle', '--');
end
hold(obj.handles.ax, 'off');
displayName = obj.cellData.epochs(obj.epochInd(obj.curEpochInd)).get('displayName');
set(obj.fig, 'Name',['Spike Detector: Epoch ' num2str(obj.epochInd(obj.curEpochInd)) ' (' displayName '): ' num2str(length(obj.spikeTimes)) ' spikes']);
Expand Down
96 changes: 45 additions & 51 deletions GUIs/TreeBrowserGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function setEpochTags(obj, tagName, tagVal)
curNode = obj.analysisTree.get(curNodeIndex);
figName = get(obj.handles.fig, 'Name');
%4 cases: at data set level, at cell level, below data set level, above cell level
if isfield(curNode, 'cellName') %at data set cell level
if isfield(curNode, 'cellName') %at data set cell level
curCellName = curNode.cellName;
epochIDs = [];
treePart = obj.analysisTree.subtree(curNodeIndex);
Expand Down Expand Up @@ -404,7 +404,7 @@ function setEpochTags(obj, tagName, tagVal)
%get siglings of parent (actual cell level instead of
%dataset level
siblings = obj.analysisTree.getsiblings(obj.analysisTree.getparent(childInd));
for c = 1:length(siblings)
for c = 1:length(siblings);
dataSetNodeInd = obj.analysisTree.getchildren(siblings(c));
for d=1:length(dataSetNodeInd)
curNodeIndex = dataSetNodeInd(d);
Expand Down Expand Up @@ -588,7 +588,7 @@ function makePlotSelectionTable(obj)
end

function resetPlotControls(obj)
if isfield(obj.handles, 'L_plotXY_box')
if isfield(obj.handles, 'L_plotXY_box');
delete(obj.handles.L_plotXY_box);
set(obj.handles.L_plotControls, 'Sizes', [-1, 40, 40, 40]);
end
Expand All @@ -597,7 +597,7 @@ function resetPlotControls(obj)
function addXYselectionToPlotControls(obj, xList, yList)
plotControls_children = get(obj.handles.L_plotControls, 'children');
for i=1:length(plotControls_children)
if ~strcmp(get(plotControls_children(i), 'Tag'), 'plotSelectionMenu')
if ~strcmp(get(plotControls_children(i), 'Tag'), 'plotSelectionMenu');
delete(plotControls_children(i));
end
end
Expand Down Expand Up @@ -650,12 +650,12 @@ function updatePlot(obj)
selectedNodes = get(obj.guiTree, 'selectedNodes');
curNodeIndex = get(selectedNodes(1), 'Value');
plotClass = obj.plotSelectionTable{curNodeIndex, 1};
if isempty(plotClass)
if isempty(plotClass),
return;
end

plotFuncIndex = obj.plotSelectionTable{curNodeIndex, 3} - 1; %-1 to account for 'none' option
if plotFuncIndex == 0
if plotFuncIndex == 0,
reset(obj.handles.plotAxes);
cla(obj.handles.plotAxes);
obj.resetPlotControls();
Expand All @@ -666,16 +666,8 @@ function updatePlot(obj)
curNode = obj.analysisTree.subtree(curNodeIndex);
cellName = obj.analysisTree.getCellName(curNodeIndex);
%load([obj.cellDataFolder cellName]);
%obj.curCellData = cellData;

% cellData = loadAndSyncCellData(cellName);
if ~isempty(obj.curCellData) && isprop(obj.curCellData, 'savedFileName') && strcmp(obj.curCellData.savedFileName, cellName) %cellData already loaded
%do nothing
else %load it
obj.curCellData = loadAndSyncCellData(cellName);
end
cellData = obj.curCellData; % load it locally for later plot functions

cellData = loadAndSyncCellData(cellName);
obj.curCellData = cellData;

%do the plot
set(obj.handles.fig,'KeyPressFcn',[]); %get rid of callback for non SingleEpoch plots
Expand Down Expand Up @@ -787,14 +779,13 @@ function updatePlot(obj)
obj.printCodeForPlotterFunction_singleVal(xName,yName);
else
obj.resetPlotControls();
plotterString = [plotClass '.' plotFunc '(curNode, cellData);'];
eval(plotterString);
eval([plotClass '.' plotFunc '(curNode, cellData);']);

end
end
end

function printCodeForPlotterFunction_singleVal(~, xName, yName)
function printCodeForPlotterFunction_singleVal(obj, xName, yName)
disp('%%%%%%%%%%%%%% plotter code %%%%%%%%%%%%%%');
disp(['function plot_' xName 'Vs' yName '(node, cellData)']);
disp('rootData = node.get(1);');
Expand All @@ -808,7 +799,7 @@ function printCodeForPlotterFunction_singleVal(~, xName, yName)
disp('%%%%%%%%%%%%%% plotter code %%%%%%%%%%%%%%');
end

function printCodeForPlotterFunction_byEpoch(~, xName, yName)
function printCodeForPlotterFunction_byEpoch(obj, xName, yName)
disp('%%%%%%%%%%%%%% plotter code %%%%%%%%%%%%%%');
disp(['function plot_' xName 'Vs' yName '(node, cellData)']);
disp('rootData = node.get(1);');
Expand Down Expand Up @@ -847,36 +838,18 @@ function onNodeSelected(obj)
end
end

curNodeData = obj.analysisTree.get(curNodeIndex);
allFields = fieldnames(curNodeData);
curCellName = obj.analysisTree.getCellName(curNodeIndex);

% handle multichannel here, I believe:
[~, namePart] = strtok(curNodeData.name, ':');
if ~isempty(namePart)
namePart = strtok(namePart, ':');
namePart = strtrim(namePart(2:end));
end
if (length(namePart) == 9 || length(namePart) == 10) && isfield(curNodeData, 'device') %cell node
curCellName = namePart;
end

% load celldata into this object if needed
if ~isempty(curCellName)
if ~isempty(obj.curCellData) && isprop(obj.curCellData, 'savedFileName') && strcmp(obj.curCellData.savedFileName, curCellName) %cellData already loaded
else %load it
obj.curCellData = loadAndSyncCellData(curCellName);
end
end

obj.populateEpochTagsTable(curNodeIndex, curNodeData);
obj.populateCellTagsTable(curCellName);
obj.populateNodePropertiesTable(curNodeData, allFields);
obj.populateEpochTagsTable();
obj.populateCellTagsTable();
obj.populateNodePropertiesTable();
obj.updatePlot();
end

function populateNodePropertiesTable(obj, curNodeData, allFields)

function populateNodePropertiesTable(obj)
selectedNodes = get(obj.guiTree, 'selectedNodes');
curNodeIndex = get(selectedNodes(1), 'Value');
curNodeData = obj.analysisTree.get(curNodeIndex);
allFields = fieldnames(curNodeData);

L = length(allFields);
D = cell(L,2);
z=1;
Expand All @@ -901,8 +874,16 @@ function populateNodePropertiesTable(obj, curNodeData, allFields)
set(obj.handles.nodePropertiesTable, 'data', D)
end

function populateEpochTagsTable(obj, curNodeIndex, curNodeData)

function populateEpochTagsTable(obj)
selectedNodes = get(obj.guiTree, 'selectedNodes');
curNodeIndex = get(selectedNodes(1), 'Value');
curNodeData = obj.analysisTree.get(curNodeIndex);
curCellName = obj.analysisTree.getCellName(curNodeIndex);
if isfield(obj.curCellData, 'savedFileName') && strcmp(obj.curCellData.savedFileName, curCellName) %cellData already loaded
%do nothing
else %load it
obj.curCellData = loadAndSyncCellData(curCellName);
end
D = cell(5,2);
if isfield(curNodeData, 'class') %only display for level of data sets
%get all epochsIDs under this node
Expand Down Expand Up @@ -941,10 +922,23 @@ function populateEpochTagsTable(obj, curNodeIndex, curNodeData)
set(obj.handles.epochTagsTable, 'data', D)
end

function populateCellTagsTable(obj, curCellName)

function populateCellTagsTable(obj)
selectedNodes = get(obj.guiTree, 'selectedNodes');
curNodeIndex = get(selectedNodes(1), 'Value');
curNode = obj.analysisTree.get(curNodeIndex);
curCellName = obj.analysisTree.getCellName(curNodeIndex);
[~, namePart] = strtok(curNode.name, ':');
if ~isempty(namePart)
namePart = strtok(namePart, ':');
namePart = strtrim(namePart(2:end));
end
if (length(namePart) == 9 || length(namePart) == 10) && isfield(curNode, 'device') %cell node
curCellName = namePart;
end

D = cell(1,2);
if ~isempty(curCellName)
obj.curCellData = loadAndSyncCellData(curCellName);
tagNames = obj.curCellData.tags.keys;
L = length(tagNames);
D = cell(L,2);
Expand Down
Loading