Neural sequences underlying directed turning in Caenorhabditis elegans.
The 5 matches
- [1] § Methods › Decoding postreversal turn direction from SAAV activity › Model architecture ↔ model.py, lines 7–37 · score 0.75 · GRUCell, layer normalization, dropout, hidden, sigmoid, linear
- [2] § Results › Neurons in the head-steering circuit encode sensory information and turning directions ↔ make_WB_struct.m, lines 79–158 · score 0.65 · octanol reversals, octanol encounters, Head curvature, velocity, NGM, counterparts
- [3] § Results › Neurons in the head-steering circuit encode sensory information and turning directions ↔ DecodingMain.ipynb, lines 45–79 · score 0.57 · scored activity, head swing, reversal end, decoding, SAAV, Dorsal
- [4] § Results › C. elegans directs the angles of its reorientations to improve its bearing during olfactory navigation ↔ make_WB_struct.m, lines 79–158 · score 0.56 · octanol encounter, head curvature, GCaMP, NGM, body, worms
- [5] § Methods › Decoding postreversal turn direction from SAAV activity ↔ DecodingMain.ipynb, lines 137–174 · score 0.53 · head swing, reversal endings, decoding, SAAV, dorsal, activity
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 · 158 lines · 7.8 KB · MIT · 2 matches
- %% Takes h5 files and neuron IDs generated by whole brain confocal recording and puts them in Matlab structure
- % Goal for this eventually is to get a data structure with behavior and
- % neuron trace info for each condition. This will then be used to analyze
- % their behavior. So first want to save data in a strucutre, then make
- % other scripts to analyze the output.
- clear
- conditionName = ['octanol'];
- h5FileNames =["2023-07-01-01-data.h5"...
- "2023-07-01-09-data.h5"...
- "2023-06-24-28-data.h5"...
- "2023-06-24-02-data.h5"...
- "2023-06-24-11-data.h5"...
- "2023-07-12-01-data.h5"...
- "2023-07-13-01-data.h5"...
- "2023-08-07-08-data.h5"...
- "2023-08-07-16-data.h5"...
- "2023-08-18-18-data.h5"...
- "2023-08-19-01-data.h5"...
- "2023-08-23-09-data.h5"...
- "2023-08-31-03-data.h5"...
- "2023-09-01-01-data.h5"...
- "2023-09-02-10-data.h5"...
- "2023-10-15-18-data.h5"...
- "2023-08-24-03-data.h5"...
- "2023-08-23-02-data.h5"...
- "2023-07-16-02-data.h5"...
- "2023-07-13-17-data.h5"...
- "2023-07-13-09-data.h5"...
- "2023-07-01-30-data.h5"...
- "2023-07-01-23-data.h5"...
- "2023-06-24-19-data.h5"...
- "2023-07-08-06-data.h5"...
- "2024-04-14-06-data.h5"...
- "2024-04-15-03-data.h5"...
- "2024-04-21-05-data.h5"...
- "2024-04-25-07-data.h5"...
- "2024-05-02-04-data.h5"...
- "2024-05-02-13-data.h5"...
- "2024-05-09-13-data.h5"...
- ];
- % list out all the h5 files you want to analyze need the h5 files and corresponding neuron IDs in the same directory /location, and it should be open
- % ---------- do not change below this line ------------%
- nFiles = length(h5FileNames);
- wbData = struct();
- for f = 1:nFiles % each row of chxData corresponds to a video file
- name = h5FileNames(f);
- wbData(f).Name = name; % save the name of the video
- wbData(f).velocity = h5read(name,'/behavior/velocity');
- wbData(f).reversal_vec = double(h5read(name,'/behavior/reversal_vec'));
- wbData(f).reversal_events = double(h5read(name,'/behavior/reversal_events'));
- wbData(f).head_angle = double(h5read(name,'/behavior/head_angle'));
- wbData(f).gcamp_trace = h5read(name, '/gcamp/trace_array');
- wbData(f).gcamp_Fmean = h5read(name, '/gcamp/traces_array_F_Fmean');
- wbData(f).worm_angle = double(h5read(name,'/behavior/worm_angle'));
- getName = erase(name,"data.h5");
- txtName = getName + 'neuron-id.txt';
- if isfile(txtName) == 1 % if we have cell IDs now
- neuronIDs = readcell(txtName); % get all neuroPal cell IDs into a cell
- wbData(f).gcamp_wIDs = cell(length(neuronIDs),2); % make an empty cell array to fill in
- wbData(f).gcamp_wIDs_Fmean = cell(length(neuronIDs),2); % repeat for F mean
- for g = 1:size(wbData(f).gcamp_trace,1)
- wbData(f).gcamp_wIDs{g,2} = wbData(f).gcamp_trace(g,:); % fill in cell 2 with neuron activity
- wbData(f).gcamp_wIDs_Fmean{g,2} = wbData(f).gcamp_Fmean(g,:); % same as for F mean
- end
- for n = 1:length(neuronIDs)
- rowIdx = neuronIDs{n,1};
- wbData(f).gcamp_wIDs{rowIdx,1} = neuronIDs{n,2}; % fill in cell 1 with neuron ID, when known
- % wbData(f).gcamp_wIDs_Fmean{rowIdx,1} = neuronIDs{n,2}; % fill in cell 1 with neuron ID, when known
- end
- end % if we don't have IDs yet. just proceed
- % get a variable that gives head curvature with + being dorsal and - as ventral
- flipped_datasets = append("2023-06-09-01 ","2023-06-09-10 ", "2023-06-24-28 ", "2023-07-01-01 ", ...
- "2023-07-07-18 ","2023-07-12-01 ","2023-07-28-04 ", "2023-08-07-08 ", "2023-06-24-11 ", "2023-08-22-08 ", ...
- "2023-08-25-02 ", "2023-09-01-01 ","2023-09-15-01 ", "2023-09-15-08 ","2023-08-19-01 ", "2023-09-02-10", ...
- "2023-08-24-03 ", "2023-08-23-02 ","2023-08-23-09 ", "2023-08-07-08 ", "2023-07-16-02 ", "2023-07-13-17 ", "2023-07-13-09 ", ...
- "2023-07-01-30 ", "2024-04-15-03 ", "2024-04-25-07 ", "2024-05-02-13 "); % datasets with theta_pos_is_ventral = true
- checkName = erase(name,"-data.h5");
- if contains(flipped_datasets, checkName) == 1 % if ventral is currently positive
- wbData(f).dv = -h5read(name,'/behavior/head_angle'); % make ventral negative
- else % if it's one already in the right order
- wbData(f).dv = h5read(name,'/behavior/head_angle');
- end
- octName = getName + 'octanol.xlsx';
- if isfile(octName) == 1 % if it's an octanol encounter video
- octEncounters = readmatrix(octName);
- wbData(f).octanol_events = octEncounters; % this is loops where it went on/off the octanol
- wbData(f).octanol_idx = zeros(1,size(wbData(f).velocity,1));
- for i = 1:size(octEncounters, 1)
- wbData(f).octanol_idx(octEncounters(i, 1):octEncounters(i, 2)) = 1; % this is a 0/1 matrix where 1 is on octanol
- end
- wbData(f).nonoctanol_reversal_events = [];
- wbData(f).octanol_reversal_events = [];
- for r = 1:length(wbData(f).reversal_events)
- is_oct = sum(wbData(f).octanol_idx(wbData(f).reversal_events(r,1):wbData(f).reversal_events(r,2)));
- if is_oct >= 1 % if the worm is on octanol for any part of this reversal
- wbData(f).octanol_reversal_events = [wbData(f).octanol_reversal_events; wbData(f).reversal_events(r,:)];
- elseif is_oct == 0 % if the worm is NOT on octanol for any part of this reversal
- wbData(f).nonoctanol_reversal_events = [wbData(f).nonoctanol_reversal_events; wbData(f).reversal_events(r,:)];
- end
- end
- wbData(f).avoid_events = []; % all reversals where the animal successfully avoids octanol
- for r = 1:length(wbData(f).reversal_events)
- if wbData(f).octanol_idx(wbData(f).reversal_events(r,1)) == 1 && wbData(f).octanol_idx(wbData(f).reversal_events(r,2)) == 0
- % if the worm starts the reversal on octanol and ends the reversal on NGM
- wbData(f).avoid_events = [wbData(f).avoid_events; wbData(f).reversal_events(r,:)];
- end
- end
- wbData(f).not_avoid_events = []; % all reversals where the animal revereses and stays on octanol
- for u = 1:length(wbData(f).reversal_events)
- if wbData(f).octanol_idx(wbData(f).reversal_events(u,1)) == 1 && wbData(f).octanol_idx(wbData(f).reversal_events(u,2)) == 1
- % if the worm starts the reversal on octanol and ends the reversal on octanol
- wbData(f).not_avoid_events = [wbData(f).not_avoid_events; wbData(f).reversal_events(u,:)];
- end
- end
- else % if it's not an octanol encounter
- wbData(f).octanol_idx = zeros(1,length(wbData(f).velocity));
- wbData(f).nonoctanol_reversal_events = wbData(f).reversal_events; % all reversals are non octanol reversals
- end
- % other things you can add here: /behavior /angular_velocity, body_angle,
- % body_angle_absoloute, body_angle_all, head_angle, pumping,
- % worm_curvature
- % /gcamp : idx_splits, match_org_to_skip, match_skip_to_org,
- % trace_array_original (not Z score), traces_array_F_F20,
- % traces_array_F_Fmean
- end
- % Save the WB data file (with a new name if it already exists)
- savename = strcat(conditionName,'.wbData.mat');
- counter = 1;
- while true
- if exist(savename,"file") % don't overwrite
- savename = strcat(conditionName,'_version',num2str(counter),'.wbData.mat');
- counter = counter+1;
- else
- try
- save(savename,'wbData')
- catch
- warning('Error saving as a v7 file, probably due to large size. Trying v7.3.')
- save(savename,'wbData','-v7.3')
- end
- break;
- end
- end
make_WB_struct.m, under MIT · at the source
Overview
- Howard Hughes Medical Institute, Picower Institute for Learning and Memory, Department of Brain & Cognitive Sciences, Massachusetts Institute of Technology, Cambridge, MA USA
- Department of Biology, Massachusetts Institute of Technology, Cambridge, MA USA
Abstract
Complex behaviors, such as navigation, rely on sequenced motor outputs that combine to generate effective movement. The brain-wide organization of the circuits that integrate sensory signals to select appropriate motor sequences remains poorly understood. Here we characterize the architecture of neural circuits that control Caenorhabditis elegans olfactory navigation. We identify error-correcting turns during navigation and use whole-brain calcium imaging and cell-specific perturbations to determine their neural underpinnings. These turns occur as motor sequences accompanied by neural sequences, in which defined neurons activate in a stereotyped order during each turn. Distinct neurons in this sequence respond to the spatial distribution of attractive and aversive olfactory cues, anticipate upcoming turn directions and drive movement, linking key features of this sensorimotor behavior across time. The neuromodulator tyramine coordinates these sequential brain dynamics. Our results illustrate how neuromodulation can act on a defined neural architecture to link sensory cues to motor actions.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 5 matches between paragraphs and lines of code.
flavell-lab/SAAV_Decoding
c7e7e18a84cde5dc02df9d63492293b38402eb2c, 24 February 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
8 files
- DecodingMain.ipynb, Jupyter, 572 lines, 2 matches
- kfold.py, Python, 48 lines
- load_data.py, Python, 28 lines
- model.py, Python, 37 lines, 1 match
- train.py, Python, 144 lines
- util.py, Python, 67 lines
- LICENSE, License, 674 lines
- README.md, Text, 15 lines
flavell-lab/preprocess_videos
d4eaa181c1a4feafd3e40bce1c032f8b2fcab945, 24 February 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
8 files
- fileio.py, Python, 51 lines
- main.py, Python, 206 lines
- noise.py, Python, 84 lines
- process.py, Python, 62 lines
- submit_multiple.sh, Shell, 197 lines
- utils.py, Python, 31 lines
- LICENSE, License, 674 lines
- README.md, Text, 115 lines
flavell-lab/head_detector_unet2d
a91b162f1fd97ed0e5e33da0b66e137b8036d301, 24 February 2026Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
25 files
- notebooks/
prepare_data/ , Jupyter, 593 linesCropNet_2D.ipynb - notebooks/
prepare_data/ , Jupyter, 386 linesgenerate_postCropNet_dat a_from_imageClick.ipynb - notebooks/
prepare_data/ , Jupyter, 219 linesgenerate_postCropNet_imm obilized_data_from_data_ dict.ipynb - notebooks/
prepare_data/ , Jupyter, 674 linesgenerate_preCropNet_data _from_data_dict.ipynb - notebooks/
prepare_data/ , Jupyter, 417 linesgenerate_preCropNet_immo bilized_data_from_data_d ict.ipynb - notebooks/
prepare_data/ , Jupyter, 49 linessave_as_pngs.ipynb - notebooks/
src_alternative/ , Jupyter, 374 linestrain_val_test_unet.ipyn b - src/
config.py , Python, 47 lines - src/
data_loader.py , Python, 247 lines - src/
inference.py , Python, 148 lines - src/
model.py , Python, 34 lines - src/
plot_training_curves.py , Python, 73 lines - src/
train.py , Python, 51 lines - unet2d/
setup.py , Python, 12 lines - unet2d/
unet2d/ , Python, 3 lines__init__.py - unet2d/
unet2d/ , Python, 126 linesdata.py - unet2d/
unet2d/ , Python, 3 linesmodel/ __init__.py - unet2d/
unet2d/ , Python, 48 linesmodel/ losses.py - unet2d/
unet2d/ , Python, 112 linesmodel/ metrics.py - unet2d/
unet2d/ , Python, 35 linesmodel/ unet_model.py - unet2d/
unet2d/ , Python, 74 linesmodel/ unet_part.py - unet2d/
unet2d/ , Python, 232 linestrain.py - unet2d/
unet2d/ , Python, 9 linesutils.py - LICENSE, License, 674 lines
- README.md, Text, 102 lines
Zenodo 12611760
Availability: 1 check, the latest on 29 September 2026: the link answers (HTTP 200)
- 29 September 2026: the link answers (HTTP 200)
2 files
- make_WB_struct.m, MATLAB, 158 lines, 2 matches
- save_chemotaxis_data.m, MATLAB, 150 lines
Code availability
Original code used to decode upcoming D/
The Python code used for post hoc binning of pixel intensities is available on GitHub: https://
The code for retraining and evaluation of the ANTSUN model performance is available on GitHub: https://
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:
- 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 37 scripts, each with its path and the digest of its content;
- 5 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- 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
- doi:10.5061/
dryad.8sf7m0cz2 , at Dryad; found in “Data availability”
Data availability
All brain-wide imaging data from this study is available at the following Dryad link: 10.5061/
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, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 11 authors, 2 keywords, 8 MeSH terms, 6 funders, 71 references.
Cite
This paper
Kramer, T. S., Wan, F. K., Pugliese, S. M., Atanas, A. A., Pradhan, S., Hiser, A. W., Godinez, L. M., Luo, J., Bueno, E., Felt, T., & Flavell, S. W. (2026). Neural sequences underlying directed turning in Caenorhabditis elegans. Nature neuroscience, 29(6), 1408-1424. https://
BibTeX
@article{kramer2026neura
author = {Kramer, Talya S and Wan, Flossie K and Pugliese, Sarah M and Atanas, Adam A and Pradhan, Sreeparna and Hiser, Alex W and Godinez, Lillie M and Luo, Jinyue and Bueno, Eric and Felt, Thomas and Flavell, Steven W},
title = {{Neural sequences underlying directed turning in Caenorhabditis elegans}},
journal = {Nature neuroscience},
year = {2026},
month = apr,
volume = {29},
number = {6},
pages = {1408--1424},
publisher = {Nature Portfolio},
issn = {1097-6256},
doi = {10.1038/
url = {https://
pmid = {41963559},
pmcid = {PMC13246447}
}
RIS
TY - JOUR
AU - Kramer, Talya S
AU - Wan, Flossie K
AU - Pugliese, Sarah M
AU - Atanas, Adam A
AU - Pradhan, Sreeparna
AU - Hiser, Alex W
AU - Godinez, Lillie M
AU - Luo, Jinyue
AU - Bueno, Eric
AU - Felt, Thomas
AU - Flavell, Steven W
TI - Neural sequences underlying directed turning in Caenorhabditis elegans
T2 - Nature neuroscience
J2 - Nat Neurosci
PY - 2026
DA - 2026/
VL - 29
IS - 6
SP - 1408
EP - 1424
SN - 1097-6256
PB - Nature Portfolio
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Neural sequences underlying directed turning in Caenorhabditis elegans",
"container-title": "Nature neuroscience",
"author": [
{
"family": "Kramer",
"given": "Talya S"
},
{
"family": "Wan",
"given": "Flossie K"
},
{
"family": "Pugliese",
"given": "Sarah M"
},
{
"family": "Atanas",
"given": "Adam A"
},
{
"family": "Pradhan",
"given": "Sreeparna"
},
{
"family": "Hiser",
"given": "Alex W"
},
{
"family": "Godinez",
"given": "Lillie M"
},
{
"family": "Luo",
"given": "Jinyue"
},
{
"family": "Bueno",
"given": "Eric"
},
{
"family": "Felt",
"given": "Thomas"
},
{
"family": "Flavell",
"given": "Steven W"
}
],
"container-title-short":
"volume": "29",
"issue": "6",
"page": "1408-1424",
"DOI": "10.1038/
"PMID": "41963559",
"PMCID": "PMC13246447",
"ISSN": "1097-6256",
"publisher": "Nature Portfolio",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
10
]
]
}
}
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/s41586-026-10348-3 [code]
- An enteric neuron ionotropic receptor regulates salt stress resistance.Journal: NatureIn common: h5py, Pillow, PyTorch, 4 other tools, C. elegans, 7 references
- [2] doi:10.1038/s41467-026-72710-3 [code]
- A modular multi-color fluorescence microscope for simultaneous tracking of cellular activity and behavior.Journal: Nature communicationsIn common: tifffile, Pillow, pandas, 3 other tools, C. elegans, 7 references
- [3] doi:10.7554/elife.108675 [code]
- SynaptoTagMe, a toolkit for in vivo mapping and modulating neurotransmission at single-cell resolution.Journal: eLifeIn common: C. elegans, 11 references
- [4] doi:10.1371/journal.pcbi.1014152 [code]
- Synchronization properties in C. elegans: Relating behavioral circuits to structural and functional neuronal connectivity.Journal: PLoS computational biologyIn common: pandas, SciPy, Matplotlib, 1 other tool, C. elegans, 9 references
- [5] doi:10.1038/s41598-026-54384-5
- Optimization of connectome weights for a neural network model generating both forward and backward locomotion in C. elegans.Journal: Scientific reportsIn common: C. elegans, 10 references
- [6] doi:10.3389/fnsys.2026.1822122 [code]
- Convergence-divergence circuits for multimodal integration of innate and learned opponent valences.Journal: Frontiers in systems neuroscienceIn common: tifffile, h5py, Pillow, 6 other tools, systems, 4 references
- [7] doi:10.1038/s41467-026-72709-w [code]
- An epifluorescence microscope design for naturalistic behavior and cellular activity in freely moving Caenorhabditis elegans.Journal: Nature communicationsIn common: tifffile, h5py, Pillow, 6 other tools, C. elegans, 3 references
- [8] doi:10.1038/s41586-026-10735-w [code]
- Distributed control circuits across a brain-and-cord connectome.Journal: NatureIn common: PyTorch, seaborn, pandas, 3 other tools, 7 references
- [9] doi:10.7554/elife.102309 [code]
- Dimorphic neural network architecture prioritizes sexual-related behaviors in male &
lt;i& gt;Caenorhabditis elegans& lt;/ i& gt;. Journal: eLifeIn common: C. elegans, systems, 7 references - [10] doi:10.1098/rstb.2024.0461 [code]
- Shallow recurrent decoders for neural and behavioural dynamics.Journal: Philosophical transactions of the Royal Society of London. Series B, Biological sciencesIn common: h5py, Pillow, PyTorch, 4 other tools, C. elegans, 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: 4 repositories of the authors' code, each at its verified commit and with its license, 37 scripts, and 5 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:bb4267a59fd5eed1…
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.
