Giter VIP home page Giter VIP logo

miniscopeanalysis's Introduction

NOTE: MiniscopeAnalysis is not being developed anymore. This version is only compatible with the v3 miniscope DAQ software. Please keep submiting requests concerning issues or pull requests. I am currently working on a new analysis pipeline called PIMPN: https://github.com/etterguillaume/PIMPN PIMPN performs similar analyses using Google Colaboratory (virtual Python environment, and inputs/outputs compatible with MiniscopeAnalysis.

MiniscopeAnalysis

Analysis package for miniscope data Written by Guillaume Etter (Sylvain Williams Lab, McGill University) This is an updated version of the Miniscope analysis package developed by Daniel Aharoni at UCLA in collaboration with the Golshani lab, Silva lab, and Khaki lab. It combines core functions of the original ms analysis package with NormCorre alignment and CNMFE source extraction.

INSTALLATION:

  1. Download or clone this repositor, and add its path to your list of active Matlab paths
  2. You need to download or clone the latest versions of CNMFE (https://github.com/zhoupc/CNMF_E) and NormCorre (https://github.com/flatironinstitute/NoRMCorre) and add them to your path. This is important as the MiniscopeAnalysis package relies on these two toolboxes OPTIONAL: You can use CellReg (Ziv lab, https://github.com/zivlab/CellReg ) for chronic cell registration. This analysis package outputs spatial footprints that can be directly used with that code.
  3. Analyse your miniscope data:
  • msRun2018: in Matlab, go to your folder containing your miniscope videos (one session) and type ‘msRun2018’
  • msBatchRun2018: type this after having added the paths pointing to the folders containing your miniscope data (one folder for one session) to the ‘msBatchFileList.m’ file. Be careful not to enter them as strings (do not add the ‘’) but just as is (e.g. /Users/Documents/Calcium_data/cool_experiment/8_24_2018/H04_M37_S12/ ) Once you have entered all your sessions, just type in msBatchRun2018 and let it work. For your information the time spend analyzing is saved in each ms structure. This can give you an idea of the total time required to analyze all your sessions.

PARAMETERS: -Downsampling: spatial downsampling is very important. It can really speed up your analysis but when done in excess can hinder you from finding cells. I would recommend a factor of 2 to start with, you can increase it up to 4 if your cells appear large and clear.

-isnonrigid: If set to 'true', will perform NormCorre non-rigid motion correction (can be slightly slower), if set to 'false', will perform classic rigid motion correction

-Downsampling: spatial downsampling is very important. It can really speed up your analysis but when done in excess can hinder you from finding cells. I would recommend a factor of 2 to start with, you can increase it up to 4 if your cells appear large and clear.

  • Save to google drive: I implemented this one because I love to have my desktop analyse data, and then shoot it to the cloud once it’s done so I could access it from anywhere (café, bar, family reunion, etc…) If set to 'true', it will ask you to provide a root path where all your data will be backed up. Note that it can also be a hard-drive, a USB key, etc… Sub-folders will be created using the name that you enter for each subject in the DAQ software.

OUTPUT: Although this package tries to be as consistent as possible with previous versions of the ms package, there are a few changes here and there.

ms.Experiment: your experiment name, taken from the subject name that you enter in the DAQ software

ms.ds: the downsampling factor you used

ms.shifts: the full information about corrected motion generated by NormCorre

ms.Options: parameters used to perform CNMFE

ms.Centroids: Centroids used to initialize CNMFE. Please not these are not your final centroids (use SFPs to look at your actual spatial footprints and deduce centroids)

ms.SFPs: spatial footprints of the cells found while performing CNMFE extraction. You can plot them by typing: figure; imagesc(max(ms.SFPs,[],3));

ms.CorrProj: Correlation projection from the CNMFE. Displays which pixels are correlated together and suggests the location of your cells

ms.PeakToNoiseRatio: Peak-to-noise ratio of the correlation projection. Gives you an idea of most prominent cells in your recording.

ms.numSegments is now call ms.numNeurons (although not everyone performs calcium imaging in neurons... might be renamed in future releases)

In your behav structure, the background detected is now saved in the structure for plotting purposes later on: behav.background

miniscopeanalysis's People

Contributors

etterguillaume avatar

Stargazers

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

Watchers

 avatar  avatar

miniscopeanalysis's Issues

error in using etterguillaume/MiniscopeAnalysis

I followed the the instructions, put all folders name in the msBatchFileList.m, then run msBatchRun2018. Got errors:

Undefined function 'hour' for input arguments of type 'double'.

Error in msBatchRun2018 (line 54)
analysis_time =strcat(date,'_', num2str(hour(now)),'-',num2str(minute(now)),'-',num2str(floor(second(now))));

spatial downsampling

Changing 'spatial_downsampling' from 3 to 2 gives the following error --

Index exceeds matrix dimensions.

Error in cell2mat_ov_sum (line 31)
Xtemp(ind) = Bs{i,j,k}(ind).*I{i,j,k}(ind);

Ca events detection

Hi there,

I am wondering what is the best way/tool to detect Ca transient events for the traces at the output of the MiniscopeAnalysis package?
Is there a package to do that in a reliable manner?

Best Regards,
Omid

Issue Running Analysis

Originally got error when loading an avi file:

Updated mmreader to VideoReader in CMNF_E. Now I am getting the following error.

 Error using corr (line 91)
Requires a data matrix X.

Error in Sources2D/merge_neurons_dist_corr (line 71)
C_corr = corr(C_')-eye(K);

Error in msRunCNMFE_large (line 157)
neuron.merge_neurons_dist_corr(show_merge);

Error in msRun2018 (line 53)
ms = msRunCNMFE_large(ms);

Behavior

Hey @etterguillaume!

I wrote last time some of my issues. I don't know how, but recreating the path's and updating the source code solved my problems, but now I have another one. This is an easy one, I think so, but somehow I don't manage to solve it. Can you provide me some help?

Kind regards!
Szőcs Szilárd,
Senior student
Medical school

image

Data analysing

Hi!

Just tried to load the code and had the same error every time. Can you provide me some help?

Thanks,
Kind regards!

image

spatial_downsampling

Hi,
After changing the parameters "spatial_downsampling" to 1 and "isnonrigid" to be true in msBatchRun2018.m, it pops up an error.
"Error using mat2cell (line 89)
Input arguments, D1 through D4, must sum to each dimension of the input matrix size, [4 8 1 2].

Error in apply_shifts (line 225)
parfor ii = 1:lY

Error in msNormCorre (line 67)
Mr = apply_shifts(Yf,shifts1,options,bound/2,bound/2); % apply shifts to full dataset"

This error pops up because of this function:
shifts_cell = mat2cell(shifts_up,ones(length(xx_uf),1),ones(length(yy_uf),1),ones(length(zz_uf),1),nd);

size(shifts_up)=[4,8,1,2]; but length(xx_uf)=8, length(yy_uf)=12,length(zz_uf)=1,nd=2;

Would you please have a look and give me some ideas of how to solve this?

Reference to non-existent field 'VidObj'

Hi Guillaume,

I'm getting the following error when using msRun2018:

Step 1: Create video object
Reference to non-existent field 'vidObj'.

Error in msGenerateVideoObj (line 35)
ms.height = ms.vidObj{1}.Height;

Error in msRun2018 (line 41)
ms = msGenerateVideoObj(pwd,'msCam');

Could you assist?

Thanks very much,
Gavin

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.