Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invasive neurophysiology toolbox #516

Merged
merged 46 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6c5cdb5
Update bst_plugin.m to accommodate Invasive Neurophysiology toolboxes
mpompolas Feb 21, 2022
697327d
Updated plexon importers
mpompolas Feb 22, 2022
70b1aae
Updated kilosort-plugin installation
mpompolas Feb 25, 2022
1bfa762
Update in_fread_plexon.m
mpompolas Feb 25, 2022
71abe43
Updated spike-sorter input converters
mpompolas Feb 25, 2022
b756d37
Update process_spikesorting_kilosort.m
mpompolas Feb 25, 2022
b2c5288
Update process_spikesorting_supervised.m
mpompolas Feb 25, 2022
4ff8c40
Update bst_plugin.m
mpompolas Feb 25, 2022
9b18f7f
Update process_spikesorting_supervised.m
mpompolas Feb 25, 2022
b986abf
Updated spikesorters
mpompolas Feb 25, 2022
21552d1
Assigned channels on each spiking event
mpompolas Feb 25, 2022
3822aa9
Merge branch 'master' into invasive_plugins
mpompolas Feb 25, 2022
c1b0400
Unsupervised spikes are automatically loaded
mpompolas Feb 25, 2022
3cc5052
Separated .plx and .pl2 importers
mpompolas Mar 12, 2022
eef0c0f
Corrected precision error in timevector in_data_plx
mpompolas Mar 12, 2022
7f6f5cf
Updated convert to LFP
mpompolas Mar 13, 2022
a99d65b
fixed rounding error in Kilosort
mpompolas Mar 24, 2022
8576362
function changes
mpompolas Mar 26, 2022
42ac8e3
TDT loader fix
mpompolas Mar 26, 2022
ef2df6a
Intan importer update
mpompolas Mar 26, 2022
654a844
Merge pull request #12 from mpompolas/improve_intan
mpompolas Mar 26, 2022
c6af024
renamed Intan importer files to match master
mpompolas Mar 29, 2022
0c3327d
Typos on extensions
mpompolas Mar 29, 2022
4eb7f32
Merge branch 'master' into invasive_plugins
mpompolas Mar 29, 2022
478346e
Update in_fopen.m
mpompolas Apr 5, 2022
52bc2ae
Update process_spikesorting_kilosort.m
mpompolas Apr 7, 2022
8520e1e
Update progress-bar popups
mpompolas Apr 8, 2022
9644cd9
Update bst_plugin.m
ftadel Apr 18, 2022
f11d1a0
Fixed typo
ftadel Apr 18, 2022
ecfae56
Updated progress bar management
ftadel Apr 18, 2022
2f0c36f
Updated progress bar management
ftadel Apr 18, 2022
6130c39
Updated error management
ftadel Apr 18, 2022
94872aa
Created spike file type
ftadel Apr 21, 2022
424ea5a
Editing spike sorter options: use plugin manager
ftadel Apr 21, 2022
6811cb9
Created spike file type (fix)
ftadel Apr 21, 2022
c151fbc
Reformatting spike sorting processes
ftadel Apr 21, 2022
e1db819
Reformatted spike sorting processes
ftadel Apr 22, 2022
ea76641
Convert processes category from Custom to File
ftadel Apr 22, 2022
b02cd89
Fix ASCII channel file import
ftadel Apr 22, 2022
35fd2cd
Convert to lfp: Re-coding
ftadel Apr 22, 2022
fd37018
Removed process_spikesorting_supervised
ftadel Apr 25, 2022
ae9cd96
Reformatted all the advanced functions
ftadel Apr 26, 2022
d55a3b8
Reporting last changes from @pompolas PR #13
ftadel Apr 29, 2022
f43d81e
Added tutorial script
ftadel Apr 29, 2022
e1637e1
Bugfix: Errors in reformatting process_spike_triggered_average
ftadel Apr 29, 2022
9779e6b
Removed double registration display
ftadel Apr 30, 2022
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
16 changes: 8 additions & 8 deletions toolbox/core/bst_get.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2008-2021
% Authors: Francois Tadel, 2008-2022
% Martin Cousineau, 2017

