DreaddEffectCorticalDepth.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. load ('CBdata.mat', 'norm_CB', 'depth')
  2. load('PRh axon data.mat', 'norm_MouseYFP','MouseDepth')
  3. %%
  4. samedepth = dsearchn(MouseDepth, depth);
  5. %% Averaging two bins in MouseYFP
  6. temp1 = norm_MouseYFP(1:2:end,:);
  7. temp2 = norm_MouseYFP(2:2:end,:);
  8. norm_MouseYFPcorr = (temp1+temp2)./2;
  9. norm_MouseYFPcorr(387,:) = norm_MouseYFP(772,:);
  10. %% Effect size
  11. effect = nanmean(norm_MouseYFPcorr,2) .* nanmean(norm_CB,2);
  12. %%
  13. figure
  14. boundedline(depth, nanmean(norm_MouseYFPcorr,2), nanstd(norm_MouseYFPcorr,[],2)./sqrt(size(norm_MouseYFPcorr,2)),'g-')
  15. hold on
  16. boundedline(depth, mean(norm_CB,2), std(norm_CB,[],2)./sqrt(size(norm_CB,2)),'r-')
  17. plot(depth,effect,'k','linew',2)
  18. xlim([50 1000])
  19. ylim([0 1])
  20. xlabel('Depth (um)')
  21. ylabel('Normmalized Amplitude')
  22. % Layer boundaries (Lefort et al., 2009, Neuron)
  23. L1 = 128;
  24. L23 = 418;
  25. L4 = 588;
  26. L5 = 890;
  27. L6 = 1154;
  28. yvals = get(gca,'Ylim');
  29. hold on
  30. plot([L1 L1], yvals, 'r--')
  31. plot([L23 L23], yvals, 'r--')
  32. plot([L4 L4], yvals, 'r--')
  33. plot([L5 L5], yvals, 'r--')
  34. legend({'YFP', 'Chicago blue', 'Effect'})
  35. %% Quantify Area under the curve
  36. interval = depth(2)-depth(1);
  37. area = effect*interval;
  38. startidx = dsearchn(depth,50)+1; %MouseYFP starts from 50 um
  39. TotalArea = sum(area(startidx:end));
  40. LayerBoundaries = [L1; L23; L4; L5];
  41. LayerIdx = zeros(4,1);
  42. for i = 1:4
  43. LayerIdx(i) = dsearchn(depth, LayerBoundaries(i));
  44. end
  45. LayerIdx = [startidx-1; LayerIdx; 387];
  46. LayerAreas = zeros(5,1);
  47. for i = 1:length(LayerIdx)-1
  48. LayerAreas(i) = sum(area(LayerIdx(i)+1:LayerIdx(i+1)));
  49. end
  50. Percentage = LayerAreas./TotalArea;
  51. Percentage = Percentage*100