C. elegans displays distinct locomotion in identical environments after exploring different surrounding areas.

(A) Schematic of two microfluidic chamber designs: uniform and binary. Both chambers contain an identical assay area (red dashed-line boxes) where locomotion was analyzed, while the surrounding exploration zones differ in PDMS pillar arrangement. (B-E) Quantification of locomotion in the assay area after 1 hour of exploration. Data from binary chambers (n = 21) are shown in orange and from uniform (n = 21) chambers in blue. Shown are (B) locomotion speed, (C) percentage of time spent idle, (D) reversal frequency, and (E) turning frequency. Statistical significance was determined using an unpaired Student’s t-test (***p < 0.001, *p < 0.05). Mean ± SEM; each point represents the mean behavioral value of all worms within one chamber. (F) Percent change in each locomotion metric (speed, idle time, reversal frequency, and turning frequency), calculated from panels B-E and normalized to the mean value in binary chambers. Mean ± SEM; each point represents the mean behavioral value of all worms within one chamber.

Guanylate cyclase gene gcy-18 functions in AFD to mediate context-dependent locomotion modulation.

(A) Difference in locomotion speed (Δspeed) between uniform and binary chambers of wild type N2 (uniform: n = 19; binary: n = 20), gcy-18(gk423024) mutant (uniform: n = 20; binary: n = 28), and gcy-18(nj38) mutant (uniform: n = 27, binary: n = 27). ΔSpeed was calculated as the percent change in locomotion speed in uniform chambers, relative to the mean speed measured in binary chambers (see Methods). Mutant worms lacking gcy-18 failed to demonstrate context-dependent locomotion adjustments in locomotion speed, as indicated by a low Δspeed value. (B) Δspeed of wild type, gcy-18 mutants, and gcy-18 mutant worms carrying a single-copy transgene expressing gcy-18 under the control of the gcy-18 promoter. Expression of gcy-18p::gcy-18 restored Δspeed (uniform: n= 26; binary: n = 24). (C) Locomotion speed adjustment of N2, gcy-18 mutants, and gcy-8 mutant worms (uniform: n = 20, binary: n = 18). Disruption of gcy-8 does not impair context-dependent locomotion modulation. (D) Schematic illustrating the distinct roles of guanylate cyclase genes in AFD sensory neurons: gcy-8 is required for thermosensation but not for context-dependent locomotion modulation, whereas gcy-18 is essential for context-dependent locomotion modulation and plays only a modest role in thermosensation. Data are presented as mean ± SEM. Each data point represents the mean behavior of worms within a single chamber. Asterisks above bars indicate statistical significance compared to wild type, whereas asterisks above horizontal black lines indicate statistical significance between mutant strains. Statistical significance was determined using one-way ANOVA followed by a Tukey-Kramer post hoc test (n.s.: p > 0.05; *: p < 0.05; **: p < 0.01).

Cyclic nucleotide-gated (CNG) channel subunits TAX-2 and CNG-3 are required for locomotion modulation, but TAX-4 is not.

(A) Schematic representation of CNG channel function. CNG channels are activated by cyclic nucleotides (such as cGMP) and mediate Ca²⁺ influx, thereby influencing neuronal activity and animal behavior. (B) Locomotion speed (µm/s) of N2 (uniform: n = 30; binary: n = 29), tax-2 (uniform: n = 27; binary: n = 22), and tax-4 (uniform: n = 21; binary: n = 21) mutant worms in binary (orange) and uniform (blue) chambers. The tax-2 mutants exhibit identical locomotion rates in both chamber types, whereas worms lacking tax-4 display accelerated basal locomotion while still preserving context-dependent locomotion modulation. Asterisks above blue bars indicate statistically significant differences in locomotion speed between uniform and binary chambers (unpaired Student’s t-test). Asterisks above horizontal black lines indicate statistically significant differences in basal speed, defined as speed of worms in the binary chamber, between N2 and tax-4 mutants (one-way ANOVA followed by a Tukey-Kramer post hoc test; n.s.: p > 0.05; ***: p < 0.001). (C) Speed differences (Δspeed) for N2, tax-2 mutant, and tax-4 mutant worms. The tax-2 mutants failed to modulate locomotion rates in a context-dependent manner, whereas tax-4 mutations enhanced modulation. (D) Assessment of cng-2 (uniform: n = 24; binary: n = 22), cng-3 (uniform: n = 29; binary: n = 28), and cng-4 (uniform: n = 24; binary: n = 29) roles in locomotion adjustments. The cng-3 mutation abolishes locomotion modulation. (E) Single-copy transgenes expressing cng-3 cDNA under two AFD-specific promoters, srtx-1bp (uniform: n = 26; binary: n = 22) and gcy-18p (uniform: n = 26; binary: n = 25), restore context-dependent locomotion adjustments. Data are presented as mean ± SEM. Each data point represents the mean behavior of worms within a single chamber. Asterisks denote statistical significance versus wild type (above bars) or between mutant strains (above horizontal black lines). Δspeed comparisons across strains (panels C-E) were determined using one-way ANOVA followed by Tukey-Kramer post hoc tests (*: p < 0.05; **: p < 0.01, and ***: p < 0.001).