%% ==== PARSE INPUTS ====
Expand Down Expand Up @@ -2029,7 +2029,7 @@
if (nargout >= 5) && ~isempty(sStudy)
sItem = sStudy.NoiseCov(iItem);
end
case 'data'
case {'data', 'spike'}
[sStudy, iStudy, iItem] = bst_get('DataFile', FileName, iStudies);
if (nargout >= 5) && ~isempty(sStudy)
sItem = sStudy.Data(iItem);
Expand Down Expand Up @@ -3693,14 +3693,14 @@
{'.xyz'}, 'EEG: EEGLAB (*.xyz)', 'EEGLAB-XYZ'; ...
{'.sfp'}, 'EEG: EGI (*.sfp)', 'EGI'; ...
{'.txt'}, 'EEG: ASCII: XYZ (*.txt)', 'ASCII_XYZ-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_MNI (*.*)', 'ASCII_XYZ_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_World (*.*)', 'ASCII_XYZ_WORLD-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_MNI (*.txt)', 'ASCII_XYZ_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_World (*.txt)', 'ASCII_XYZ_WORLD-EEG'; ...
{'.txt'}, 'EEG: ASCII: Name,XYZ (*.txt)', 'ASCII_NXYZ-EEG'; ...
{'.txt'}, 'EEG: ASCII: Name,XYZ_MNI (*.*)', 'ASCII_NXYZ_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: Name,XYZ_World (*.*)', 'ASCII_NXYZ_WORLD-EEG'; ...
{'.txt'}, 'EEG: ASCII: Name,XYZ_MNI (*.txt)', 'ASCII_NXYZ_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: Name,XYZ_World (*.txt)', 'ASCII_NXYZ_WORLD-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ,Name (*.txt)', 'ASCII_XYZN-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_MNI,Name (*.*)', 'ASCII_XYZN_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_World,Name (*.*)', 'ASCII_XYZN_WORLD-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_MNI,Name (*.txt)', 'ASCII_XYZN_MNI-EEG'; ...
{'.txt'}, 'EEG: ASCII: XYZ_World,Name (*.txt)', 'ASCII_XYZN_WORLD-EEG'; ...
{'.txt'}, 'NIRS: Brainsight (*.txt)', 'BRAINSIGHT-TXT'; ...
};
case 'labelin'
Expand Down
2 changes: 1 addition & 1 deletion toolbox/core/bst_memory.m
Original file line number Diff line number Diff line change
Expand Up @@ -3227,7 +3227,7 @@ function CheckFrequencies()
delete(hFigHist);
end
% Close spike sorting figure
process_spikesorting_supervised('CloseFigure');
panel_spikes('CloseFigure');
% Restore default window manager
if ~ismember(bst_get('Layout', 'WindowManager'), {'TileWindows', 'WeightWindows', 'FullArea', 'FullScreen', 'None'})
bst_set('Layout', 'WindowManager', 'TileWindows');
Expand Down
69 changes: 69 additions & 0 deletions toolbox/core/bst_plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,75 @@
PlugDesc(end).LoadFolders = {'toolbox'};
PlugDesc(end).DeleteFiles = {'ExampleDespiking.m', 'appendixpaper.pdf', 'downsample2x.m', 'examplelfpdespiking.mat', 'sta.m', ...
'toolbox/delineSignal.m', 'toolbox/despikeLFPbyChunks.asv', 'toolbox/despikeLFPbyChunks.m'};

% === ELECTROPHYSIOLOGY: Kilosort ===
PlugDesc(end+1) = GetStruct('kilosort');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/cortex-lab/KiloSort/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://papers.nips.cc/paper/2016/hash/1145a30ff80745b56fb0cecf65305017-Abstract.html';
PlugDesc(end).TestFile = 'fitTemplates.m';
PlugDesc(end).ReadmeFile = 'readme.md';
PlugDesc(end).CompiledStatus = 0;
PlugDesc(end).LoadFolders = {'*'};
PlugDesc(end).RequiredPlugs = {'kilosort-wrapper'; 'phy'; 'npy-matlab'};
PlugDesc(end).InstalledFcn = 'process_spikesorting_kilosort(''copyKilosortConfig'', bst_fullfile(bst_get(''UserPluginsDir''), ''kilosort'', ''Kilosort-master'', ''configFiles'', ''StandardConfig_MOVEME.m''), bst_fullfile(bst_get(''UserPluginsDir''), ''kilosort'', ''Kilosort-master'', ''KilosortStandardConfig.m''));';


% === ELECTROPHYSIOLOGY: Kilosort Wrapper ===
PlugDesc(end+1) = GetStruct('kilosort-wrapper');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/brendonw1/KilosortWrapper/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://zenodo.org/record/3604165';
PlugDesc(end).TestFile = 'Kilosort2Neurosuite.m';
PlugDesc(end).ReadmeFile = 'README.md';
PlugDesc(end).CompiledStatus = 0;

% === ELECTROPHYSIOLOGY: phy ===
PlugDesc(end+1) = GetStruct('phy');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/cortex-lab/phy/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://phy.readthedocs.io/en/latest/';
PlugDesc(end).TestFile = 'feature_view_custom_grid.py';
PlugDesc(end).LoadFolders = {'*'};
PlugDesc(end).ReadmeFile = 'README.md';
PlugDesc(end).CompiledStatus = 0;
PlugDesc(end).RequiredPlugs = {'npy-matlab'};

% === ELECTROPHYSIOLOGY: npy-matlab ===
PlugDesc(end+1) = GetStruct('npy-matlab');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/kwikteam/npy-matlab/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://github.com/kwikteam/npy-matlab';
PlugDesc(end).TestFile = 'constructNPYheader.m';
PlugDesc(end).LoadFolders = {'*'};
PlugDesc(end).ReadmeFile = 'README.md';
PlugDesc(end).CompiledStatus = 0;

