TwoPhotonAnalysis.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. load('PRh axons.mat', 'Mouse16D')
  2. %load('200116D_200129_trace.mat')
  3. %%
  4. fs = 30; %30.3017
  5. preStim = 59; %frame %2 sec
  6. postStim = 90; %frame %3 sec
  7. % Before learning
  8. pre_stimframe = [Mouse16D.pre10uA_0127.stimframe];
  9. %pre_stimframe = CleanStimframe(pre_stimframe);
  10. pre_trace = session1(1).normtrace;
  11. prePSTCa = PSTCaTrace(pre_stimframe, pre_trace, preStim, postStim);
  12. % After learning
  13. post_stimframe = [Mouse16D.pre10uA_0128.stimframe];
  14. %post_stimframe = CleanStimframe(post_stimframe);
  15. post_trace = session2(1).normtrace;
  16. postPSTCa = PSTCaTrace(post_stimframe, post_trace, preStim, postStim);
  17. % Reward only
  18. reward_stimframe = [Mouse16D.reward_0128_2.stimframe];
  19. %reward_stimframe = CleanStimframe(reward_stimframe);
  20. reward_trace = session2(4).normtrace;
  21. rewardPSTCa = PSTCaTrace(reward_stimframe, reward_trace, preStim, postStim);
  22. %%
  23. edges = -2:1/fs:3;
  24. figure
  25. boundedline(edges(1:end-1), mean(prePSTCa,2), std(prePSTCa,[],2)/sqrt(size(prePSTCa,2)), 'k-', ...,
  26. edges(1:end-1), mean(postPSTCa,2), std(postPSTCa,[],2)/sqrt(size(postPSTCa,2)), 'r-')
  27. xlim([-1 2])
  28. legend('prelearning', 'postlearning')
  29. ylabel('dF/F0 (%)')
  30. xlabel('Time (s)')
  31. title('Mouse 16D')
  32. % Reward only
  33. figure
  34. boundedline(edges(1:end-1), mean(rewardPSTCa,2), std(rewardPSTCa,[],2)/sqrt(size(rewardPSTCa,2)), 'g-')
  35. legend('Reward only')
  36. ylabel('dF/F0 (%)')
  37. xlabel('Time (s)')
  38. title('Mouse 16D')
  39. xlim([-1 2])
  40. %%
  41. Mouse16D.pre_trace = pre_trace;
  42. Mouse16D.pre_stimframe = pre_stimframe;
  43. Mouse16D.prePSTCa = prePSTCa;
  44. Mouse16D.post_trace = post_trace;
  45. Mouse16D.post_stimframe = post_stimframe;
  46. Mouse16D.postPSTCa = postPSTCa;
  47. Mouse16D.reward_trace = reward_trace;
  48. Mouse16D.reward_stimframe = reward_stimframe;
  49. Mouse16D.rewardPSTCa = rewardPSTCa;
  50. %% Statistics
  51. % Mean calcium amplitudes (between t = 0 and 1.5 s after stimulus) before and after learning were compared by Mann-Whitney U test.
  52. [p h] = ranksum(mean(Mouse15C.prePSTCa(61:105,:)), mean(Mouse15C.postPSTCa(61:105,:)))
  53. [p h] = ranksum(mean(Mouse16D.prePSTCa(61:105,:)), mean(Mouse16D.postPSTCa(61:105,:)))
  54. [p h] = ranksum(mean(Mouse31F.prePSTCa(61:105,:)), mean(Mouse31F.postPSTCa(61:105,:)))
  55. %% Correction fit
  56. prePSTCa = Mouse15C.prePSTCa;
  57. [fx, Corr_prePSTCa] = CorrectionFit(prePSTCa,edges);
  58. postPSTCa = Mouse15C.postPSTCa;
  59. [fx, Corr_postPSTCa] = CorrectionFit(postPSTCa,edges);
  60. figure
  61. boundedline(edges(1:end-1), mean(Corr_prePSTCa,2), std(Corr_prePSTCa,[],2)/sqrt(size(Corr_prePSTCa,2)), 'k-', ...,
  62. edges(1:end-1), mean(Corr_postPSTCa,2), std(Corr_postPSTCa,[],2)/sqrt(size(Corr_postPSTCa,2)), 'r-')
  63. xlim([-1 2])
  64. [p h] = ranksum(mean(Corr_prePSTCa(61:105,:)), mean(corr_postPSTCa(61:105,:)))
  65. Mouse15C.Corr_prePSTCa = Corr_prePSTCa;
  66. Mouse15C.Corr_postPSTCa = Corr_postPSTCa;
  67. %% Pooled
  68. prePSTCa = [Mouse15C.prePSTCa Mouse16D.prePSTCa Mouse31F.prePSTCa];
  69. postPSTCa = [Mouse15C.postPSTCa Mouse16D.postPSTCa Mouse31F.postPSTCa];
  70. [p h] = ranksum(mean(prePSTCa(61:105,:)), mean(postPSTCa(61:105,:)))
  71. rewardPSTCa = [Mouse15C.rewardPSTCa Mouse16D.rewardPSTCa Mouse31F.rewardPSTCa];
  72. [p h] = signrank(mean(rewardPSTCa(31:60,:)), mean(rewardPSTCa(61:105,:)))