From dd1fc1f4f548e7747199c5210fab8e3b39828903 Mon Sep 17 00:00:00 2001 From: Peter Zatka-Haas Date: Wed, 1 Apr 2020 13:46:44 +0100 Subject: [PATCH 1/2] Added support for cluster_KSLabel.tsv' --- preprocessing/phyHelpers/loadKSdir.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/preprocessing/phyHelpers/loadKSdir.m b/preprocessing/phyHelpers/loadKSdir.m index 2732344..5bbc7a0 100644 --- a/preprocessing/phyHelpers/loadKSdir.m +++ b/preprocessing/phyHelpers/loadKSdir.m @@ -46,6 +46,9 @@ if exist(fullfile(ksDir, 'cluster_group.tsv')) cgsFile = fullfile(ksDir, 'cluster_group.tsv'); end +if exist(fullfile(ksDir, 'cluster_KSLabel.tsv')) + cgsFile = fullfile(ksDir, 'cluster_KSLabel.tsv'); +end if ~isempty(cgsFile) [cids, cgs] = readClusterGroupsCSV(cgsFile); From fdf55bc43da2b3ce442a59440e6c0a96a331e6f6 Mon Sep 17 00:00:00 2001 From: Peter Zatka-Haas Date: Thu, 16 Apr 2020 10:09:05 +0100 Subject: [PATCH 2/2] Added some documentation --- preprocessing/phyHelpers/loadKSdir.m | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/preprocessing/phyHelpers/loadKSdir.m b/preprocessing/phyHelpers/loadKSdir.m index 5bbc7a0..228be9a 100644 --- a/preprocessing/phyHelpers/loadKSdir.m +++ b/preprocessing/phyHelpers/loadKSdir.m @@ -1,6 +1,30 @@ - - function spikeStruct = loadKSdir(ksDir, varargin) +% spikeStruct = loadKSdir(ksDir) loads kilosorted ephys data. Input +% argument should be a path to a folder containing the output kilosort. +% The output spikeStruct contains the following data: +% +% -dat_path, n_channels_dat, dtype, offset, sample_rate, hp_filtered: these +% are parameter variables associated with the recording. Most variables are +% self-explanatory. +% -st: vector of all spike event times +% -spikeTemplates: vector of the template identity associated with each +% spike event. [0 indexed] +% -clu: vector of cluster IDs associated with each spike event. This can +% differ from spikeTemplates because spikes from multiple kilosort +% templates can be merged. Or spikes from one template can be split into +% separate clusters. +% cluster (same value in clu). +% -tempScalingAmps: vector of scaling factors associated with each spike +% event. This value reflects how much the kilosort template for the cluster +% was scaled to match the waveform of each spike event. +% -cids: list of cluster IDs +% -xcoords, ycoords: location of each channel on the probe +% -temps: clusterID x time x channel matrix, containing the kilosort +% template for each cluster. +% -winv: whitening matrix used to ensure all channels have the same +% variance. +% -pcFeat: PCA analysis on spike statistics +% -pcFeatInd: PCA analysis on spike statistics if ~isempty(varargin) params = varargin{1}; @@ -39,6 +63,7 @@ pcFeatInd = []; end +%Load phy annotation labels (cluster_groups.csv or .tsv) cgsFile = ''; if exist(fullfile(ksDir, 'cluster_groups.csv')) cgsFile = fullfile(ksDir, 'cluster_groups.csv');