Coder Social home page Coder Social logo

djoshea / neuropixel-utils Goto Github PK

View Code? Open in Web Editor NEW
41.0 9.0 21.0 49.23 MB

Utilities for managing Neuropixel datasets and Kilosort results

Home Page: https://djoshea.github.io/neuropixel-utils/

License: MIT License

MATLAB 99.42% Jupyter Notebook 0.58%

neuropixel-utils's Introduction

neuropixel-utils

View Neuropixel Utils on File Exchange View Documentation

Neuropixel Utils is a toolkit written in Matlab for manipulating datasets collected by SpikeGLX (e.g. imec.ap.bin files) and the results produced by Kilosort / Kilosort 2. Please note that some of this functionality is redundant with the tools found in the Cortex Lab's spikes repository, authored By Nick Steinmetz, Mush Okun, and others. Here, we prioritize an organized, easy to use, object-oriented approach to accessing, manipulating, and visualizing the data. This reduces the need to worry about metadata.

See full documentation at https://djoshea.github.io/neuropixel-utils.

Neuropixel Utils facilitates the following data processing steps:

Neuropixel Utils was authored by Daniel J O'Shea (@djoshea) to facilitate precision artifact removal and careful inspection of raw data traces before running Kilosort, as well as post-hoc verification that the artifacts were removed successfully.

Download and install

To get started, clone the repo:

git clone https://github.com/djoshea/neuropixel-utils.git

And add it to your path in Matlab:

>> addpath('/path/to/neuropixel-utils')

Requirements

Neuropixel Utils requires Matlab R2019b or later.

neuropixel-utils's People

Contributors

apjanke avatar djoshea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neuropixel-utils's Issues

System requirements?

Could you add something to the readme and the GitHub Pages saying which versions of Matlab are supported, and if there are any other system requirements for running neuropixel-utils?

typo in function name

ImecDataset.saveTranformedDataset(...) is missing the s in transformed and should be
ImecDataset.saveTransformedDataset(...)

Issue with concatenating LF

An error was returned when concatenating files LF but not AP data using Neuropixel.ImecDataset.writeConcatenatedFileMatchGains. There was no field of 'badChannels' in the LFmeta.

I changed the union of badChannels with the 'if p.Results.writeLF ...' statement to the following and it works for what I have been doing but there is probably a more logical place to define the meta data.

% compute union of badChannels
for iM = 2:numel(imecList)
if ~isfield(meta, 'badChannels')
meta.badChannels = [];
else
meta.badChannels = union(meta.badChannels, imecList{iM}.badChannels);
end
end

I define the badChannels after concatenating all my Imec datasets. Should I be populating that field prior to concatenating?

Missing link in imec_dataset GH page

In https://djoshea.github.io/neuropixel-utils/imec_dataset/, at the text "If you have known trial boundaries in your file (see for more information), you can ", looks like the "see for" is missing a link that should be in there.

<p>If you have known trial boundaries in your file (see for more information), you can also excise the regions of time far from trial boundaries using the <code>TrialSegmentationInfo</code> instance. I&rsquo;ve found this to be useful to exclude time windows where the subject was asleep from further analysis.</p>

Error loading an imec Dataset , .imec..bin gets added to filename

Hey,

I saw on your page that it is possible to concatenate multiple files together, which is a great tool which I would love to use for a part of my dataset. I would like to follow specific cells through different recordings and the most reliable way would be by sorting the files together.
Unfortunately I already have problem with loading the first file.
I made a copy of the first file in a safety folder, I also made sure that only the ap.bin file and the meta file is in this folder.
When I try to load the file I get the following error message
imec = Neuropixel.ImecDataset('Z:\Users\Janna\IMECDATASET\20200402\001\NP\20200402_JA0033_Light_g0_t0.imec0.ap.bin');
Error using Neuropixel.ImecDataset (line 109)
Could not find AP bin file Z:\Users\Janna\IMECDATASET\20200402\001\NP\20200402_JA0033_Light_g0_t0.imec0.ap.bin.imec..bin

