|
66 | 66 |
|
67 | 67 | sortSweeps = {'magnitude','magnitude','magnitude','magnitude'}; |
68 | 68 |
|
69 | | -anteriorMRCs = IdAnalysis(ephysData,protList,anteriorDistCells,'num','matchType',matchType, ... |
| 69 | +[anteriorMRCs, antStim] = IdAnalysis(ephysData,protList,anteriorDistCells,'num','matchType',matchType, ... |
70 | 70 | 'tauType','thalfmax', 'sortSweepsBy', sortSweeps, 'integrateCurrent',1 , ... |
71 | 71 | 'recParameters', ephysMetaData,'sepByStimDistance',1); |
72 | 72 |
|
|
339 | 339 | xlswrite(fname,postNorm,'postNorm','A2'); |
340 | 340 |
|
341 | 341 |
|
342 | | -%% Plot representative traces for spatial figure |
| 342 | +%% Plot representative traces for spatial dynamics figure |
343 | 343 |
|
344 | 344 | % check distance and nReps for each recording |
345 | 345 | antDists = cell2mat(cellfun(@(x) mean(x(:,12:13)),anteriorMRCs(:,3),'un',0)); |
|
359 | 359 |
|
360 | 360 | plotfixer |
361 | 361 |
|
| 362 | +%% Separate and write representative traces for channel-sim-distance figure |
| 363 | + |
| 364 | +% anterior trace FAT 105 at 1, 5, 10um mean traces separated by on/off |
| 365 | +% stimulus, from [stimStart-250, stimEnd+250]ms. |
| 366 | +onStim = 751; |
| 367 | +offStim = 2251; |
| 368 | +sf = 5; %kHz |
| 369 | +boxTime = 150*sf; %ms |
| 370 | +tVec = (-150*sf:150*sf)'/sf/1000; %s |
| 371 | + |
| 372 | +reps(:,1:3) = anteriorMRCs{4,2}([2 5 9],onStim-boxTime:onStim+boxTime)'; |
| 373 | +reps(:,4:6) = anteriorMRCs{4,2}([2 5 9],offStim-boxTime:offStim+boxTime)'; |
| 374 | + |
362 | 375 |
|
363 | | -%% Old code |
364 | | - |
365 | | -% %% Pull out and combine relevant data for plotting single size |
366 | | -% |
367 | | -% % Voltage attenuation data comes from the length constant fitting done in |
368 | | -% % Igor, which gives a voltage attenuation factor at the location of the |
369 | | -% % stimulus site for each recording, based on the calculated length |
370 | | -% % constant. |
371 | | -% |
372 | | -% % Grab the current at the selected step size (e.g., 10um) for each |
373 | | -% % recording, grab the cell-stimulus distance for that recording, and match |
374 | | -% % the recording name against the voltage attenuation table to find the |
375 | | -% % attenuation factor for that recording. |
376 | | -% whichMRCs = anteriorMRCs; |
377 | | -% thisAtt = attenuationData(:,[2 8 10]); |
378 | | -% distCol = 12; |
379 | | -% peakCol = 6; % 6 for peak current, 11 for integrated current/charge |
380 | | -% distVPeak = []; |
381 | | -% stepSize = 10; |
382 | | -% |
383 | | -% for iCell = 1:size(whichMRCs,1) |
384 | | -% thisCell = whichMRCs{iCell,3}; |
385 | | -% whichStep = round(thisCell(:,1)) == stepSize; |
386 | | -% if any(whichStep) |
387 | | -% thisName = whichMRCs{iCell,1}; |
388 | | -% hasAtt = strcmp(thisName,thisAtt(:,1)); |
389 | | -% |
390 | | -% if any(hasAtt) && thisAtt{hasAtt,2} |
391 | | -% distVPeak(iCell,:) = [thisCell(whichStep,[distCol peakCol]) thisAtt{hasAtt,3}]; |
392 | | -% else |
393 | | -% distVPeak(iCell,:) = [thisCell(whichStep,[distCol peakCol]) nan]; |
394 | | -% end |
395 | | -% |
396 | | -% end |
397 | | -% |
398 | | -% end |
399 | | -% |
400 | | -% distVPeak_Ant = distVPeak; |
401 | | -% |
402 | | -% whichMRCs = posteriorMRCs; |
403 | | -% distVPeak = []; |
404 | | -% |
405 | | -% |
406 | | -% for iCell = 1:size(whichMRCs,1) |
407 | | -% thisCell = whichMRCs{iCell,3}; |
408 | | -% whichStep = round(thisCell(:,1)) == stepSize; |
409 | | -% if any(whichStep) |
410 | | -% thisName = whichMRCs{iCell,1}; |
411 | | -% hasAtt = strcmp(thisName,thisAtt(:,1)); |
412 | | -% |
413 | | -% if any(hasAtt) |
414 | | -% distVPeak(iCell,:) = [thisCell(whichStep,[distCol peakCol]) thisAtt{hasAtt,2}]; |
415 | | -% else |
416 | | -% distVPeak(iCell,:) = [thisCell(whichStep,[distCol peakCol]) nan]; |
417 | | -% end |
418 | | -% |
419 | | -% end |
420 | | -% |
421 | | -% end |
422 | | -% |
423 | | -% distVPeak_Post = distVPeak; |
424 | | -% |
425 | | -% clear a iCell thisCell whichMRCs whichStep thisName hasAtt distVPeak |
426 | | -% |
427 | | -% %% Make correction to I for space clamp error |
428 | | -% % (Note: this is an approximation, assuming that the majority of the |
429 | | -% % current is happening at the stimulus site, which we know is not entirely |
430 | | -% % true, and channels at different points along the neurite will experience |
431 | | -% % different voltages. |
432 | | -% |
433 | | -% % Now calculate what the actual voltage was at the stimulus site based on |
434 | | -% % the voltage attenuation factor. In this case, command voltage was -60mV |
435 | | -% % for all steps. |
436 | | -% |
437 | | -% % attenuation factor = Vm'/Vc so Vm' = Vc * attenuation factor |
438 | | -% |
439 | | -% % Then calculate what current would've been based on sodium reversal |
440 | | -% % potential. |
441 | | -% % For IC2 solution used here, Ena = +94mV. |
442 | | -% |
443 | | -% % Im' = Im * ((Vc-Ena)/(Vm'-Ena)) |
444 | | -% |
445 | | -% Vc = -0.06; %in V |
446 | | -% Ena = 0.094; % in V |
447 | | -% Im = distVPeak_Ant(:,2); |
448 | | -% Vatt = distVPeak_Ant(:,3); |
449 | | -% |
450 | | -% Vm = Vc * Vatt; |
451 | | -% distVPeak_Ant(:,4) = (Im * (Vc-Ena)) ./ (Vm-Ena); |
452 | | -% |
453 | | -% %% Plot anterior and posterior single size on separate plots |
454 | | -% |
455 | | -% figure(); axh(1) = subplot(2,1,1); |
456 | | -% scatter(distVPeak_Ant(:,1),distVPeak_Ant(:,4)); |
457 | | -% xlabel('Distance from cell body (um)'); |
458 | | -% ylabel(sprintf('Current @%dum (pA)',stepSize)) |
459 | | -% text(100,200,'Anterior'); |
460 | | -% axh(2) = subplot(2,1,2); |
461 | | -% scatter(distVPeak_Post(:,1),distVPeak_Post(:,2)); |
462 | | -% xlabel('Distance from cell body (um)'); |
463 | | -% ylabel(sprintf('Current @%dum (pA)',stepSize)) |
464 | | -% text(100,200,'Posterior'); |
465 | | -% |
466 | | -% for i = 1:length(axh) |
467 | | -% xlim(axh(i),[0 200]); |
468 | | -% ylim(axh(i),[0 200]); |
469 | | -% end |
470 | | -% |
471 | | -% %% Plot on one plot |
472 | | -% |
473 | | -% figure(); |
474 | | -% scatter(distVPeak_Ant(:,1),distVPeak_Ant(:,4)); |
475 | | -% hold on; |
476 | | -% scatter(-distVPeak_Post(:,1),distVPeak_Post(:,2)); |
477 | | -% text(distVPeak_Ant(:,1)+1,distVPeak_Ant(:,4)+1,anteriorMRCs(:,1)); |
478 | | -% text(-distVPeak_Post(:,1)+1,distVPeak_Post(:,2)+1,posteriorMRCs(:,1)); |
479 | | -% xlabel('Distance from cell body (um)'); |
480 | | -% ylabel(sprintf('Current @%dum (pA)',stepSize)) |
481 | | -% xlim([-100 200]);ylim([0 200]); |
482 | | -% vline(0,'k:'); |
483 | | -% |
484 | | -% |
0 commit comments