Author Topic: Error in msExtractFiring and additional basic questions for analysis  (Read 5051 times)

Jesper.vernooij

  • Newbie
  • *
  • Karma: +2/-0
    • View Profile
Hi everybody,

We have recently gotten some sessions with neurons popping up, therefore we have delved into the analysis part of the miniscope. All the standard functions in msRunBatch and msRun seem to work fine up till ms = msExtractFiring(ms); where I get the following error:

>> ms = msExtractFiring(ms);
Undefined function or variable 'C1'.

Error in fast_oopsi/est_MAP (line 305)
                C    = C1;                      % update C

Error in fast_oopsi (line 165)
[n C posts(1)] = est_MAP(F,P);

Error in msExtractFiring (line 25)
    [n_best p_best V2 C] = fast_oopsi(F,V,P);


Does anyone know how to fix this? I assume C1 is not produced by the while loop in est_MAP where it should be produced because of some reason. It it perhaps because of some of the thresholds or ROIs I have set? Can I just uncomment the msExtractFiring and still get a meaningful ms.mat?

Other basic questions (I might have already asked them on the old forum, but it might be good to have the answers here as well):
 1- What features are important when selecting the threshold for ms = msSelectFluorThresh(ms), ROIs in ms = msSelectROIs(ms), the mean frame in ms = msMeanFrame(ms,downsample), the best alignment in ms = msSelectAlignment(ms);.
 2- Once all current processing functions are ran, which parameters contain what information? (important ones, like post-proc traces for all segments, ).
 3- Is there a function that creates a video file of the processed traces, like the one on the main page of the miniscope website?

I'm sorry for the amount of questions for one post, but I hope the answers will benefit all :)

Thank you,

Jesper

Daniel Aharoni

  • Administrator
  • Full Member
  • *****
  • Karma: +15/-0
    • View Profile
Re: Error in msExtractFiring and additional basic questions for analysis
« Reply #1 on: August 18, 2016, 11:28:03 PM »
Hi Jesper,
msExtractFiring() implements an algorithm developed by Vogelstein, http://www.stat.columbia.edu/~liam/research/pubs/vogelstein-fast.pdf. His source code, Fast_Oopsi can be found on GitHub here, https://github.com/jovo/fast-oopsi. I don't think I have run into this particular error in the past but I will try to see if I can reproduce it. msExtractFiring() attempts to deconvolve out the slow calcium decay from the dF/F signal. Fast_Oopsi is a particularly good approach to doing this but you can also work with some more straightforward deconvolutions such as the deconvlucy() function in MATLAB.

Answers to your other quections:
  • The output of msSelectFluorThresh(), ms.goodFrames, is currently not implemented in the analysis code on GitHub and therefore the threshold selected has no affect on the rest of the analysis. I left msSelectFluorThresh() in the main workflow so people could quickly take a look at how fluorescence changed across each recording session. As for the ROI selection in msSelectROIs(), we usually select an ROI about 1/8th the area of the entire frame. The ROI should avoid the edges of the frame and should contain a landmark (blood vessel or cell that is constantly visible). msSelectAlignment will display a histogram and meanFrame for each alignment ROI you previously selected. The best alignment will be the one with the least blurry meanFrame and has a clean, localized oval in the histogram.
  • After running through the analysis, open up he 'ms' data structure to see what all is stored. dF/F traces are stored in ms.trace, deconvolved activity are stored in ms.firing. The order of the variable in 'ms' are in the same order as how you run the whole analysis.
  • The script I use to generate these videos is on my other computer. I will upload it to the GitHub repository later today. For the mean time you can take a look at msPlayVidObj() to display your analysis.

Jesper.vernooij

  • Newbie
  • *
  • Karma: +2/-0
    • View Profile
Re: Error in msExtractFiring and additional basic questions for analysis
« Reply #2 on: August 18, 2016, 11:50:39 PM »
Thank you very much Daniel!

I'll look into the deconvlucy() function if I can't get fast-oopsi to work and post my results if any.

kjlawlor

  • Newbie
  • *
  • Karma: +0/-0
    • View Profile
Re: Error in msExtractFiring and additional basic questions for analysis
« Reply #3 on: April 16, 2018, 08:56:43 PM »
I am getting the same error in regardsto undefined function or variable 'C1'. Was this issue ever resolved? Thanks!

Daniel Aharoni

  • Administrator
  • Full Member
  • *****
  • Karma: +15/-0
    • View Profile
Hi kjlawlor,
I can't remember what became of this issue but I suggest you switch over to doing your processing and analysis with the CaImAn package, https://github.com/flatironinstitute/CaImAn. Definitely the standard in the field right now and what we are now using.