AFD, but not its sensory endings, is required for context-dependent locomotion modulation.

(A) Schematic representation of AFD function in temperature sensing and locomotion modulation. AFD sensory endings are essential for thermosensation but dispensable for context-dependent locomotion modulation. (B) Locomotion speed (μm/s) of wild type N2 (uniform: n = 22; binary: n = 22) and kcc-3 (uniform: n = 27; binary: n = 27) mutant worms in the binary (orange) and uniform (blue) chambers. The kcc-3 mutants preserve context-dependent locomotion modulation while exhibiting increased basal locomotion rates. Asterisks above blue bars indicate significant differences between uniform and binary chambers (unpaired Student’s t-test). Basal speed differences in the binary chambers were determined using one-way ANOVA followed by a Tukey–Kramer post hoc tests (***: p < 0.001). (C) Δspeed of N2 and kcc-3 mutant worms, and (D) Δspeed of N2 (uniform: n = 22; binary: n = 22) and ttx-1 (uniform: n = 27; binary: n = 27)mutant worms. Context-dependent locomotion modulation remains in kcc-3 and ttx-1 mutant worms, although they abolish the AFD thermosensory function. (E) Ablation of AFD eliminates the context-dependent modulation of speed, idle time, and turning frequency (uniform: n = 34; binary: n = 36). Data are presented as mean ± SEM. Each data point represents the mean behavior of worms within a single chamber. Asterisks indicate statistical significance compared to wild type. Δspeed across strains (panels C-E) was analyzed by one-way ANOVA followed by Tukey-Kramer post hoc tests (n.s.: p > 0.05, and ***: p < 0.001).

Context-dependent locomotion adjustments require the mechanosensory channel subunit MEC-10 and the interneuron AIB.

(A) Δspeed of wild type (uniform: n = 26; binary n = 22), mec-10 mutants (uniform: n = 30; binary n = 21), and mec-10 mutants expressing mec-10 cDNA under cell-specific promoters: mec-18p (TRNs; uniform: n = 29; binary n = 25), egl-44p (FLP; uniform: n = 27; binary n = 34), or mec-10p (TRNs, FLP, and PVD; uniform: n = 32; binary n = 26). (B) Δspeed of wild type and AIB-ablated worms (uniform: n = 30; binary n = 30). AIB ablation abolishes speed modulation. Data are shown as mean ± SEM; each data point represents the average speed of worms in a single chamber. Asterisks indicate statistical significance compared to wild type (one-way ANOVA followed by Tukey-Kramer post hoc tests; ***p < 0.001). (C) Schematic illustrating a circuit framework connecting mec-10 expressing neurons, AIB, and AFD in tactile-dependent modulation of locomotion.

Tactile-dependent locomotion modulation is disrupted in mutant worms lacking gap junction genes and is restored by engineered Cx36 electrical synapses linking AFD and AIB.

(A) Speed differences (Δspeed) for wild type worms (uniform: n = 23; binary: n = 25) and inx-1 (uniform: n = 24,; binary: n = 24), inx-4 (uniform: n = 27; binary: n = 26), inx-7 (uniform: n = 29; binary: n= 30), inx-10 (uniform: n = 30; binary: n = 29), inx-19 (uniform: n = 23; binary: n = 24) mutants. (B) Speed differences for inx-7; inx-10 double mutants (uniform: n = 25; binary: n = 27). (C) Schematic illustrating engineered electrical synapses formed by Cx36 when expressed in adjacent neurons. (D) AFD-specific expression of inx-10 cDNA restored tactile-dependent locomotion modulation in inx-10 mutant worms (srtx-1bp; uniform: n = 23; binary: n = 24). Expression of Cx36 in both AFD (srtx-1bp) and AIB (inx-1p) similarly restored modulation in inx-7; inx-10 double mutants (uniform: n = 30; binary: n = 28). Data are presented as mean ± SEM. Asterisks denote statistical significance versus wild type (above bars) or between indicated genotypes (above horizontal black lines). Each data point represents the mean behavior of worms within a single chamber. Statistical significance was determined using one-way ANOVA followed by Tukey-Kramer post hoc tests (*: p < 0.05; **: p < 0.01, and ***: p < 0.001).