% === ELECTROPHYSIOLOGY: ultramegasort2000 ===
PlugDesc(end+1) = GetStruct('ultramegasort2000');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/danamics/UMS2K/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://github.com/danamics/UMS2K/blob/master/UltraMegaSort2000%20Manual.pdf';
PlugDesc(end).TestFile = 'UltraMegaSort2000 Manual.pdf';
PlugDesc(end).LoadFolders = {'*'};
PlugDesc(end).ReadmeFile = 'README.md';
PlugDesc(end).CompiledStatus = 0;

% === ELECTROPHYSIOLOGY: waveclus ===
PlugDesc(end+1) = GetStruct('waveclus');
PlugDesc(end).Version = 'github-master';
PlugDesc(end).Category = 'e-phys';
PlugDesc(end).URLzip = 'https://github.com/csn-le/wave_clus/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://journals.physiology.org/doi/full/10.1152/jn.00339.2018';
PlugDesc(end).TestFile = 'wave_clus.m';
PlugDesc(end).LoadFolders = {'*'};
PlugDesc(end).ReadmeFile = 'README.md';
PlugDesc(end).CompiledStatus = 0;

% === NIRSTORM ===
PlugDesc(end+1) = GetStruct('nirstorm');
Expand Down
9 changes: 7 additions & 2 deletions toolbox/db/db_add.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2011-2019
% Authors: Francois Tadel, 2011-2022

%% ===== GET INPUT FILE =====
if (nargin < 3) || isempty(isReload)
Expand Down Expand Up @@ -91,10 +91,15 @@
end
% Surfaces subtypes
if ismember(fileType, {'fibers', 'fem'})
fileSubType = fileType;
fileType = 'tess';
fileSubType = [fileType, '_'];
end
isAnatomy = ismember(fileType, {'subjectimage', 'tess'});
% Spikes: file tag is data
if strcmp(fileType, 'spike')
fileType = 'data';
fileSubType = '0ephys_';
end
% Create a new output filename
c = clock;
strTime = sprintf('%02.0f%02.0f%02.0f_%02.0f%02.0f', c(1)-2000, c(2:5));
Expand Down
2 changes: 1 addition & 1 deletion toolbox/db/db_add_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
deletedFile{end+1} = sStudy.Timefreq(iItem).FileName;
end
sStudy.Timefreq(iItem) = sNew;
case 'data'
case {'data', 'spike'}
% Create new descriptor
sNew = db_template('Data');
sNew.FileName = FileName;
Expand Down
4 changes: 2 additions & 2 deletions toolbox/db/private/db_parse_study.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2008-2012
% Authors: Francois Tadel, 2008-2022

%% ===== PARSE INPUTS =====
if ~file_exist(bst_fullfile(studiesDir, studySubDir))
Expand Down Expand Up @@ -207,7 +207,7 @@
sStudy(1).NoiseCov(2) = noisecovInfo;
end

case 'data'
case {'data', 'spike'}
% % Get data filename without the trial block
% [groupName, iTrial] = str_remove_trial(filenameRelative);
% dataInfo = [];
Expand Down
10 changes: 6 additions & 4 deletions toolbox/gui/figure_timefreq.m
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,10 @@ function UpdateFigurePlot(hFig, isForced)
PlotTimefreqSurfHigh(hAxes, Time, Freqs, TF, TFmask);
elseif TfInfo.DisplayAsDots
PlotTimefreqAsDots(hAxes, Time, TF);
elseif TfInfo.DisplayAsPhase
PlotTimefreqAsPhase(hAxes, Time, Freqs, TF);
elseif TfInfo.DisplayAsPhase
phase_info = in_bst_timefreq(TfInfo.FileName, 0, 'neurons', 'RowNames');
iNeuron = find(ismember(phase_info.RowNames, RowNames));
PlotTimefreqAsPhase(hAxes, Time, Freqs, TF, phase_info.neurons.phase, iNeuron);
else
PlotTimefreqSurf(hAxes, Time, FullTimeVector, Freqs, TF, TFmask);
end
Expand Down Expand Up @@ -1241,7 +1243,7 @@ function UpdateFigurePlot(hFig, isForced)


%% ===== PLOT TIME-FREQ AS PHASE =====
function hSurf = PlotTimefreqAsPhase(hAxes, Time, Freqs, TF)
function hSurf = PlotTimefreqAsPhase(hAxes, Time, Freqs, TF, phase_info, iNeuron)
% Delete previous objects
surfTag = 'TimefreqSurf';
hOld = findobj(hAxes, '-depth', 1, 'tag', surfTag);
Expand All @@ -1262,7 +1264,7 @@ function UpdateFigurePlot(hFig, isForced)

hSurf = circ_plot(single_neuron_and_channel_phase,'hist',[], nBins,true,true,'linewidth',2,'color','r','Parent', hAxes);
set(hSurf, 'Tag', surfTag);
title(hAxes, {['Rayleigh test p=' num2str(pval_rayleigh)], ['Omnibus test p=' num2str(pval_omnibus)], ['Preferred phase: ' num2str(mean_value_degrees) '^o']})
title(hAxes, {['Total neurons: ' num2str(phase_info.total_spikes(iNeuron))],['Rayleigh test p=' num2str(pval_rayleigh)], ['Preferred phase: ' num2str(mean_value_degrees) '^o']})
end


Expand Down
Loading