OSCR

The entorhinal spatial map integrates visual identity information of landmarks.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 885 lines · 21 KB · Apache-2.0

  1. copyfile('D:\GarretData\IdenticalCueData\environmentTemplate\temp_ENV2.mat','temp_ENV2.mat');
  2. copyfile('D:\GarretData\IdenticalCueData\environmentTemplate\ENV2_CueBins.mat','ENV2_CueBins.mat');
  3. load('temp_ENV2.mat');
  4. load('ENV2_CueBins.mat');
  5. temp=temp_ENV2; %cue template
  6. c=ENV2_CueBins;
  7. % use 95 percentile
  8. load('D:\GarretData\IdenticalCueData\tracks234\cueCellsEachDay\cell95Idx.mat');
  9. load('D:\GarretData\IdenticalCueData\allFolders.mat');
  10. env=2;
  11. day=1;
  12. %calculate amplitude difference using both peak or mean
  13. % for sequence correlation:
  14. %creat folders and cell idx
  15. useIdx=cell95Idx(:,env-1);
  16. useFolders={};
  17. p=pwd;
  18. for n=1:length(allFolders)
  19. cd(allFolders{n});
  20. load('allDayEnv.mat')
  21. cd(allDayEnv{env}{day});
  22. d=dir('TSeries-*');
  23. for m=1:length(d)
  24. useFolders{end+1}=[d(m).folder '\' d(m).name '\suite2p'];
  25. end
  26. end
  27. cd(p)
  28. save('useIdx.mat','useIdx')
  29. save('useFolders.mat','useFolders');
  30. %%
  31. binWidth=5;
  32. %move cue identify to the first column
  33. cues=[];
  34. cues(:,1)=c(:,3);%first column: cue identify 1 and 2: same number is the same cue
  35. cues(:,[2 3])=c(:,[1 2]); %second and third columns: cue start and end
  36. cues(:,4)=(cues(:,3)+cues(:,2))/2-0.5; %cue center in bin: for the cues with add number of bins, this is the end of the second bin
  37. cues(:,5)=cues(:,4)*5; %cue center in cm
  38. save('temp.mat','temp');
  39. save('cues.mat','cues');
  40. figure,plot(temp)
  41. for n=1:size(cues,1);
  42. if cues(n,1)==1;
  43. hold on
  44. plot([cues(n,2):1:cues(n,3)],1,'g.');
  45. else
  46. hold on
  47. plot([cues(n,2):1:cues(n,3)],1,'m.');
  48. end
  49. end
  50. saveas(gcf,'templatePlot.fig')
  51. close
  52. %%
  53. %all distances
  54. allDistancesI=[];%all distances betwen identical cues: cue numbers are the row numbers in "cues"
  55. allDistancesNI=[];%all distances betwen non-identical cues: cue numbers are the row numbers in "cues"
  56. %first column is one cue, second column is the second cue, the third column is their distances in bins, and the last one
  57. %is their distances in cm.
  58. %identical cue combinations
  59. idxI=[];
  60. %the both types of cue
  61. cueType=[1 2];
  62. for ct=1:length(cueType)
  63. i=find(cues(:,1)==cueType(ct));
  64. for n=1:length(i)-1;
  65. for m=n+1:length(i);
  66. thisPair=[i(n) i(m)];
  67. idxI=[idxI;thisPair];
  68. end
  69. end
  70. end
  71. allDistancesI=idxI;%the first and second columns are the two cues
  72. %the 3rd column is the distance between cue centers by bin
  73. for n=1:size(allDistancesI,1);
  74. allDistancesI(n,3)=abs(cues(allDistancesI(n,1),4)-cues(allDistancesI(n,2),4));
  75. allDistancesI(n,4)=allDistancesI(n,3)*binWidth;
  76. end
  77. [~,i]=sort(allDistancesI(:,4));
  78. allDistancesI=allDistancesI(i,:);
  79. %non identical cue combinations
  80. idxNI=[];
  81. %the first type of cue
  82. i1=find(cues(:,1)==1);
  83. i2=find(cues(:,1)==2);
  84. for n=1:length(i1);
  85. for m=1:length(i2);
  86. thisPair=[i1(n) i2(m)];
  87. idxNI=[idxNI;thisPair];
  88. end
  89. end
  90. allDistancesNI=idxNI;%the first and second columns are the two cues
  91. %the 3rd column is the distance between cue centers by bin
  92. for n=1:size(allDistancesNI,1);
  93. allDistancesNI(n,3)=abs(cues(allDistancesNI(n,1),4)-cues(allDistancesNI(n,2),4));
  94. allDistancesNI(n,4)=allDistancesNI(n,3)*binWidth;
  95. end
  96. [~,i]=sort(allDistancesNI(:,4));
  97. allDistancesNI=allDistancesNI(i,:);
  98. save('allDistancesNI.mat','allDistancesNI');
  99. save('allDistancesI.mat','allDistancesI');
  100. % group the same distances in cells
  101. allDistancesIGroup={};
  102. allDistancesIGroup{1}=allDistancesI([1 2],:);
  103. allDistancesIGroup{2}=allDistancesI(3,:);
  104. allDistancesIGroup{3}=allDistancesI(4,:);
  105. allDistancesIGroup{4}=allDistancesI(5,:);
  106. allDistancesIGroup{5}=allDistancesI(6,:);
  107. allDistancesIGroup{6}=allDistancesI(7,:);
  108. allDistancesNIGroup={};
  109. allDistancesNIGroup{1}=allDistancesNI(1,:);
  110. allDistancesNIGroup{2}=allDistancesNI([2 3],:);
  111. allDistancesNIGroup{3}=allDistancesNI(4,:);
  112. allDistancesNIGroup{4}=allDistancesNI(5,:);
  113. allDistancesNIGroup{5}=allDistancesNI(6,:);
  114. allDistancesNIGroup{6}=allDistancesNI(7,:);
  115. allDistancesNIGroup{7}=allDistancesNI(8,:);
  116. save('allDistancesNIGroup.mat','allDistancesNIGroup');
  117. save('allDistancesIGroup.mat','allDistancesIGroup');
  118. %% amplitude differences
  119. load('useIdx.mat');
  120. load('useFolders.mat')
  121. load('allDistancesIGroup.mat')
  122. load('allDistancesNIGroup.mat')
  123. p=pwd;
  124. cueCellDataThresh=95;
  125. [ampDiffIMean,ampDiffNIMean,ampDiffIPeak,ampDiffNIPeak] = ampDiff(useIdx,useFolders,allDistancesIGroup,allDistancesNIGroup,cueCellDataThresh);
  126. save('ampDiffIMean.mat','ampDiffIMean');
  127. save('ampDiffIPeak.mat','ampDiffIPeak');
  128. save('ampDiffNIMean.mat','ampDiffNIMean');
  129. save('ampDiffNIPeak.mat','ampDiffNIPeak');
  130. %% plot them
  131. ampDiffIMeanAll={};% if there are two cells, merge them
  132. ampDiffIMeanMean=[];%mean
  133. ampDiffIMeanSEM=[];
  134. for n=1:length(ampDiffIMean);
  135. a=ampDiffIMean{n};
  136. for m=1:length(a);
  137. a{m}=a{m}';
  138. end
  139. aa=nanmean(cell2mat(a),2)';
  140. ampDiffIMeanAll{n}=aa;
  141. ampDiffIMeanMean(n)=nanmean(aa);
  142. ampDiffIMeanSEM(n)=nansem(aa,2);
  143. end
  144. ampDiffIPeakAll={};% if there are two cells, merge them
  145. ampDiffIPeakMean=[];%mean
  146. ampDiffIPeakSEM=[];
  147. for n=1:length(ampDiffIPeak);
  148. a=ampDiffIPeak{n};
  149. for m=1:length(a);
  150. a{m}=a{m}';
  151. end
  152. aa=nanmean(cell2mat(a),2)';
  153. ampDiffIPeakAll{n}=aa;
  154. ampDiffIPeakMean(n)=nanmean(aa);
  155. ampDiffIPeakSEM(n)=nansem(aa,2);
  156. end
  157. distanceOnlyI=unique(allDistancesI(:,end));
  158. ampDiffNIMeanAll={};% if there are two cells, merge them
  159. ampDiffNIMeanMean=[];%mean
  160. ampDiffNIMeanSEM=[];
  161. for n=1:length(ampDiffNIMean);
  162. a=ampDiffNIMean{n};
  163. for m=1:length(a);
  164. a{m}=a{m}';
  165. end
  166. aa=nanmean(cell2mat(a),2)';
  167. ampDiffNIMeanAll{n}=aa;
  168. ampDiffNIMeanMean(n)=nanmean(aa);
  169. ampDiffNIMeanSEM(n)=nansem(aa,2);
  170. end
  171. ampDiffNIPeakAll={};% if there are two cells, merge them
  172. ampDiffNIPeakMean=[];%mean
  173. ampDiffNIPeakSEM=[];
  174. for n=1:length(ampDiffNIPeak);
  175. a=ampDiffNIPeak{n};
  176. for m=1:length(a);
  177. a{m}=a{m}';
  178. end
  179. aa=nanmean(cell2mat(a),2)';
  180. ampDiffNIPeakAll{n}=aa;
  181. ampDiffNIPeakMean(n)=nanmean(aa);
  182. ampDiffNIPeakSEM(n)=nansem(aa,2);
  183. end
  184. distanceOnlyNI=unique(allDistancesNI(:,end));
  185. figure
  186. subplot(221)
  187. errorbar(distanceOnlyI,ampDiffIMeanMean,ampDiffIMeanSEM,'g')
  188. hold on
  189. errorbar(distanceOnlyNI,ampDiffNIMeanMean,ampDiffNIMeanSEM,'m')
  190. title('ampDifferences mean');
  191. subplot(222)
  192. errorbar(distanceOnlyI,ampDiffIPeakMean,ampDiffIPeakSEM,'g')
  193. hold on
  194. errorbar(distanceOnlyNI,ampDiffNIPeakMean,ampDiffNIPeakSEM,'m')
  195. title('ampDifferences peak');
  196. %no distances, just include all
  197. I=cell2mat(ampDiffIMeanAll);
  198. NI=cell2mat(ampDiffNIMeanAll);
  199. M=[];
  200. M(1)=nanmean(I);
  201. M(2)=nanmean(NI);
  202. S=[];
  203. S(1)=nansem(I,2);
  204. S(2)=nansem(NI,2);
  205. subplot(223)
  206. bar([1 2],M)
  207. hold on
  208. errorbar([1 2],M,S,'.')
  209. names={'Iden'; 'Noniden' };
  210. set(gca,'xticklabel',names)
  211. [r,p1]=ttest2(I,NI);
  212. title(['mean p=',num2str(p1)])
  213. %no distances, just include all
  214. I=cell2mat(ampDiffIPeakAll);
  215. NI=cell2mat(ampDiffNIPeakAll);
  216. M=[];
  217. M(1)=nanmean(I);
  218. M(2)=nanmean(NI);
  219. S=[];
  220. S(1)=nansem(I,2);
  221. S(2)=nansem(NI,2);
  222. subplot(224)
  223. bar([1 2],M)
  224. hold on
  225. errorbar([1 2],M,S,'.')
  226. names={'Iden'; 'Noniden' };
  227. set(gca,'xticklabel',names)
  228. [r,p1]=ttest2(I,NI);
  229. title(['Peak p=',num2str(p1)])
  230. saveas(gcf,'ampDifferences.fig')
  231. %only use matched distances
  232. idxI=[1 3 5 6];
  233. idxNI=[1 3 5 6];
  234. figure
  235. subplot(221)
  236. errorbar(distanceOnlyI(idxI),ampDiffIMeanMean(idxI),ampDiffIMeanSEM(idxI),'g')
  237. hold on
  238. errorbar(distanceOnlyNI(idxNI),ampDiffNIMeanMean(idxNI),ampDiffNIMeanSEM(idxNI),'m')
  239. %STATs
  240. ITemp=ampDiffIMeanAll(idxI);
  241. NITemp=ampDiffNIMeanAll(idxNI);
  242. I=[];
  243. NI=[];
  244. for n=1:length(idxI);
  245. I(:,n)=ITemp{n}';
  246. NI(:,n)=NITemp{n}';
  247. end
  248. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  249. title(['ampDifferences mean pAnova',num2str(pAnova(1))]);
  250. subplot(222)
  251. errorbar(distanceOnlyI(idxI),ampDiffIPeakMean(idxI),ampDiffIPeakSEM(idxI),'g')
  252. hold on
  253. errorbar(distanceOnlyNI(idxNI),ampDiffNIPeakMean(idxNI),ampDiffNIPeakSEM(idxNI),'m')
  254. %STATs
  255. ITemp=ampDiffIPeakAll(idxI);
  256. NITemp=ampDiffNIPeakAll(idxNI);
  257. I=[];
  258. NI=[];
  259. for n=1:length(idxI);
  260. I(:,n)=ITemp{n}';
  261. NI(:,n)=NITemp{n}';
  262. end
  263. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  264. title(['ampDifferences peak pAnova',num2str(pAnova(1))]);
  265. %no distances, just include all
  266. I=cell2mat(ampDiffIMeanAll(idxI));
  267. NI=cell2mat(ampDiffNIMeanAll(idxNI));
  268. M=[];
  269. M(1)=nanmean(I);
  270. M(2)=nanmean(NI);
  271. S=[];
  272. S(1)=nansem(I,2);
  273. S(2)=nansem(NI,2);
  274. subplot(223)
  275. bar([1 2],M)
  276. hold on
  277. errorbar([1 2],M,S,'.')
  278. names={'Iden'; 'Noniden' };
  279. set(gca,'xticklabel',names)
  280. [r,p1]=ttest2(I,NI);
  281. title(['mean p=',num2str(p1)])
  282. %no distances, just include all
  283. I=cell2mat(ampDiffIPeakAll(idxI));
  284. NI=cell2mat(ampDiffNIPeakAll(idxNI));
  285. M=[];
  286. M(1)=nanmean(I);
  287. M(2)=nanmean(NI);
  288. S=[];
  289. S(1)=nansem(I,2);
  290. S(2)=nansem(NI,2);
  291. subplot(224)
  292. bar([1 2],M)
  293. hold on
  294. errorbar([1 2],M,S,'.')
  295. names={'Iden'; 'Noniden' };
  296. set(gca,'xticklabel',names)
  297. [r,p1]=ttest2(I,NI);
  298. title(['Peak p=',num2str(p1)])
  299. saveas(gcf,'ampDifferencesMatchedDistance.fig')
  300. %% get all lags
  301. cueCellDataThresh=95;
  302. load('useIdx.mat');
  303. load('useFolders.mat');
  304. p=pwd;
  305. lags={};
  306. for n=1:length(useIdx);
  307. lags{n}=[];
  308. disp(n)
  309. cd(useFolders{n});
  310. cells=useIdx{n};
  311. if cueCellDataThresh==95;
  312. filename1='cueAnalysis_sig\newScoreShuffleTemplate\cueCellsAllThresh.mat';
  313. filename2='cueCellsAllThresh';
  314. else
  315. filename1=sprintf('%s%d.mat','cueAnalysis_sig\newScoreShuffleTemplate\cueCellsAllThresh',cueCellDataThresh);
  316. filename2=['cueCellsAllThresh',num2str(cueCellDataThresh)];
  317. end
  318. load(filename1);
  319. data=eval(filename2);
  320. [~,useCellIdx,~]=intersect(data.realIdx,cells);
  321. lags{n}=data.lags(useCellIdx);
  322. end
  323. cd(p);
  324. save('lags.mat','lags');
  325. %% get all dfofs
  326. cueCellDataThresh=95;
  327. load('useIdx.mat');
  328. load('useFolders.mat');
  329. p=pwd;
  330. dfofs={};
  331. for n=1:length(useIdx);
  332. dfofs{n}=[];
  333. disp(n)
  334. cd(useFolders{n});
  335. cells=useIdx{n};
  336. if cueCellDataThresh==95;
  337. filename1='cueAnalysis_sig\newScoreShuffleTemplate\cueCellsAllThresh.mat';
  338. filename2='cueCellsAllThresh';
  339. else
  340. filename1=sprintf('%s%d.mat','cueAnalysis_sig\newScoreShuffleTemplate\cueCellsAllThresh',cueCellDataThresh);
  341. filename2=['cueCellsAllThresh',num2str(cueCellDataThresh)];
  342. end
  343. load(filename1);
  344. data=eval(filename2);
  345. [~,useCellIdx,~]=intersect(data.realIdx,cells);
  346. dfofs{n}=data.dfofAvg(:,useCellIdx);
  347. end
  348. cd(p);
  349. save('dfofs.mat','dfofs');
  350. %% calculate correlation
  351. load('useIdx.mat');
  352. load('useFolders.mat')
  353. load('allDistancesIGroup.mat')
  354. load('allDistancesNIGroup.mat')
  355. p=pwd;
  356. cueCellDataThresh=95;
  357. % number of cells per sequence
  358. NCell=15;
  359. % number of shuffles
  360. NShuffle=100;
  361. NCellFolders=[];
  362. for n=1:length(useIdx);
  363. NCellFolders(n)=length(useIdx{n});
  364. end
  365. iUse=find(NCellFolders>NCell);
  366. useIdxN=useIdx(iUse);
  367. useFoldersN=useFolders(iUse);
  368. [randomCells,corrIMean,corrNIMean,corrIPeak,corrNIPeak] = corrAtCues_NCellFOV(useIdxN,useFoldersN,allDistancesIGroup,allDistancesNIGroup,cueCellDataThresh,NCell);
  369. save('corrIMean.mat','corrIMean');
  370. save('corrIPeak.mat','corrIPeak');
  371. save('corrNIMean.mat','corrNIMean');
  372. save('corrNIPeak.mat','corrNIPeak');
  373. save('randomCells.mat','randomCells');
  374. %% plot corr
  375. corrIMeanAll={};% if there are two cells, merge them
  376. corrIMeanMean=[];%mean
  377. corrIMeanSEM=[];
  378. for n=1:length(corrIMean);
  379. a=corrIMean{n};
  380. for m=1:length(a);
  381. a{m}=a{m}';
  382. end
  383. aa=nanmean(cell2mat(a),2)';
  384. corrIMeanAll{n}=aa;
  385. corrIMeanMean(n)=nanmean(aa);
  386. corrIMeanSEM(n)=nansem(aa,2);
  387. end
  388. corrIPeakAll={};% if there are two cells, merge them
  389. corrIPeakMean=[];%mean
  390. corrIPeakSEM=[];
  391. for n=1:length(corrIPeak);
  392. a=corrIPeak{n};
  393. for m=1:length(a);
  394. a{m}=a{m}';
  395. end
  396. aa=nanmean(cell2mat(a),2)';
  397. corrIPeakAll{n}=aa;
  398. corrIPeakMean(n)=nanmean(aa);
  399. corrIPeakSEM(n)=nansem(aa,2);
  400. end
  401. distanceOnlyI=unique(allDistancesI(:,end));
  402. corrNIMeanAll={};% if there are two cells, merge them
  403. corrNIMeanMean=[];%mean
  404. corrNIMeanSEM=[];
  405. for n=1:length(corrNIMean);
  406. a=corrNIMean{n};
  407. for m=1:length(a);
  408. a{m}=a{m}';
  409. end
  410. aa=nanmean(cell2mat(a),2)';
  411. corrNIMeanAll{n}=aa;
  412. corrNIMeanMean(n)=nanmean(aa);
  413. corrNIMeanSEM(n)=nansem(aa,2);
  414. end
  415. corrNIPeakAll={};% if there are two cells, merge them
  416. corrNIPeakMean=[];%mean
  417. corrNIPeakSEM=[];
  418. for n=1:length(corrNIPeak);
  419. a=corrNIPeak{n};
  420. for m=1:length(a);
  421. a{m}=a{m}';
  422. end
  423. aa=nanmean(cell2mat(a),2)';
  424. corrNIPeakAll{n}=aa;
  425. corrNIPeakMean(n)=nanmean(aa);
  426. corrNIPeakSEM(n)=nansem(aa,2);
  427. end
  428. distanceOnlyNI=unique(allDistancesNI(:,end));
  429. figure
  430. subplot(221)
  431. errorbar(distanceOnlyI,corrIMeanMean,corrIMeanSEM,'g')
  432. hold on
  433. errorbar(distanceOnlyNI,corrNIMeanMean,corrNIMeanSEM,'m')
  434. title('corr mean');
  435. subplot(222)
  436. errorbar(distanceOnlyI,corrIPeakMean,corrIPeakSEM,'g')
  437. hold on
  438. errorbar(distanceOnlyNI,corrNIPeakMean,corrNIPeakSEM,'m')
  439. title('corr peak');
  440. %no distances, just include all
  441. I=cell2mat(corrIMeanAll);
  442. NI=cell2mat(corrNIMeanAll);
  443. M=[];
  444. M(1)=nanmean(I);
  445. M(2)=nanmean(NI);
  446. S=[];
  447. S(1)=nansem(I,2);
  448. S(2)=nansem(NI,2);
  449. subplot(223)
  450. bar([1 2],M)
  451. hold on
  452. errorbar([1 2],M,S,'.')
  453. names={'Iden'; 'Noniden' };
  454. set(gca,'xticklabel',names)
  455. [r,p1]=ttest2(I,NI);
  456. title(['mean p=',num2str(p1)])
  457. %no distances, just include all
  458. I=cell2mat(corrIPeakAll);
  459. NI=cell2mat(corrNIPeakAll);
  460. M=[];
  461. M(1)=nanmean(I);
  462. M(2)=nanmean(NI);
  463. S=[];
  464. S(1)=nansem(I,2);
  465. S(2)=nansem(NI,2);
  466. subplot(224)
  467. bar([1 2],M)
  468. hold on
  469. errorbar([1 2],M,S,'.')
  470. names={'Iden'; 'Noniden' };
  471. set(gca,'xticklabel',names)
  472. [r,p1]=ttest2(I,NI);
  473. title(['Peak p=',num2str(p1)])
  474. filename=sprintf('%s_%d_%s_%d.fig', 'corrNCell', NCell,'NShuffle',NShuffle);
  475. saveas(gcf,filename)
  476. figure
  477. subplot(221)
  478. errorbar(distanceOnlyI(idxI),corrIMeanMean(idxI),corrIMeanSEM(idxI),'g')
  479. hold on
  480. errorbar(distanceOnlyNI(idxNI),corrNIMeanMean(idxNI),corrNIMeanSEM(idxNI),'m')
  481. %STATs
  482. ITemp=corrIMeanAll(idxI);
  483. NITemp=corrNIMeanAll(idxNI);
  484. I=[];
  485. NI=[];
  486. for n=1:length(idxI);
  487. I(:,n)=ITemp{n}';
  488. NI(:,n)=NITemp{n}';
  489. end
  490. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  491. title(['corr mean pAnova',num2str(pAnova(1))]);
  492. subplot(222)
  493. errorbar(distanceOnlyI(idxI),corrIPeakMean(idxI),corrIPeakSEM(idxI),'g')
  494. hold on
  495. errorbar(distanceOnlyNI(idxNI),corrNIPeakMean(idxNI),corrNIPeakSEM(idxNI),'m')
  496. %STATs
  497. ITemp=corrIPeakAll(idxI);
  498. NITemp=corrNIPeakAll(idxNI);
  499. I=[];
  500. NI=[];
  501. for n=1:length(idxI);
  502. I(:,n)=ITemp{n}';
  503. NI(:,n)=NITemp{n}';
  504. end
  505. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  506. title(['corr peak pAnova',num2str(pAnova(1))]);
  507. %no distances, just include all
  508. I=cell2mat(corrIMeanAll(idxI));
  509. NI=cell2mat(corrNIMeanAll(idxNI));
  510. M=[];
  511. M(1)=nanmean(I);
  512. M(2)=nanmean(NI);
  513. S=[];
  514. S(1)=nansem(I,2);
  515. S(2)=nansem(NI,2);
  516. subplot(223)
  517. bar([1 2],M)
  518. hold on
  519. errorbar([1 2],M,S,'.')
  520. names={'Iden'; 'Noniden' };
  521. set(gca,'xticklabel',names)
  522. [r,p1]=ttest2(I,NI);
  523. title(['mean p=',num2str(p1)])
  524. %no distances, just include all
  525. I=cell2mat(corrIPeakAll(idxI));
  526. NI=cell2mat(corrNIPeakAll(idxNI));
  527. M=[];
  528. M(1)=nanmean(I);
  529. M(2)=nanmean(NI);
  530. S=[];
  531. S(1)=nansem(I,2);
  532. S(2)=nansem(NI,2);
  533. subplot(224)
  534. bar([1 2],M)
  535. hold on
  536. errorbar([1 2],M,S,'.')
  537. names={'Iden'; 'Noniden' };
  538. set(gca,'xticklabel',names)
  539. [r,p1]=ttest2(I,NI);
  540. title(['Peak p=',num2str(p1)])
  541. filename=sprintf('%s_%d_%s_%d_%s.fig', 'corrNCell', NCell,'NShuffle',NShuffle,'matchedDistance');
  542. saveas(gcf,filename)
  543. %% calculate correlation
  544. load('useIdx.mat');
  545. load('useFolders.mat')
  546. load('allDistancesIGroup.mat')
  547. load('allDistancesNIGroup.mat')
  548. p=pwd;
  549. cueCellDataThresh=95;
  550. % % number of cells per sequence
  551. % NCell=15;
  552. % % number of shuffles
  553. % NShuffle=100;
  554. [corrIMeanNoShuffle,corrNIMeanNoShuffle,corrIPeakNoShuffle,corrNIPeakNoShuffle] = corrAtCuesNoShuffle(useIdx,useFolders,allDistancesIGroup,allDistancesNIGroup,cueCellDataThresh);
  555. save('corrIMeanNoShuffle.mat','corrIMeanNoShuffle');
  556. save('corrIPeakNoShuffle.mat','corrIPeakNoShuffle');
  557. save('corrNIMeanNoShuffle.mat','corrNIMeanNoShuffle');
  558. save('corrNIPeakNoShuffle.mat','corrNIPeakNoShuffle');
  559. %% plot corr
  560. corrIMeanNoShuffleAll={};% if there are two cells, merge them
  561. corrIMeanNoShuffleMean=[];%mean
  562. corrIMeanNoShuffleSEM=[];
  563. for n=1:length(corrIMeanNoShuffle);
  564. a=corrIMeanNoShuffle{n};
  565. for m=1:length(a);
  566. a{m}=a{m}';
  567. end
  568. aa=nanmean(cell2mat(a),2)';
  569. corrIMeanNoShuffleAll{n}=aa;
  570. corrIMeanNoShuffleMean(n)=nanmean(aa);
  571. corrIMeanNoShuffleSEM(n)=nansem(aa,2);
  572. end
  573. corrIPeakNoShuffleAll={};% if there are two cells, merge them
  574. corrIPeakNoShuffleMean=[];%mean
  575. corrIPeakNoShuffleSEM=[];
  576. for n=1:length(corrIPeakNoShuffle);
  577. a=corrIPeakNoShuffle{n};
  578. for m=1:length(a);
  579. a{m}=a{m}';
  580. end
  581. aa=nanmean(cell2mat(a),2)';
  582. corrIPeakNoShuffleAll{n}=aa;
  583. corrIPeakNoShuffleMean(n)=nanmean(aa);
  584. corrIPeakNoShuffleSEM(n)=nansem(aa,2);
  585. end
  586. distanceOnlyI=unique(allDistancesI(:,end));
  587. corrNIMeanNoShuffleAll={};% if there are two cells, merge them
  588. corrNIMeanNoShuffleMean=[];%mean
  589. corrNIMeanNoShuffleSEM=[];
  590. for n=1:length(corrNIMeanNoShuffle);
  591. a=corrNIMeanNoShuffle{n};
  592. for m=1:length(a);
  593. a{m}=a{m}';
  594. end
  595. aa=nanmean(cell2mat(a),2)';
  596. corrNIMeanNoShuffleAll{n}=aa;
  597. corrNIMeanNoShuffleMean(n)=nanmean(aa);
  598. corrNIMeanNoShuffleSEM(n)=nansem(aa,2);
  599. end
  600. corrNIPeakNoShuffleAll={};% if there are two cells, merge them
  601. corrNIPeakNoShuffleMean=[];%mean
  602. corrNIPeakNoShuffleSEM=[];
  603. for n=1:length(corrNIPeakNoShuffle);
  604. a=corrNIPeakNoShuffle{n};
  605. for m=1:length(a);
  606. a{m}=a{m}';
  607. end
  608. aa=nanmean(cell2mat(a),2)';
  609. corrNIPeakNoShuffleAll{n}=aa;
  610. corrNIPeakNoShuffleMean(n)=nanmean(aa);
  611. corrNIPeakNoShuffleSEM(n)=nansem(aa,2);
  612. end
  613. distanceOnlyNI=unique(allDistancesNI(:,end));
  614. figure
  615. subplot(221)
  616. errorbar(distanceOnlyI,corrIMeanNoShuffleMean,corrIMeanNoShuffleSEM,'g')
  617. hold on
  618. errorbar(distanceOnlyNI,corrNIMeanNoShuffleMean,corrNIMeanNoShuffleSEM,'m')
  619. title('corr mean');
  620. subplot(222)
  621. errorbar(distanceOnlyI,corrIPeakNoShuffleMean,corrIPeakNoShuffleSEM,'g')
  622. hold on
  623. errorbar(distanceOnlyNI,corrNIPeakNoShuffleMean,corrNIPeakNoShuffleSEM,'m')
  624. title('corr peak');
  625. %no distances, just include all
  626. I=cell2mat(corrIMeanNoShuffleAll);
  627. NI=cell2mat(corrNIMeanNoShuffleAll);
  628. M=[];
  629. M(1)=nanmean(I);
  630. M(2)=nanmean(NI);
  631. S=[];
  632. S(1)=nansem(I,2);
  633. S(2)=nansem(NI,2);
  634. subplot(223)
  635. bar([1 2],M)
  636. hold on
  637. errorbar([1 2],M,S,'.')
  638. names={'Iden'; 'Noniden' };
  639. set(gca,'xticklabel',names)
  640. [r,p1]=ttest2(I,NI);
  641. title(['mean p=',num2str(p1)])
  642. %no distances, just include all
  643. I=cell2mat(corrIPeakNoShuffleAll);
  644. NI=cell2mat(corrNIPeakNoShuffleAll);
  645. M=[];
  646. M(1)=nanmean(I);
  647. M(2)=nanmean(NI);
  648. S=[];
  649. S(1)=nansem(I,2);
  650. S(2)=nansem(NI,2);
  651. subplot(224)
  652. bar([1 2],M)
  653. hold on
  654. errorbar([1 2],M,S,'.')
  655. names={'Iden'; 'Noniden' };
  656. set(gca,'xticklabel',names)
  657. [r,p1]=ttest2(I,NI);
  658. title(['Peak p=',num2str(p1)])
  659. saveas(gcf,'corrNCellNoShuffle.fig')
  660. figure
  661. subplot(221)
  662. errorbar(distanceOnlyI(idxI),corrIMeanNoShuffleMean(idxI),corrIMeanNoShuffleSEM(idxI),'g')
  663. hold on
  664. errorbar(distanceOnlyNI(idxNI),corrNIMeanNoShuffleMean(idxNI),corrNIMeanNoShuffleSEM(idxNI),'m')
  665. %STATs
  666. ITemp=corrIMeanNoShuffleAll(idxI);
  667. NITemp=corrNIMeanNoShuffleAll(idxNI);
  668. I=[];
  669. NI=[];
  670. for n=1:length(idxI);
  671. I(:,n)=ITemp{n}';
  672. NI(:,n)=NITemp{n}';
  673. end
  674. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  675. title(['corr mean pAnova',num2str(pAnova(1))]);
  676. subplot(222)
  677. errorbar(distanceOnlyI(idxI),corrIPeakNoShuffleMean(idxI),corrIPeakNoShuffleSEM(idxI),'g')
  678. hold on
  679. errorbar(distanceOnlyNI(idxNI),corrNIPeakNoShuffleMean(idxNI),corrNIPeakNoShuffleSEM(idxNI),'m')
  680. %STATs
  681. ITemp=corrIPeakNoShuffleAll(idxI);
  682. NITemp=corrNIPeakNoShuffleAll(idxNI);
  683. I=[];
  684. NI=[];
  685. for n=1:length(idxI);
  686. I(:,n)=ITemp{n}';
  687. NI(:,n)=NITemp{n}';
  688. end
  689. [pAnova,pMC,pLabel] = anovaRM2W_full_BH(I,NI,1);
  690. title(['corr mean pAnova',num2str(pAnova(1))]);
  691. %no distances, just include all
  692. I=cell2mat(corrIMeanNoShuffleAll(idxI));
  693. NI=cell2mat(corrNIMeanNoShuffleAll(idxNI));
  694. M=[];
  695. M(1)=nanmean(I);
  696. M(2)=nanmean(NI);
  697. S=[];
  698. S(1)=nansem(I,2);
  699. S(2)=nansem(NI,2);
  700. subplot(223)
  701. bar([1 2],M)
  702. hold on
  703. errorbar([1 2],M,S,'.')
  704. names={'Iden'; 'Noniden' };
  705. set(gca,'xticklabel',names)
  706. [r,p1]=ttest2(I,NI);
  707. title(['mean p=',num2str(p1)])
  708. %no distances, just include all
  709. I=cell2mat(corrIPeakNoShuffleAll(idxI));
  710. NI=cell2mat(corrNIPeakNoShuffleAll(idxNI));
  711. M=[];
  712. M(1)=nanmean(I);
  713. M(2)=nanmean(NI);
  714. S=[];
  715. S(1)=nansem(I,2);
  716. S(2)=nansem(NI,2);
  717. subplot(224)
  718. bar([1 2],M)
  719. hold on
  720. errorbar([1 2],M,S,'.')
  721. names={'Iden'; 'Noniden' };
  722. set(gca,'xticklabel',names)
  723. [r,p1]=ttest2(I,NI);
  724. title(['Peak p=',num2str(p1)])
  725. saveas(gcf,'corrNCellNoShuffle_matchedDistance.fig')

ampAndCorr.m at commit 76eb11a, under Apache-2.0 · at the source

Overview

Authors: Garret Wang1,2, Farid Shahid1, Taylor J. Malone1, Jean Tyan1,3, Kyle Cekada1,4, Lujia Chen1, Yi Gu1
  1. Spatial Navigation and Memory Unit, National Institute of Neurological Disorders and Stroke, National Institutes of Health,Bethesda, MD USA
  2. Present Address: Medical Scientist Training Program, Medical College of Wisconsin,Milwaukee, WI USA
  3. Present Address: Division of Clinical Geriatrics, Center for Alzheimer Research, Department of Neurobiology, Care Sciences and Society, Karolinska Institutet,Stockholm, Sweden
  4. Present Address: Department of Psychological and Brain Sciences, University of California, Santa Barbara,Santa Barbara, CA USA
Journal: Nature communications, volume 17, issue 1, article 6164
Dates: received 9 December 2024; accepted 16 April 2026; published online 7 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1038/s41467-026-72453-1 · PMID 42098095 · PMCID PMC13365227 · OpenAlex W4408445668
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: mouse (organism)
Methods: Spectral & time-frequency, Statistics, Machine learning, Connectivity, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: Perception, Cognitive control
MeSH: Entorhinal Cortex*, Space Perception*, Animals, Cues, Grid Cells, Male, Mice, Mice, Inbred C57BL, Neurons (* major topic)
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 59 references in the paper

Abstract

Landmarks guide navigation by providing information through their location and identity. The medial entorhinal cortex (MEC) is well known for representing landmark location, but whether it also encodes landmark identity remains unclear. Here we show, using two-photon calcium imaging of MEC neurons in mice navigating multiple virtual environments, that a population of neurons known as cue cells encodes landmark identity. Cue cells respond selectively to individual landmarks and produce more distinct activity patterns for visually disparate landmarks than for identical ones. Identity encoding is modulated by the spatial shift of cue cell activity relative to landmark location and is context dependent, changing across environments, but remaining stable within the same environment despite repeated experience. In contrast, cue cells’ representation of landmark location changes with experience. Grid cells, another major MEC cell type, more strongly represent landmark location, but only weakly encode identity. These findings suggest that the MEC integrates both the location and identity of landmarks to support navigation.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above.

GuLab-NIH/Wang-and-Shahid-2026

License: Apache-2.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 76eb11afe5dd89df7dc8bb9506de4578bc35161a, 19 March 2026
Languages: MATLAB (22)
Size: 24 files, 22 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
24 files

Code availability

Custom code used for the analysis of data is available on GitHub [https://github.com/GuLab-NIH/Wang-and-Shahid-2026].

Reproduced under the paper's license (CC BY), from the paper cited above.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 22 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

Data generated in this study have been deposited in Zenodo [10.5281/zenodo.19115394]. Processed data underlying all figures are available in the Source Data file. Further information and requests for resources and reagents should be directed to the lead contact, Y.G. Source data are provided with this paper.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 7 authors, 2 keywords, 9 MeSH terms, 1 funder, 59 references.

Cite

This paper

Wang, G., Shahid, F., Malone, T. J., Tyan, J., Cekada, K., Chen, L., & Gu, Y. (2026). The entorhinal spatial map integrates visual identity information of landmarks. Nature communications, 17(1), 6164. https://doi.org/10.1038/s41467-026-72453-1

BibTeX

@article{wang2026entorhinal,
author = {Wang, Garret and Shahid, Farid and Malone, Taylor J. and Tyan, Jean and Cekada, Kyle and Chen, Lujia and Gu, Yi},
title = {{The entorhinal spatial map integrates visual identity information of landmarks}},
journal = {Nature communications},
year = {2026},
month = may,
volume = {17},
number = {1},
pages = {6164},
publisher = {Nature Portfolio},
issn = {2041-1723},
doi = {10.1038/s41467-026-72453-1},
url = {https://doi.org/10.1038/s41467-026-72453-1},
pmid = {42098095},
pmcid = {PMC13365227}
}

RIS

TY - JOUR
AU - Wang, Garret
AU - Shahid, Farid
AU - Malone, Taylor J.
AU - Tyan, Jean
AU - Cekada, Kyle
AU - Chen, Lujia
AU - Gu, Yi
TI - The entorhinal spatial map integrates visual identity information of landmarks
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/05/07
VL - 17
IS - 1
SP - 6164
SN - 2041-1723
PB - Nature Portfolio
DO - 10.1038/s41467-026-72453-1
UR - https://doi.org/10.1038/s41467-026-72453-1
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-72453-1",
"type": "article-journal",
"title": "The entorhinal spatial map integrates visual identity information of landmarks",
"container-title": "Nature communications",
"author": [
{
"family": "Wang",
"given": "Garret"
},
{
"family": "Shahid",
"given": "Farid"
},
{
"family": "Malone",
"given": "Taylor J."
},
{
"family": "Tyan",
"given": "Jean"
},
{
"family": "Cekada",
"given": "Kyle"
},
{
"family": "Chen",
"given": "Lujia"
},
{
"family": "Gu",
"given": "Yi"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "6164",
"DOI": "10.1038/s41467-026-72453-1",
"PMID": "42098095",
"PMCID": "PMC13365227",
"ISSN": "2041-1723",
"publisher": "Nature Portfolio",
"URL": "https://doi.org/10.1038/s41467-026-72453-1",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
7
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1016/j.celrep.2024.114813 [code]
The medial entorhinal cortex encodes multisensory spatial information.
Journal: Cell reports
In common: Violinplot-Matlab, Statistics and Machine Learning Toolbox, mouse, 27 references, author Yi Gu
[2] doi:10.1038/s41467-024-45853-4 [code]
A consistent map in the medial entorhinal cortex supports spatial memory.
Journal: Nature communications
In common: Statistics and Machine Learning Toolbox, mouse, 17 references, 2 authors
[3] doi:10.1038/s42003-025-08241-2
Object-translocation induces event coding in the rat hippocampus.
Journal: Communications biology
In common: 16 references
[4] doi:10.1038/s41593-026-02240-0 [code]
The dentate gyrus efficiently converges LEC and MEC inputs into multimodal, highly specific and reliable environmental representations.
Journal: Nature neuroscience
In common: Statistics and Machine Learning Toolbox, mouse, 15 references
[5] doi:10.1038/s41467-024-54932-5 [code]
Multiplexing of temporal and spatial information in the lateral entorhinal cortex.
Journal: Nature communications
In common: Statistics and Machine Learning Toolbox, 14 references
[6] doi:10.7554/elife.83008 [code]
Fan cells in lateral entorhinal cortex directly influence medial entorhinal cortex through synaptic connections in layer 1.
Journal: eLife
In common: mouse, 14 references
[7] doi:10.1038/s42003-023-04958-0
Rat hippocampal CA1 region represents learning-related action and reward events with shorter latency than the lateral entorhinal cortex.
Journal: Communications biology
In common: 12 references
[8] doi:10.1016/j.isci.2025.113960
Landmark vector cells in the absence of visual input.
Journal: iScience
In common: 11 references
[9] doi:10.1016/j.celrep.2024.114470 [code]
Retrosplenial inputs drive visual representations in the medial entorhinal cortex.
Journal: Cell reports
In common: Statistics and Machine Learning Toolbox, mouse, 10 references
[10] doi:10.1038/s41586-024-08034-3 [code]
One-shot entorhinal maps enable flexible navigation in novel environments.
Journal: Nature
In common: Statistics and Machine Learning Toolbox, mouse, 10 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-72453-1.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.