Dopamine dynamics as a regulatory mechanism for shifting between defensive and reward-seeking behaviors.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
MATLAB · 355 lines · 11 KB · no license
- function analyze_blink_1810
- % this function analyze blink in Iku/Will's rig
- % First, run 'detect_video_LED_1808_Iku' (this takes time)
- % Next, run 'videosync_every10_1808_Iku'
- % Also run 'detect_blink_1810' (this takes time)
- % c{1} = 'E:\2024-Hokudai\behavior\headfix\eachAnimal\IK149_biSNL\CCrp1';
- c{1} = 'E:\2024-Hokudai\behavior\headfix\eachAnimal\IK216_CrhAi9\CCrp2';
- % c{1} = 'E:\2024-Hokudai\behavior\headfix\eachAnimal\IK220_DA2m+tdT\CCrp5';
- % c{1} = 'E:\2024-Hokudai\behavior\headfix\eachAnimal\IK218_CrhAi9\CCrp1';
- % c{1} = 'D:\2024-Hokudai\behavior\headfix\eachAnimal\IK134_DA2m+tdT_VSDLSTS\CCrptest';
- % c{1} = 'E:\2023-Keio\behavior\headfix\eachAnimal\IK96_CRF+tdT_VS-TS-VTA-SNL\videos\CCrp3';
- % c{1} = 'E:\2023-Keio\behavior\headfix\eachAnimal\IK97_CRF+tdT_VS-TS-VTA-SNL\videos\CCrp5';
- cd(c{1});
- % foldername = dir('*-09-14_*');
- % cd(foldername.name);
- % read fiber photometry
- file = strcat('IK216_CCrp_250515');
- file_ID = fopen(file, 'r');
- CC_cart_analog = fread(file_ID, inf, 'double', 0, 'b');
- A = reshape(CC_cart_analog, 2, [ ]);
- % B = reshape (A, 2, 8, [ ]);
- B = reshape (A, 2, 10, [ ]);
- trial_type_sig = B (:,4,:);
- trial_type_sig = reshape (trial_type_sig,[],1);
- odor3 = B (:,8,:);
- odor3 = reshape (odor3,[],1);
- odor3_on = crossing(odor3,[],2); %threshold(mV)
- odor3_on_ts = (odor3_on(1:2:end)).';
- odor3_off_ts = (odor3_on(2:2:end)).';
- puff = B (:,10,:); %free water or puff
- puff = reshape (puff,[],1);
- puff_on = crossing(puff,[],2); %threshold(mV)
- puff_on_ts = (puff_on(1:2:end)).';
- puff_off_ts = (puff_on(2:2:end)).';
- odor2 = B (:,7,:);
- odor2 = reshape (odor2,[],1);
- odor2_on = crossing(odor2,[],2); %threshold(mV)
- odor2_on_ts = (odor2_on(1:2:end)).';
- odor2_off_ts = (odor2_on(2:2:end)).';
- odor4 = B (:,9,:);%bigstim
- odor4 = reshape (odor4,[],1);
- odor4_on = crossing(odor4,[],2); %threshold(mV)
- odor4_on_ts = (odor4_on(1:2:end)).';
- odor4_off_ts = (odor4_on(2:2:end)).';
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Find the start of each trial and type %%%%%%%%%%%%%%%%%%%%%%%%%%%%
- trial_type_sig_on = crossing(trial_type_sig,1:length(trial_type_sig),2.5);
- % trial_type_sig_off = (trial_type_sig_on(2:2:end)).';
- trial_type_sig_on = (trial_type_sig_on(1:2:end)).';
- trial_type_sig_on(:,2) = trial_type_sig_on(:,1);
- trial_type_sig_on(:,2) = 0;
- for i = 1:size(trial_type_sig_on,1)
- temp_B = 1;
- temp_A = trial_type_sig_on(i,1);
- for f = i+1:size(trial_type_sig_on,1)
- if trial_type_sig_on(f,1) < temp_A + 1000 %identify multiple signals within 1s
- temp_B = temp_B + 1;
- end
- end
- trial_type_sig_on(i,2) = temp_B; %number of signals within 1s after trial_type_sig_on(i,1)
- end
- % delete duplicates of the same trial
- for i = 1:size(trial_type_sig_on,1)
- temp_B = 1;
- temp_A = trial_type_sig_on(i,1);
- for f = i+1:size(trial_type_sig_on,1)
- if trial_type_sig_on(f,1) < temp_A + 1000
- trial_type_sig_on(f,:) = 0;
- end
- end
- end
- odor2_water_ts = [];odor2_omission_ts=[];odor3_ts = [];odor4_puff_ts = [];odor4_omission_ts = [];
- trial_type1 = find(trial_type_sig_on(:,2)==1);
- trial_type1_ts = trial_type_sig_on(trial_type1);
- for i = 1:length(trial_type1)
- odor2_water = find(odor2_on_ts > trial_type1_ts(i) & odor2_on_ts < trial_type1_ts(i)+1000);
- odor2_water_ts = [odor2_water_ts; odor2_on_ts(odor2_water)];
- end
- trial_type2 = find(trial_type_sig_on(:,2)==2);
- trial_type2_ts = trial_type_sig_on(trial_type2);
- for i = 1:length(trial_type2)
- odor2_omission = find(odor2_on_ts > trial_type2_ts(i) & odor2_on_ts < trial_type2_ts(i)+1000);
- odor2_omission_ts = [odor2_omission_ts; odor2_on_ts(odor2_omission)];
- end
- trial_type4 = find(trial_type_sig_on(:,2)==4);
- trial_type4_ts = trial_type_sig_on(trial_type4);
- for i = 1:length(trial_type4)
- odor4_puff = find(odor4_on_ts > trial_type4_ts(i) & odor4_on_ts < trial_type4_ts(i)+1000);
- odor4_puff_ts = [odor4_puff_ts; odor4_on_ts(odor4_puff)];
- end
- trial_type11 = find(trial_type_sig_on(:,2)==11);
- trial_type11_ts = trial_type_sig_on(trial_type11);
- for i = 1:length(trial_type11)
- odor4_omission = find(odor4_on_ts > trial_type11_ts(i) & odor4_on_ts < trial_type11_ts(i)+1000);
- odor4_omission_ts = [odor4_omission_ts; odor4_on_ts(odor4_omission)];
- end
- %% analyze eye area
- % calculate trigger frame
- % Trial type 1: odor2 water on
- % Trial type 2: odor2 water off
- % Trial type 3: odor3 water off
- % Trial type 4: odor4 puff on
- % Trial type 11: odor4 puff off
- load ('video_time') % 'video_t'
- frame_interval = median(diff(video_t)) %should be ~33.3 ms
- figure
- hist(diff(video_t))
- title('frame interval')
- xlabel('ms')
- puff_frame = [];
- for i = 1:length(puff_on_ts)
- if puff_on_ts(i)<video_t(end)
- puff_frame1 = find(video_t < puff_on_ts(i),1,'last');
- puff_frame = [puff_frame; puff_frame1];
- end
- end
- odor_frame = [];
- odor_ts = [odor2_on_ts;odor3_on_ts;odor4_on_ts];
- odor_ts = sort(odor_ts);
- for i = 1:length(odor_ts)
- if odor_ts(i)<video_t(end)
- odor_frame1 = find(video_t < odor_ts(i),1,'last');
- odor_frame = [odor_frame; odor_frame1];
- end
- end
- odor2_frame = [];
- for i = 1:length(odor2_on_ts)
- %for i = 1:length(odor2_water_ts)
- if odor2_on_ts(i)<video_t(end)
- %if odor2_water_ts(i)<video_t(end)
- odor2_frame1 = find(video_t < odor2_on_ts(i),1,'last');
- %odor2_frame1 = find(video_t < odor2_water_ts(i),1,'last');
- odor2_frame = [odor2_frame; odor2_frame1];
- end
- end
- odor3_frame = [];
- for i = 1:length(odor3_on_ts)
- if odor3_on_ts(i)<video_t(end)
- odor3_frame1 = find(video_t < odor3_on_ts(i),1,'last');
- odor3_frame = [odor3_frame; odor3_frame1];
- end
- end
- odor4_frame = [];
- for i = 1:length(odor4_on_ts)
- if odor4_on_ts(i)<video_t(end)
- odor4_frame1 = find(video_t < odor4_on_ts(i),1,'last');
- odor4_frame = [odor4_frame; odor4_frame1];
- end
- end
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% get average eye area using 2-1s before trials
- load ('eye') %'eye_Area','eye_Long','eye_Short'
- eye_Area = smooth(eye_Area,10);
- ts = odor_frame;
- %ind = find( ts-168>0,1,'first');
- ind = find( ts-60>0,1,'first');
- %ind2 = find( ts-84< length(eye_Area),1,'last');
- ind2 = find( ts-30< length(eye_Area),1,'last');
- ts = ts(ind:ind2);
- % plotind = bsxfun(@plus, repmat([-168:-84],length(ts),1),ts);
- plotind = bsxfun(@plus, repmat([-60:-30],length(ts),1),ts);
- baseline = eye_Area(plotind);
- F_each = mean(baseline,2);
- F_mean = mean(F_each);
- max_eyeArea = max(F_each); % can use this instead of average
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% average plot
- % trigger = {puff_frame};
- % trigger = {odor2_frame; odor3_frame; odor4_frame; puff_frame};%test
- trigger = {odor2_frame; odor3_frame; odor4_frame};%training
- % triggerP = {odor2_frame+168; odor3_frame+168; odor4_puff_frame};
- trigger_n = [length(odor2_frame),length(odor3_frame),length(odor4_frame)]
- scrsz = get(groot,'ScreenSize');
- figure('Position',[1 scrsz(4)/1.5 scrsz(3)/1.5 scrsz(4)/1.5])
- % plotColors = {'b','r','g', 'k'};%test
- plotColors = {'b','r','g'};%training
- plotdata = eye_Area;
- %plotWin = [-168:336]; %84 frame/second
- plotWin = [-60:180]; %30 frame/second
- %responseWin = [314:334]; %choose response time, 168 is trigger
- responseWin = [120:150]; %choose response time, 60 is trigger, 1to3sec, CS
- % responseWin = [150:210]; %choose response time, 60 is trigger, 3to5sec, US
- % legend_name = {'80%water','80%puff','nothing', 'freeP'};%test
- legend_name = {'100%water','100%puff','nothing'};%training
- % legend_name = {'bigStim','bigWater'};
- DeltaF = [];
- Tmark = [];
- Trial_number = [];
- response_all = [];
- Response = [];
- ste_Response = [];
- for i = 1:length(trigger)
- % ts = round(trigger{i});
- ts = trigger{i};
- if ~exist('triggerB');
- triggerB = trigger;
- end
- % tsB = round(triggerB{i});
- tsB = triggerB{i};
- ind = find( tsB+ plotWin(1)>0,1,'first');
- ind2 = find( ts+ plotWin(end)< length(plotdata),1,'last');
- ts = ts(ind:ind2);
- plotind = bsxfun(@plus, repmat(plotWin,length(ts),1),ts);
- rawTrace = plotdata(plotind);
- tsB = tsB(ind:ind2);
- plotind = bsxfun(@plus, repmat(plotWin,length(ts),1),tsB);
- rawTraceB = plotdata(plotind);
- %F = mean(rawTraceB(:,85:150),2);
- F = mean(rawTraceB(:,31:50),2);
- % deltaF = bsxfun(@minus,rawTrace,F)/2.5;
- deltaF = bsxfun(@minus,rawTrace,F);
- deltaF = deltaF/F_mean;
- %deltaF_F = bsxfun(@rdivide,rawTrace,F);
- m_plot = mean(deltaF);
- % m_plot = mean(deltaF(end-20:end,:));
- % m_plot = deltaF(6,:);
- s_plot = std(deltaF)/sqrt(length(ts));
- errorbar_patch(plotWin,m_plot,s_plot,plotColors{i});
- response = deltaF(:,responseWin);
- response = mean(response');
- response_all = [response_all,response];
- Response = [Response mean(response)]
- ste_Response = [ste_Response std(response)/sqrt(length(response))];
- if ~exist('triggerP')
- triggerP = triggerB;
- end
- tsP = round(triggerP{i});
- tsP = tsP(ind:ind2);
- DeltaF = [DeltaF;deltaF];
- Tmark = [Tmark;tsP-ts];
- Trial_number = [Trial_number size(deltaF,1)];
- end
- legend(legend_name)
- xlabel('time - event (s)')
- ylabel('fraction change of eye area')
- box off
- set(gca,'tickdir','out')
- set(gca,'TickLength',2*(get(gca,'TickLength')))
- set(gca,'FontSize',20)
- set(gcf,'color','w')
- h=gca;
- %h.XTick = -168:84:336;
- % h.XTick = -60:30:120;
- % h.XTickLabel = {-2:1:4};
- h.XTick = -60:30:180;
- h.XTickLabel = {-2:1:6};
- figure
- bar(Response)
- hold on
- errorbar(Response, ste_Response,'b.')
- hold on
- title('eye area')
- ylabel('responses (0-3s)')
- h=gca;
- h.XTickLabel = legend_name;
- %% raster plot
- scrsz = get(groot,'ScreenSize');
- figure('Position',[1 scrsz(4)/1.5 scrsz(3)/1.5 scrsz(4)/1.5])
- %1) bin the data
- trialNum = size(DeltaF,1); binSize = 6;%7
- binedF = squeeze(mean(reshape(DeltaF(:,1:(plotWin(end)-plotWin(1))),trialNum, binSize,[]),2));
- %imagesc(binedF,[-1 1]);
- % imagesc(binedF,[-0.5 0.5]);
- imagesc(binedF,[-1 1]);
- colormap yellowblue
- xlabel('time - event (s)');
- h=gca;
- %h.XTick = 0.5:84/binSize:5*84/binSize;
- h.XTick = 0.5:30/binSize:5*30/binSize;
- h.XTickLabel = {-2:6};
- hold on;
- % 2) plot the triggers
- for k = 1:trialNum
- % x = [(Tmark(k)-plotWin(1))/binSize (Tmark(k)-plotWin(1))/binSize]; % odor timing
- %x = [(Tmark(k)-plotWin(1)+168)/binSize+0.5 (Tmark(k)-plotWin(1)+168)/binSize+0.5]; %water timing
- % x = [(Tmark(k)-plotWin(1)+60)/binSize+0.5 (Tmark(k)-plotWin(1)+60)/binSize+0.5]; %water timing
- % y = [k-0.5 k+0.5];
- % plot(x,y,'r')
- end
- % x2 = [(-plotWin(1)+1000)/binSize (-plotWin(1)+1000)/binSize];%water
- x2 = [-plotWin(1)/binSize+0.5 -plotWin(1)/binSize+0.5]; % odor
- plot(x2,[0 trialNum+0.5],'c')
- % 3) divide triggers
- for j = 1:length(Trial_number)-1
- plot([0 (plotWin(end)-plotWin(1))/binSize],[sum(Trial_number(1:j))+0.5 sum(Trial_number(1:j))+0.5],'m','Linewidth',1)
- save_name = strcat('blink_aligned');
- save (save_name,'DeltaF','Trial_number')
- end
- end
analyze_blink_CC_2401.m at commit 4fabf57, no license · at the source
Overview
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above.
itk2219/TSdopamine_behavior_photometry_optogenetics
4fabf57fa2a15b3e63e52b9636f59fd77bea9e44, 6 September 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
3 files
- analyze_blink_CC_2401.m, MATLAB, 355 lines
- photometry_CCrp_2401.m, MATLAB, 676 lines
- photometry_water_2311.m, MATLAB, 638 lines
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: itk2219/
TSdopamine_behavior_phot ometry_optogenetics
Read it in the paper: doi.org/10.1038/s42003-026-10485-5.
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;
- 3 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.mendeley.com/
preview/ , at Mendeley Data; found in “Data availability”c548z4tmn9
Data availability statement
The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to a dataset: data.mendeley.com/
preview/ c548z4tmn9
Read it in the paper: doi.org/10.1038/s42003-026-10485-5.
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, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 2 keywords, 11 MeSH terms, 1 funder, 70 references.
Cite
This paper
Tsuruga, R., Tajika, Y., Minami, M., & Tsutsui-Kimura, I. (2026). Dopamine dynamics as a regulatory mechanism for shifting between defensive and reward-seeking behaviors. Communications biology, 9(1), 980. https://
BibTeX
@article{tsuruga2026dopa
author = {Tsuruga, Ryota and Tajika, Yu and Minami, Masabumi and Tsutsui-Kimura, Iku},
title = {{Dopamine dynamics as a regulatory mechanism for shifting between defensive and reward-seeking behaviors}},
journal = {Communications biology},
year = {2026},
month = jul,
volume = {9},
number = {1},
pages = {980},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/
url = {https://
pmid = {42498719},
pmcid = {PMC13400609}
}
RIS
TY - JOUR
AU - Tsuruga, Ryota
AU - Tajika, Yu
AU - Minami, Masabumi
AU - Tsutsui-Kimura, Iku
TI - Dopamine dynamics as a regulatory mechanism for shifting between defensive and reward-seeking behaviors
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 980
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Dopamine dynamics as a regulatory mechanism for shifting between defensive and reward-seeking behaviors",
"container-title": "Communications biology",
"author": [
{
"family": "Tsuruga",
"given": "Ryota"
},
{
"family": "Tajika",
"given": "Yu"
},
{
"family": "Minami",
"given": "Masabumi"
},
{
"family": "Tsutsui-Kimura",
"given": "Iku"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "980",
"DOI": "10.1038/
"PMID": "42498719",
"PMCID": "PMC13400609",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
24
]
]
}
}
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.1038/s41467-026-73994-1 [code]
- Prediction error correlates in the striosome-dopamine circuit emerge from information gain.Journal: Nature communicationsIn common: 13 references
- [2] doi:10.1016/j.isci.2026.117130 [code]
- Region-specific weighting of sensory intensity and reward prediction error by dopamine signals.Journal: iScienceIn common: 9 references
- [3] doi:10.1523/jneurosci.1762-25.2026 [code]
- Mesocorticostriatal Reinforcement Learning of State Representation and Value with Implications for the Mechanisms of Schizophrenia.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: 6 references
- [4] doi:10.1016/j.isci.2026.115789
- Noise-evoked dopamine dynamics in the nucleus accumbens and tail of the striatum.Journal: iScienceIn common: 5 references
- [5] doi:10.1126/sciadv.aeb5352 [code]
- Indirect pathway neurons in the tail of the striatum regulate inhibitory control over sensory driven behavior.Journal: Science advancesIn common: Signal Processing Toolbox, mouse, 3 references
- [6] doi:10.1038/s41467-026-75371-4 [code]
- Cerebellar neural populations orchestrate dopamine reward signaling with single-trial precision.Journal: Nature communicationsIn common: Signal Processing Toolbox, mouse, 3 references
- [7] doi:10.1073/pnas.2613593123 [code]
- Calbindin stratifies midbrain dopaminergic neurons governing distinct aspects of locomotion.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: mouse, 3 references
- [8] doi:10.1038/s41593-026-02253-9 [code]
- Genoarchitecture and input-output organization of the mouse basal ganglia and thalamic parafascicular nucleus.Journal: Nature neuroscienceIn common: mouse, 3 references
- [9] doi:10.1016/j.isci.2026.116484
- Molecular taxonomy and spatial organization define neuronal subtypes in the mouse inferior colliculus.Journal: iScienceIn common: mouse, 3 references
- [10] doi:10.1038/s41467-026-72167-4 [code]
- The superior colliculus gates dopamine responses to conditioned stimuli in visual classical conditioning.Journal: Nature communicationsIn common: mouse, 3 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 3 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:1690e25aa5f946a4…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