if I change the name of the file by just erasing the "0" the following error message appears:

imec = Neuropixel.ImecDataset('Z:\Users\Janna\IMECDATASET\20200402\001\NP\20200402_JA0033_Light_g0_t0.imec.ap.bin');
Reference to non-existent field 'imHpFlt'.

Error in Neuropixel.ImecDataset/readInfo (line 128)
df.highPassFilterHz = meta.imHpFlt;

Error in Neuropixel.ImecDataset (line 107)
df.readInfo();

As another step I also tried just a common prefix, this is the error message I get for that
imec = Neuropixel.ImecDataset('Z:\Users\Janna\IMECDATASET\20200402\001\NP\20200402_JA0033_Light');
Error using Neuropixel.ImecDataset.findImecFileInDir (line 1262)
No ap matches for Z:\Users\Janna\IMECDATASET\20200402\001\NP\20200402_JA0033_Light* exist

Error in Neuropixel.ImecDataset (line 98)
file = Neuropixel.ImecDataset.findImecFileInDir(fileOrFileStem, 'ap');

I am not sure if this is the right channel, I don't really think that the "0" behind the imec file name is the problem, but I also don't understand why the code is adding another ".imec..bin" to the full filename.

Do I have to add something or take away to load the dataset ? Or does it have something to do with the additional number behind the "imec" and that is why the code doesn't recognize the file ?

Best,
Janna

Common setup can erase raw data

If the user wants to write a filtered/CAR'd version of a file into the same directory containing the raw data (as most users first testing this will likely attempt), line 1398 of ImecDataset.m will clear this folder, deleting the raw data.

I'm guessing the assumed configuration is to specify an output path which isn't the same as the input, though I think most users will discover this the hard way.

Outdated function reference?

TrialDataUtilities.Plotting.setMarkerOpacity(h, alpha);

This seems like an outdated function reference, and the new one is probably "Neuropixel.Utils.setLineOpacity"?

(Thank you for this awesome toolbox! I have written my own, also oop, toolkit for SpikeGLX and Kilosort1/2, but once seeing this beautifully designed and professionally written package I immediately threw mine away haha!!)

Output metadata is incorrect

Output files misspell at least these tags {~imroTbl, ~snsChanMap, ~snsShankMap}. This causes subsequent pipeline tools to crash.

error on loading and working with kilosort dataset

Hi,

I am wondering if neuropixel utils is compatible with kilosort 2.5 and kilosort 3? I am able to load my kilosort 2.5 sorted data into the KilosortDataset object. However, I don't have a RawDataset and many other fields in my structure. Here's a picture for reference. Any thoughts on this?

Thanks so much!
Screen Shot 2021-08-05 at 3 26 26 PM

error while trying to exclude specific time window

Hello,
I have been trying to excise time windows from the raw data using the timeShifts function with the following commands:

idxStartList=100;
idxStopList=round( imec.nSamplesAP/100 ) ;
timeShifts = Neuropixel.TimeShiftSpec.buildToExciseGaps(idxStartList, idxStopList);

[imecOut] = imec.saveTranformedDataset(cleanedPath, 'transformAP', { @Timeshifts },'writeAP', true, 'writeLF', false);

and got the following error:

Error in
Neuropixel.ImecDataset/writeConcatenatedFileMatchGains/writeCatFile
(line 1605)
data = fn(imecList{iF}, data,
chIds, source_idx);

Error in Neuropixel.ImecDataset.writeConcatenatedFileMatchGains
(line 1457)
writeCatFile(outFile, chIndsByFile, 'ap',
multipliers, chunkSize, p.Results.transformAP,
timeShiftsAP, dryRun);

Error in Neuropixel.ImecDataset/saveTranformedDataset (line 991)
imecOut =
Neuropixel.ImecDataset.writeConcatenatedFileMatchGains({df},
outPath, p.Results);

I'd appreciate your help with understanding what I've been doing wrong.
Many thanks,
Ido Maor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.