-
Notifications
You must be signed in to change notification settings - Fork 22
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
extracted peaks #116
Comments
Yep! Alternative peak-finding using Example usage on CNMF-e output loaded into Matlab, e.g.
% signalPeaks: [nSignals frame] matrix. Binary matrix with 1 = peaks, 0 = non-peaks.
% signalPeaksArray: {1 nSignals} cell array. Each cell contains [1 nPeaks] vector that stores the frame locations of each peak.
% numStdsForThresh: number of standard deviations above the threshold to count as spike
% minTimeBtEvents: minimum number of time units (e.g. frames) between events.
% detectMethod: detect on differential/1st derivative ('diff') or raw ('raw') trace.
% medianFilterLength: number of frames to calculate rolling median filter, correct for baseline drift over time.
[signalPeaks, signalPeaksArray] = ciapkg.signal_processing.computeSignalPeaks(cnmfeAnalysisOutput.extractedSignals,...
'numStdsForThresh',2,'minTimeBtEvents',8,'detectMethod','raw','medianFilterLength',100); If you want to view the found peaks overlayed on each cell's trace quickly in a GUI, can set the [signalPeaks, signalPeaksArray] = ciapkg.signal_processing.computeSignalPeaks(cnmfeAnalysisOutput.extractedSignals,...
'makePlots',1,...
'numStdsForThresh',2,'minTimeBtEvents',8,'detectMethod','raw','medianFilterLength',100); Alternatively can load the cell extraction images/signals directly from MAT or NWB format into variables (for any cell extraction from CIAtah) using cellExtractPath = 'PATH\TO\_cnmfeAnalysis.mat';
[cImages,cSignals,~,~,cSignals2] = ciapkg.io.loadSignalExtraction(cellExtractPath);
[signalPeaks, signalPeaksArray] = ciapkg.signal_processing.computeSignalPeaks(cSignals,...
'numStdsForThresh',2,'minTimeBtEvents',8,'detectMethod','raw','medianFilterLength',100); I'll add a separate page in the CIAtah docs (https://git.io/ciatah_docs) on this. |
Hi @bahanonu , can you please explain more about this method? Why this computeSignalPeaks is more exact than the extracedPeaks generated by CNMFE? It looks that CNMFE uses deconvolution algorithm to compute the spikes from raw calcium trace. Did computeSignalPeaks also employ this deconvolution method? In my case, I want to see the spatial tuning of my neurons but it seems the computeSignalPeaks gives me much less spikes which brings difficulty in calculating the spatial encoding properties of the neurons. Thank you! |
@hmfeng Will get back with a description in a moment, can you provide example traces where you ran |
@hmfeng We describe the general method for that function's peak finding in the supplemental of the Corder/Ahanonu, 2019 paper, see https://www.science.org/action/downloadSupplement?doi=10.1126%2Fscience.aap8586&file=aap8586_corder_sm.pdf#page=9. Can also run on the raw trace instead of dx/dt. See below, I'll also double check the current function as I might have updated it since then (e.g. flag to adjust peak locations to max [esp. if using 1st derivative], etc.). |
Also, it is worth looking at Cascade: If using with 1p data, see https://github.com/HelmchenLabSoftware/Cascade#can-i-use-cascade-as-well-for-endoscopic-1p-calcium-imaging-data. |
I use the following command to compute peaks with ciatah function:
I compared the spikes generated by this computeSignalPeaks function and the extractedPeaks from cnmfe output dataset (only keep events with amplitude larger than 2.5*std of whole trace of this signal), as shown in below picture: |
Thank you! Actually I did refer the detailed description you mentioned in this paper as my starting point of peak extraction. |
Thanks, could you send over the MAT-file with the traces and cnmfe event times? Want to get a sense for whether there are actually smaller events in some of the cases where it looks like multi-events are annotated by cnmfe during the transient rise (see below).
|
@bahanonu sorry for the late reply. Here is the share link to the zipped data file: https://drive.google.com/file/d/1Eftew6uN-Sm8szWTbBB0g4PboxmfDNyL/view?usp=share_link |
@hmfeng Thanks for sending the data. Took a look at the CNMF vs. For example, see zoom in on the below transients where Also, given how densely packed your cells appear to be (what region is this? CA1?), it is possible the sub-0.01 transients are actually cross-talk. I would go to cell #4 using CIAtah's If you send the movie, I can take a quick look at this in terms of false positives/negatives. |
@bahanonu Thank you so much! |
@hmfeng Sure thing! Let me know if have any follow-up questions. And that's correct, if I'm using CNMF-e I often will use the |
Hi,
I remember reading something in a readme a while ago that there is a more exact way to get peak times than using extractedPeaks, but for the life of me I cannot find it anymore. Is it deprecated?
Thank you!
The text was updated successfully, but these errors were encountered: