l_RPE.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. %Finding RPE neurons
  2. clear all;
  3. load ('R_2R.mat');
  4. Suc=R_2R.SucN; %neurons with greater firing for sucrose
  5. %find cue excited neurons
  6. Cue=strcmp('Cue', R_2R.Erefnames);
  7. RD1=strcmp('RD1', R_2R.Erefnames);
  8. RD2=strcmp('RD2', R_2R.Erefnames);
  9. CueEx=R_2R.Ev(Cue).RespDir==1;
  10. %neurons that are cue excited and sucrose preferring
  11. Sel=CueEx&Suc;
  12. sucrose=[1 0.6 0.1];
  13. maltodextrin=[.9 0.3 .9];
  14. water=[0.00 0.75 0.75];
  15. total=[0.3 0.1 0.8];
  16. exc=[0 113/255 188/255];
  17. inh=[240/255 0 50/255];
  18. cued=[0.5 0.1 0.8];
  19. uncued=[0.3 0.7 0.1];
  20. %divide neurons up by region
  21. NAneurons=strcmp(R_2R.Ninfo(:,3),'NA');
  22. VPneurons=strcmp(R_2R.Ninfo(:,3),'VP');
  23. %% cue response
  24. Xaxis=[-0.5 1];
  25. inttime=find(R_2R.Param.Tm>=Xaxis(1) & R_2R.Param.Tm<=Xaxis(2));
  26. paramtime=R_2R.Param.Tm(inttime);
  27. %NAc
  28. subplot(2,4,1);
  29. hold on;
  30. %plot sucrose preferring and cue excited neurons to cue
  31. psth1=nanmean(R_2R.Ev(Cue).PSTHz(Sel&NAneurons,inttime),1);
  32. sem1=nanste(R_2R.Ev(Cue).PSTHz(Sel&NAneurons,inttime),1); %calculate standard error of the mean
  33. up1=psth1+sem1;
  34. down1=psth1-sem1;
  35. plot(paramtime,psth1,'Color',total,'linewidth',1);
  36. patch([paramtime,paramtime(end:-1:1)],[up1,down1(end:-1:1)],total,'EdgeColor','none');alpha(0.5);
  37. plot([-2 5],[0 0],':','color','k','linewidth',0.75);
  38. plot([0 0],[-1 10],':','color','k','linewidth',0.75);
  39. axis([Xaxis(1) Xaxis(2) -0.6 6.5]);
  40. ylabel('Mean firing (z-score)');
  41. %VP
  42. subplot(2,4,5);
  43. hold on;
  44. %plot sucrose preferring and cue excited neurons to cue
  45. psth1=nanmean(R_2R.Ev(Cue).PSTHz(Sel&VPneurons,inttime),1);
  46. sem1=nanste(R_2R.Ev(Cue).PSTHz(Sel&VPneurons,inttime),1); %calculate standard error of the mean
  47. up1=psth1+sem1;
  48. down1=psth1-sem1;
  49. plot(paramtime,psth1,'Color',total,'linewidth',1);
  50. patch([paramtime,paramtime(end:-1:1)],[up1,down1(end:-1:1)],total,'EdgeColor','none');alpha(0.5);
  51. plot([-2 5],[0 0],':','color','k','linewidth',0.75);
  52. plot([0 0],[-1 10],':','color','k','linewidth',0.75);
  53. axis([Xaxis(1) Xaxis(2) -0.6 8]);
  54. ylabel('Mean firing (z-score)');
  55. xlabel('Seconds from cue');
  56. %% reward response
  57. Xaxis=[-1 3.5];
  58. inttime=find(R_2R.Param.Tm>=Xaxis(1) & R_2R.Param.Tm<=Xaxis(2));
  59. paramtime=R_2R.Param.Tm(inttime);
  60. %NAc
  61. subplot(2,4,2:4);
  62. hold on;
  63. %plot sucrose preferring and cue excited neurons to sucrose
  64. psth1=nanmean(R_2R.Ev(RD1).PSTHz(Sel&NAneurons,inttime),1);
  65. sem1=nanste(R_2R.Ev(RD1).PSTHz(Sel&NAneurons,inttime),1); %calculate standard error of the mean
  66. up1=psth1+sem1;
  67. down1=psth1-sem1;
  68. %plot sucrose preferring and cue extied neurons to malt
  69. psth2=nanmean(R_2R.Ev(RD2).PSTHz(Sel&NAneurons,inttime),1);
  70. sem2=nanste(R_2R.Ev(RD2).PSTHz(Sel&NAneurons,inttime),1); %calculate standard error of the mean
  71. up2=psth2+sem2;
  72. down2=psth2-sem2;
  73. plot(paramtime,psth1,'Color',sucrose,'linewidth',1);
  74. plot(paramtime,psth2,'Color',maltodextrin,'linewidth',1);
  75. patch([paramtime,paramtime(end:-1:1)],[up1,down1(end:-1:1)],sucrose,'EdgeColor','none');alpha(0.5);
  76. patch([paramtime,paramtime(end:-1:1)],[up2,down2(end:-1:1)],maltodextrin,'EdgeColor','none');alpha(0.5);
  77. plot([-2 5],[0 0],':','color','k','linewidth',0.75);
  78. plot([0 0],[-1 10],':','color','k','linewidth',0.75);
  79. axis([Xaxis(1) Xaxis(2) -0.8 6.5]);
  80. legend('Suc trials','Mal trials');
  81. set(gca,'ytick',[]);
  82. title(['NAc (n=' num2str(sum(Sel&NAneurons)) ', ' num2str(round(100*sum(Sel&NAneurons)/sum(NAneurons))) '%)']);
  83. %VP
  84. subplot(2,4,6:8);
  85. hold on;
  86. %plot sucrose preferring and cue excited neurons to sucrose
  87. psth1=nanmean(R_2R.Ev(RD1).PSTHz(Sel&VPneurons,inttime),1);
  88. sem1=nanste(R_2R.Ev(RD1).PSTHz(Sel&VPneurons,inttime),1); %calculate standard error of the mean
  89. up1=psth1+sem1;
  90. down1=psth1-sem1;
  91. %plot sucrose preferring and cue extied neurons to malt
  92. psth2=nanmean(R_2R.Ev(RD2).PSTHz(Sel&VPneurons,inttime),1);
  93. sem2=nanste(R_2R.Ev(RD2).PSTHz(Sel&VPneurons,inttime),1); %calculate standard error of the mean
  94. up2=psth2+sem2;
  95. down2=psth2-sem2;
  96. plot(paramtime,psth1,'Color',sucrose,'linewidth',1);
  97. plot(paramtime,psth2,'Color',maltodextrin,'linewidth',1);
  98. patch([paramtime,paramtime(end:-1:1)],[up1,down1(end:-1:1)],sucrose,'EdgeColor','none');alpha(0.5);
  99. patch([paramtime,paramtime(end:-1:1)],[up2,down2(end:-1:1)],maltodextrin,'EdgeColor','none');alpha(0.5);
  100. plot([-2 5],[0 0],':','color','k','linewidth',0.75);
  101. plot([0 0],[-1 10],':','color','k','linewidth',0.75);
  102. axis([Xaxis(1) Xaxis(2) -0.8 8]);
  103. legend('Suc trials','Mal trials');
  104. set(gca,'ytick',[]);
  105. xlabel('Seconds from RD');
  106. title(['VP (n=' num2str(sum(Sel&VPneurons)) ', ' num2str(round(100*sum(Sel&VPneurons)/sum(VPneurons))) '%)']);