Prior exploration of distinct physical settings modulates locomotion speed of worms in identical environments.

(A) Schematic of the chamber design with separate exploration and assay zones divided by a removable barrier. The assay zone was identical across conditions, whereas the exploration zone contained physical settings that were either matching or non-matching relative to the assay zone. Worms explored these settings before entering the assay zone, where they were confined by insertion of a barrier. (B) Quantification of locomotion speed for wild type N2 worms in the assay area was performed either immediately after inserting the barrier or 40 minutes later (matching: n = 25; non-matching: n = 28). Asterisks indicate statistically significant difference between matching and non-matching chambers (unpaired Student’s t-test; *: p <0.05; **: p < 0.01). (C) The percent change in locomotion speed (Δspeed) between worms that had explored matching and non-matching chambers was calculated and normalized to the mean value of the non-matching condition. Data are presented as mean ± SEM, with each point representing the mean value of worms within a single chamber.

Guanylyl cyclase genes gcy-18 and gcy-12 are required for spatial preference, but only gcy-18 supports context-dependent locomotion modulation.

(A) A small-scale screen of guanylyl cyclase genes required for spatial preference in microfluidic chambers. Preference index values were calculated as previously described [52]. Wild type worms exhibited a strong preference for area IV, the preferred region of the chamber [52], whereas gcy-18(gk423024) and gcy-12(gk142661) mutants showed significantly reduced preference. Data are shown as mean ± SEM; each point represents the mean value from one chamber. Statistical comparisons were performed using Dunnett’s test for multiple comparisons (** p < 0.01). (B) Speed differences (Δspeed) between uniform and binary chambers in wild type N2 and gcy-12 mutant worms. gcy-12 mutants displayed context-dependent locomotion modulation comparable to wild type. Data are shown as mean ± SEM; each point represents the mean behavior of worms within a single chamber. Statistical significance was determined using an unpaired Student’s t-test (n.s., p > 0.05).

Temperature shifts alter absolute locomotion speed but do not affect context-dependent locomotion modulation.

(A) Experimental design. Worms were cultivated at 17°C, 20°C, or 23°C and then transferred to 20°C for 1 hour before behavioral recording. (B) Locomotion speed of wild type N2 worms in the binary (left) and uniform (right) chambers after experiencing temperature shifts (+3°C: uniform n = 32; binary n = 31; 0°C: uniform n = 30; binary n = 29; -3°C: uniform n = 36; binary n = 35). Linear regression identified a significant positive correlation between rearing temperature and locomotion speed in both chambers. (C) Differences in speed (Δspeed) across temperature-shift conditions. Linear regression analysis revealed no significant relationship between Δspeed and temperature shift. Data are shown as mean ± SEM.

GCY-18 primarily localizes to AFD dendritic endings and remains detectable in kcc-3 and ttx-1 mutants.

GCY-18 was visualized using a split-GFP strategy (GCY-18::GFP11x7 complemented by GFP1-10). (A-C) Representative images of the head region of wild type (A), kcc-3 mutant (B), and ttx-1 mutant (C) worms. Left panels show brightfield images overlaid with GFP fluorescence. Middle panels (A′-C′) show GFP fluorescence alone. Right panels show higher-magnification views of the distal dendritic ending (nose region; A’’-C’’) and regions near the AFD soma and axon (A’’’-C’’’). Dashed boxes in the middle panels indicate the approximate regions shown at higher magnification in the right panels.

(A) AFD-ablated and gcy-18 mutant worms that experienced different exploration zones show impaired locomotion speed adjustment when confined to the assay zone by a removable barrier. Δspeed values for wild type N2 (matching: n = 25; non-matching: n = 28), gcy-18 mutants (matching: n = 22; non-matching: n = 17), and AFD-ablated worms (matching: n = 26; non-matching: n = 26). Data are presented as mean ± SEM, with each point representing the mean locomotion speed value of worms within a single chamber. (B) Locomotion rates of wild type (n = 15), gcy-18 mutants (n = 10), and AFD-ablated worms (n = 18) are comparable on NGM plates. (C) Body lengths of wild type, gcy-18 mutant, and AFD-ablated worms are not significantly different. Data are shown as Mean ± SEM, with each point representing an individual animal (Dunnett’s test, *p < 0.05; n.s., p > 0.05).

Strains used in this study

Plasmids used to generate transgenic strains in this study