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

Multi-shanks trouble on Phy #414

Closed
mndiguilmi opened this issue Jun 18, 2021 · 3 comments · Fixed by #595
Closed

Multi-shanks trouble on Phy #414

mndiguilmi opened this issue Jun 18, 2021 · 3 comments · Fixed by #595

Comments

@mndiguilmi
Copy link

Hi

I’m currently use a Neuronexus probe A4x4 (16 ch), 4 shanks with 4 channels each one (https://www.neuronexus.com/files/catalog/2021-Probe-Catalog.pdf; page 34).

Assuming the following distribution of the Neuronexus channels:
(from the left to the right: shank 1 -> 4; channels distribution from down to top: 6, 2, 3, 1 (shank 1); 5, 8, 4, 7 (shank 2) 9, 12, 10, 13 (shank 3); 15, 11, 16, 14 (shank 4))

I made the following channel map for Kilosort 2

function ops=make_16_A4x4_MD_channelMap(fpath,connectedOriginal)
chanMap = [6 2 3 1 5 8 4 7 9 12 10 13 15 11 16 14];
connected=true(16,1);

for i=1:length(connected)
connected(i)=connectedOriginal(chanMap(i));
end

xcoords=[0 0 0 0 125 125 125 125 250 250 250 250 375 375 375 375];
ycoords=[0 50 100 150 0 50 100 150 0 50 100 150 0 50 100 150];
kcoords = [1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4];

fs = 20000;

ops.fs = fs;

ops.NchanTOT = 16;

ops.Nchan = sum(connected);

save(fullfile(fpath, 'chanMap.mat'), 'chanMap', 'connected', 'xcoords', 'ycoords', 'kcoords', 'fs')

When I open the sorted data on Phy, the ProbeView looks OK however all channels appear on the same shank, sh 0 (see below). I’m not really sure if it’s a real problem or not and if it’s a problem in KS or Phy. On the other hand, I’d like to increase the channels for my recording (32-64 ch) using multiple shanks, but I’d like to fix this trouble before.

Thanks!

Mariano

image

@JoseGuzman
Copy link
Contributor

Hi @mndiguilmi,

I think Kilosort is suited to have linear probes (neuropixels-like). When I use a multi-shank probe, I design the file so that every shank is deeper in the y-axis (ordinate axis).

Look at this example of a probe with four shanks, each containing 16 electrodes:

%=========================================================================
% createE1Probes.m
%
% Creates the coordinates of the ASSY77_E1 probes of Cambridge Neurotech 
% It will design it as a linear probe (one probe after each other)
% because both KiloSort2 and Phy are designed better for linear probes.
% it will not affect the sorting since the probes are independent.
%=======================================================================`


%% Four shanks x-separated 250 um
fname = '~/SiliconProbes/Kilosort2/configFiles/64E1.mat';
Nchannels = 67; % Total number of channels
connected = true(Nchannels,1); % zero if bad channel 
connected(65:67) = 0; % AUX channels
chanMap = 1:Nchannels;
chanMap0ind = chanMap - 1; % zero-index channel

% x-location of 16 electrodes in shanks
xloc = [0;70;5;65;10;60;15;55;20;50;25;45;30;40;35;35];

xlocAUX = ones(3,1)*35;
xcoords = vertcat(xloc, xloc, xloc, xloc, xlocAUX); 

% y-location of 16 electrodes shanks
ylocA = [0;-25;-40;-65;-80;-105;-120;-145;-160;-185;-200;-225;-240;-265;-280;-305];
ylocB = ylocA - 600; % 600 um deeper
ylocC = ylocB - 600;
ylocD = ylocC - 600;

% Auxiliary channels far away
ylocAUX = [-4600;-4650;-4700;];
ycoords = vertcat(ylocA, ylocB, ylocC, ylocD, ylocAUX);

% not used in Kilosort2 (see https://github.com/MouseLand/Kilosort2/issues/155)
kcoords = ones(Nchannels,1);

fs = 30000;
save(fname, ...
'chanMap','connected','xcoords','ycoords','kcoords','chanMap0ind','fs')

fprintf('Creating  %s \n', fname)

@chris-angeloni
Copy link

I don't think Kilosort has had functionality for multiple shanks since v1.0. What you could do is increase the x-distance between each shank to visually separate them in Phy (unless the inter-shank distance truly is 125um, which I would not expect!). This is the approach I take for tetrodes. Or, as @JoseGuzman suggested, orient your shanks in depth, then sort in phy by depth.

@kingsEffy
Copy link

Wont assign kcoords as shank ID help? I saw from aonther issue thread and this is suggested by one of the deveopers. However I'm curios to try this way. I'm using ks3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants