analysis:course-w16:week16

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

analysis:course-w16:week16 [2016/02/29 13:26] mvdm [Step 1: Generating candidate events] |
analysis:course-w16:week16 [2016/03/01 09:50] eirvine [Steps 5-7: Get co-activation probabilities] |
||
---|---|---|---|

Line 1: | Line 1: | ||

~~DISCUSSION~~ | ~~DISCUSSION~~ | ||

- | |||

- | :!: **UNDER CONSTRUCTION, PLEASE DO NOT USE YET** :!: | ||

===== Pairwise co-occurrence ===== | ===== Pairwise co-occurrence ===== | ||

Line 56: | Line 54: | ||

=== Setup and data loading === | === Setup and data loading === | ||

- | First, make sure you do a ''git pull'' as usual, and get the data. We'll be using session ''R064-2015-04-22''. You'll also need to include the ''tasks\Alyssa-Tmaze'' and ''tasks\ReplayAnalysis'' folders in your path. | + | First, make sure you do a ''git pull'' as usual, and get the data. We'll be using session ''R064-2015-04-22''. You'll also need to include the ''tasks\Alyssa-Tmaze'' and ''tasks\Replay_Analysis'' folders in your path. |

Then, we load the data: | Then, we load the data: | ||

Line 100: | Line 98: | ||

evt = TSDtoIV(cfg,SWR); % evt is the set of candidate events | evt = TSDtoIV(cfg,SWR); % evt is the set of candidate events | ||

- | clearvars -except pos evt ExpKeys | + | clearvars -except S pos evt ExpKeys |

</code> | </code> | ||

+ | |||

+ | :!: Make sure that the filter above performed as expected. In particular, if the %%FieldTrip%% version of ''filtfilt()'' takes precedence in your path over the matlab builtin version, this could fail! | ||

Normally there is a lot more that goes on during candidate detection, such as the elimination of events that occur when the rat is moving too quickly, and but we will keep it simple for now. | Normally there is a lot more that goes on during candidate detection, such as the elimination of events that occur when the rat is moving too quickly, and but we will keep it simple for now. | ||

Line 253: | Line 253: | ||

</code> | </code> | ||

+ | As you can see from the command line output of ''SelectTS()'', not many cells of the original 178 are left after this operation! | ||

=== Step 4: Make a Q-matrix === | === Step 4: Make a Q-matrix === | ||

Line 266: | Line 267: | ||

</code> | </code> | ||

- | This Q-matrix contains the number of times 10 different left-arm place cells spiked during 1017 candidate, or sharp wave-ripple, events. | + | This Q-matrix contains the number of times each uniquely left-arm place cell spiked during candidate, or sharp wave-ripple, events. |

- | Consider column 17 for the "left" cells (''Q.L(17,:)''): cell 9 spiked three times, cell 5 spiked twice, and cell 4 spiked once. These left arm cells co-occurred during the same candidate interval. This matrix is the basis for all subsequent analysis steps, much in the same way that a slightly different Q-matrix is the basis for the [[analysis:course-w16:week10|decoding analysis]] covered earlier. | + | Consider column 7 (i.e. event 7) for the "left" cells (''Q.L.data(:,7)''): cell 1 spiked three twice, and cells 11 and 12 spiked once. These left arm cells co-occurred during the same candidate interval. This matrix is the basis for all subsequent analysis steps, much in the same way that a slightly different Q-matrix is the basis for the [[analysis:course-w16:week10|decoding analysis]] covered earlier. |

=== Steps 5-7: Get co-activation probabilities === | === Steps 5-7: Get co-activation probabilities === | ||

Line 344: | Line 345: | ||

set(gca,'XLim',[location(1)-1 location(2)+1],'XTick',location,'XTickLabel',{'L' 'R'}); xlabel('Field location') | set(gca,'XLim',[location(1)-1 location(2)+1],'XTick',location,'XTickLabel',{'L' 'R'}); xlabel('Field location') | ||

ylabel({'SWR coactivation'; 'Z-score'}) | ylabel({'SWR coactivation'; 'Z-score'}) | ||

- | title(‘Coactivation above chance levels (p4)’) | + | title('Coactivation above chance levels (p4)') |

</code> | </code> | ||

Line 356: | Line 357: | ||

ylabels = {{'Proportion of';'SWRs active'},{'Cell pair'; 'joint probability'},{'SWR coactivation'; 'Z-score'}}; | ylabels = {{'Proportion of';'SWRs active'},{'Cell pair'; 'joint probability'},{'SWR coactivation'; 'Z-score'}}; | ||

arms = {'L','R'}; | arms = {'L','R'}; | ||

+ | colors = flipud(linspecer(2)); | ||

location = [1 2.5]; | location = [1 2.5]; | ||

Line 364: | Line 366: | ||

| | ||

h(iP) = subplot(1,3,iP); | h(iP) = subplot(1,3,iP); | ||

- | for iBar = 1:2 | + | for iBar = 1:length(arms) |

| | ||

bar(location(iBar),p_data(iP,iBar),'FaceColor',colors(iBar,:),'EdgeColor','none') | bar(location(iBar),p_data(iP,iBar),'FaceColor',colors(iBar,:),'EdgeColor','none') | ||

Line 379: | Line 381: | ||

</code> | </code> | ||

- | This gives: | + | This gives something like: |

- | (insert results here) | + | {{ :analysis:course-w16:cooccur_results.png?nolink&600 |}} |

- | It looks like his right cell pairs are more co-active than his left cell pairs. Could this have something to do with how often he experienced the right vs left trajectory? | + | It looks like his right cell pairs are more co-active than his left cell pairs, relative to shuffled co-coccurrence, suggesting that there may be more right trajectories replayed compared to left trajectories. |

+ | | ||

+ | Note: in interpreting results like the above, it is important to consider what asymmetries may be present in the neural and behavioral data that could account for any differences. We used the function ''GetMatchedTrials()'' earlier to create a fair comparison between left and right from a behavioral sampling perspective, but that doesn't change the fact that behaviorally, the animal experienced the right trajectory more often than the left: | ||

<code matlab> | <code matlab> | ||

Line 389: | Line 393: | ||

fprintf('Number of right trials: %d\n',length(metadata.taskvars.trial_iv_R.tstart)) | fprintf('Number of right trials: %d\n',length(metadata.taskvars.trial_iv_R.tstart)) | ||

</code> | </code> | ||

- | |||

- | Maybe? But let's not discuss that. | ||

- | |||

- | FIXME insert interpretation questions here | ||

- | |||

- | INSTEAD let's talk about more exciting details relating to the internal workings of CoOccurQ, because that's clearly more interesting than discussions about the contents of rat thoughts and whether the government will someday be able to probe our minds. | ||

==== Implementing a basic co-occurrence analysis from scratch ==== | ==== Implementing a basic co-occurrence analysis from scratch ==== | ||

Line 501: | Line 499: | ||

</code> | </code> | ||

+ | This shuffling procedure is an example of **resampling**: we create a number of different data sets based on some rearrangement of the original data. In this case, the specific resampling is a shuffle or permutation, which breaks any relationship between neurons (because we shuffle each neuron independently) and therefore functions as a control for the amount of co-occurrence we expect by chance (i.e. if the neurons were independently active). In general, a major advantage of resampling methods is that they preserve aspects of the underlying distribution -- in this case, of spike counts -- and make no particular assumptions about its shape, whereas many parametric statistical tests require data to be e.g. normally distributed. | ||

==== Challenges ==== | ==== Challenges ==== | ||

★ Why don't we just look at single-cell activation? Under what conditions would the results from that be the same, or different, from pairwise co-occurrence? | ★ Why don't we just look at single-cell activation? Under what conditions would the results from that be the same, or different, from pairwise co-occurrence? | ||

+ | |||

+ | ★ Comment on the choice of bins used in constructing the Q-matrix. It it reasonable to assume that SWR events are always 100ms in length? Modify the code to use the actual length of SWR events. Is the resampling statistic still doing the right thing in this case? | ||

+ | |||

+ | ★ Implement co-occurrence analysis on your own data. | ||

==== Credits ==== | ==== Credits ==== | ||

This module was developed by [[https://github.com/aacarey | Alyssa Carey]]. | This module was developed by [[https://github.com/aacarey | Alyssa Carey]]. |

analysis/course-w16/week16.txt · Last modified: 2018/07/07 10:19 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International