Animals make foraging decisions at the boundaries of bacterial food lawns.

(A) Image of C. elegans on a small lawn of bacteria. Head is indicated with a green dot, Lawn Boundary is indicated with a white line. Scale bar is 1 mm.

(B) Schematic depicting Lawn Boundary Distance measured as the distance from the head to the closest point on the lawn boundary.

(C) Empirical distribution of Lawn Boundary Distance in wild type datasets. Positive values indicate distances inside the lawn, negative values indicate distances outside the lawn.

(D-G) Four example images from behavioral sequences generating different types of foraging decisions. Scale bar is 0.5 mm in all panels. Head is indicated with a green dot in all panels. In E-G, yellow X indicates the maximum displacement of the head outside the lawn during head pokes. (D) Lawn leaving occurs when an animal approaches lawn boundary and fully crosses through it to explore the bacteria-free agar outside the lawn. Yellow X indicates the first position on the lawn boundary encountered by worm’s head before exiting the lawn. (E) Head Poke Forward occurs when animal continues forward movement on the lawn during and after poking its head outside the lawn. (F) Head Poke Pause occurs when animal pauses following head poke before resuming forward movement on the lawn. (G) Head Poke Reversal is generated by a reversal following head poke before resuming forward movement on the lawn.

(H) Number of lawn leaving events per animal in 40 minute assay. Bubble sizes are proportional to the percentage of animals that execute each number of lawn leaving events within a 40 minute assay.

(I) Frequency of different foraging decisions.

(J) Midbody speed aligned to different foraging decision types. Wild type dataset (C,H,I,J): n = 1586 animals.

Violin plots in (I) show median and interquartile range. In all time-averages, dark line represents the mean and shaded region represents the standard error.

See Supplementary Table 1.

Lawn leaving is associated with high arousal states on multiple timescales.

(A) Midbody forward speed aligned to lawn leaving. Left, heatmap of individual speed traces. Right, mean midbody forward speed computed across the heatmap traces. White space indicates missing data or times when animal was off the lawn.

(B) Overlap of lawn leaving events with roaming and dwelling. Left, percentage of leaving events found in each state. Right, percentage of time bins roaming or dwelling that contain a leaving event.

(C) Roaming and dwelling aligned to lawn leaving. Left, heatmap of roaming/dwelling state classifications aligned to lawn leaving event. Center, fraction of animals in roaming or dwelling state prior to leaving. Right, total fraction of time spent roaming and dwelling in all assays that included a lawn-leaving event (n=371). Median is highlighted and interquartile range is indicated by shaded area.

(D) Roaming speed aligned to lawn leaving. Left, heatmap showing speed of roaming animals before lawn leaving. Right, mean roaming speed computed at times when less than 10% of aligned traces had missing data. White space indicates times when animals were not roaming before leaving.

(E) Overlap of lawn leaving events with AR-HMM states. Left, percentage of leaving events found in each state. Right, percentage of time bins per AR-HMM state that contain a leaving event.

(F) AR-HMM states aligned to lawn leaving. Left, heatmap of AR-HMM state classifications. Center, fraction of animals in each state prior to leaving. Right, total fraction of time spent in each AR-HMM state in all assays that included a lawn-leaving event (n=371). Median is highlighted and interquartile range is indicated by shaded area.

(G) State 3 speed aligned to lawn leaving. Left, heatmap showing speed of animals in state 3 before lawn leaving. Right, mean state 3 speed computed at times when less than 10% of aligned traces had missing data. White space indicates times when animals were not in state 3 before leaving.

See Supplementary Table 2.

Food intake regulates arousal states and lawn leaving.

(A-B) Increasing bacterial density suppresses roaming and leaving.

(A) Fraction of time roaming on small lawns seeded with bacteria of different optical density (OD). OD1: n = 45, OD2: n = 46, OD4: n = 47, Statistics by One way ANOVA with Tukey’s post-hoc test on logit-transformed data.

(B) Number of lawn leaving events per animal in the same assays as (A). Statistics by Kruskal-Wallis test with Dunn’s multiple comparisons test.

(C-D) Animals on inedible food roam and leave lawns more than animals on edible food.

(C) Fraction of time roaming on inedible bacteria generated by adding aztreonam dissolved in DMSO to E. coli growing on plates. +DMSO/+aztreonam n = 64, +DMSO (control) n = 66, Statistics by Student’s t-test performed on logit-transformed data.

(D) Number of lawn leaving events in the same assays as (C). Statistics by Mann-Whitney U-test.

(E-J) Optogenetic feeding inhibition stimulates roaming and lawn leaving.

(E) Heatmap showing roaming and dwelling for animals before, during, and after 10-minute optogenetic feeding inhibition. Data for animals pre-treated with all-trans retinal (+ATR) is shown.

(F) Fraction of animals roaming before, during, and after optogenetic feeding inhibition. Light ON period denoted by yellow shading (+ATR n = 36). Control animals not pre-treated with all-trans retinal (-ATR n = 32). Statistics by Student’s t-test comparing +/-ATR data averaged and logit-transformed during intervals indicated by black lines above plots: Minutes 0-10, 12-20, 22-30.

(G) A greater fraction of animals leave lawns during feeding inhibition. Statistics by Fisher’s Exact Test.

(H) Number of lawn leaving events in the same assays as (G). Statistics by Wilcoxon rank-sum test.

(I) Cumulative distribution of time until the first head poke reversal or lawn leaving event during feeding inhibition. Statistics by Kolmogorov-Smirnov 2-sample test.

(J) Roaming animals accelerate before leaving during feeding inhibition. Left, mean roaming speed of animals before leaving. Right, quantification of roaming speed increase from minutes -3 to -1 to the last 30 second before leaving. Statistics by Wilcoxon rank-sum test.

Statistics: ns, not significant, * p < 0.05, *** p < 10-3,**** p < 10-4

In time-averages (F,J), dark line represents the mean and shaded region represents the standard error.

Violin plots show median and interquartile range.

In (H), each dot pair connected by a line represents data from a single animal. In (J), each dot pair connected by a line represents data preceding a single lawn leaving event. Thick black line indicates the average.

See Supplementary Table 3.

Neuromodulatory signaling mutants retain coupling of arousal and leaving.

(A-P) Roaming, lawn leaving, roaming before leaving, and roaming speed quantified across mutants in four neuromodulatory genes known to alter roaming and dwelling: tph-1, cat-2, npr-1, and pdfr-1.

(A-D) Fraction of time roaming. Statistics by Student’s t-test on logit-transformed data..

(E-H) Number of lawn leaving events per animal. Statistics by Mann-Whitney U test.

(I-L) Fraction of animals roaming before lawn leaving. Left, fraction of animals roaming in the last 5 minutes before lawn leaving. WT and mutant roaming fractions were compared over the two minutes prior to leaving (black bar). Right, total fraction of time spent roaming and dwelling in all assays that included a lawn-leaving event. Statistics by Student’s t-test on logit-transformed data.

(M-P) Roaming speed before leaving computed at times when less than 10% of aligned traces had missing data. Paired plots indicate the average speed from minutes -3 to -1 and in the last 30 seconds before leaving per animal. Statistics by Wilcoxon rank-sum test.

Statistics: ns not significant (p > 0.05), ** p < 0.01, *** p < 10-3, **** p < 10-4 Violin plots and box plots show median and interquartile range.

In time-averages, dark line represents the mean and shaded region represents the standard error.

In paired plots (M-P), each dot pair connected by a line represents data preceding a single lawn leaving event. Thick black line indicates the average.

(tph-1 n = 139, wild type controls n = 127; cat-2 n = 88, wild type controls n = 76; npr-1 n = 91, wild type controls n = 90; pdfr-1 n = 265, wild type controls n = 247).

See Supplementary Table 4.

Acute circuit manipulation drives deterministic roaming and probabilistic leaving.

(A) Experimental design. Stimulation of bacterial light-activated adenylyl cyclase (BlaC) with 455 nm light increases cAMP synthesis in RIB::BlaC neurons.

(B) Heatmap showing roaming and dwelling for RIB::BlaC animals before, during, and after 10-minute optogenetic stimulation.

(C) Fraction of animals roaming before, during, and after optogenetic blue light stimulation. Light ON period denoted by blue shading. Control animals are wild type. Statistics by Student’s t-test comparing RIB::BlaC and wild type animals averaged and logit-transformed during intervals indicated by black lines above plots: Data compared at 0-10, 12-20, 22-30 minutes.

(D) A greater fraction of RIB::BlaC animals leave lawns when the light is ON vs. OFF. Statistics by Fisher’s Exact Test.

(E) Number of lawn leaving events under the same conditions as (D). Statistics by Wilcoxon rank-sum test.

(F) Cumulative distribution of time until the first head poke reversal or lawn leaving event while the light is ON. Statistics by Kolmogorov-Smirnov 2-sample test. Statistics: ns not significant (p > 0.05), ** p < 0.01,*** p < 10-3,**** p < 10-4

In time-averages (C,G), dark line represents the mean and shaded region represents the standard error.

(RIB::BlaC n = 35, wild type n = 34)

In (E), each dot pair connected by a line represents data from a single animal. In (G), each dot pair connected by a line represents data preceding a single lawn leaving event. Thick black line indicates the average.

See Supplementary Table 5.

tax-4-expressing sensory neurons couple roaming and lawn leaving.

(A-C) Roaming and leaving in tax-4 mutants, and rescue by tax-4 expression in ASJ neurons (wild type n = 143, tax-4 n = 156, tax-4 ASJ rescue n = 148). Additional features of roaming and leaving are shown in Fig. 6-S1; results with additional rescued neurons are in Fig. 6-S2.

(A) Fraction of time roaming. Statistical tests, One-way ANOVA followed by Tukey’s post hoc test on logit-transformed data.

(B) Number of lawn-leaving events per animal. Statistical tests, Kruskal-Wallis followed by Dunn’s multiple comparisons test.

(C) Fraction of animals roaming before lawn-leaving. Left, fraction of animals roaming in the last 5 minutes before lawn leaving. Roaming fractions were compared over the two minutes prior to leaving (black bar). Right, total fraction of time spent roaming and dwelling in all assays that included a lawn-leaving event. Key, statistical tests of differences in roaming two minutes before leaving by One-way ANOVA followed by Tukey’s post hoc test on logit-transformed data.

(D-E) Optogenetic feeding inhibition in tax-4 mutants and rescued strains (wild type n = 70, tax-4 n = 66, tax-4 ASJ rescue n = 68).

(D) Left, Fraction of time spent roaming under optogenetic feeding inhibition in tax-4 and ASJ rescue strain. Statistics by paired t-test on logit-transformed data. Right, Difference in the fraction of time roaming when the light is ON and OFF. Statistics by One way ANOVA followed by Tukey’s post hoc test on logit-transformed data.

(E) Left, Number of lawn leaving events under optogenetic feeding inhibition in tax-4 and ASJ rescue strain. Statistics by Wilcoxon rank-sum test. Right, Difference in the number of lawn leaving events when the light is ON and OFF. Statistics by Kruskal-Wallis test followed by Dunn’s multiple comparisons test. ns not significant (p > 0.05), * p < 0.05, *** p < 10-3, **** p < 10-4

Violin plots and box plots (A,D) show median and interquartile range.

In time-averages (C), dark line represents the mean and shaded region represents the standard error.

In paired plots (D,E), each dot pair connected by a line represents data from a single animal. Thick black line indicates the average.

See Supplementary Table 6.

Small bacterial lawns are denser at the lawn boundary and quantification of duration outside the lawn

(A) A small lawn of bacteria expressing green fluorescent protein (GFP) imaged in the GFP channel. White scale bar is 1 mm.

(B) GFP intensity across the orange transect line plotted in (A) shows accumulation of bacterial cells near the lawn boundary in brighter GFP pixels.

(C) An image of the same lawn in brightfield.

(D) Brightfield intensity across the orange transect line plotted in (C) shows local darkening at the lawn boundary corresponding to bright GFP pixels in (A).

(E) Duration of individual excursions outside the lawn. Quantified across wild type dataset (n = 1586 animals).

See Supplementary Table 1.

Roaming and dwelling states on small bacterial lawns.

(A) Scatter plot of average absolute speed and angular speed in 10 second intervals for wild type animals on small lawns (n = 1586 animals, 380,640 bins). The boundary shown, used for all data in the paper, defines roaming (high speed/low angular speed) and dwelling (low speed/high angular speed).

(B) Two-state Hidden Markov Model trained on wild-type animals. Roaming Behavior and Dwelling Behavior correspond to 10 sec intervals either above or below the separating line in (A), respectively. Roaming and dwelling states are inferred from the Hidden Markov Model. Black arrows indicate transition probabilities between states and colored arrows represent emission probabilities.

(C) Fraction of time spent roaming across wild type animals.

(D) Complementary cumulative distribution functions (ccdfs) for roaming and dwelling state durations in minutes.

(E) Scatter plot of average absolute speed and angular speed in 10 s intervals for wild type animals on uniform lawns (n = 31 animals, 7,440 bins).

(F) Same as (E) for animals on small lawns recorded in parallel with animals on uniform lawns (n = 31 animals, 7,440 bins).

(G) Animals roam more on uniform lawns than on small lawns. * p < 0.05 by Student’s t-test on logit-transformed data.

Violin plots show median and interquartile range.

See Supplementary Table 2.

Modeling behavioral states across locomotory feature dimensions using an Autoregressive Hidden Markov Model.

(A) Schematic of animal body shape with key body points indicated.

(B-E) Schematics illustrating derived behavioral features. See Methods for detailed description. (B) Midbody speed (C) Midbody angular speed (D) Head radial velocity relative to midbody (E) Head angular velocity relative to midbody.

(F-K) Quantification of behavioral parameters per animal while in each AR-HMM state. (F) Fraction of time spent moving forward (G) Midbody forward speed (H) Midbody angular speed (I) Head angular velocity (J) Head radial velocity (K) Fraction of time spent in each state per animal.

(L) Transition matrix for 4-state AR-HMM. Rows index state at time t, columns index state at t+1.

(M) Fraction of AR-HMM states found in roaming and dwelling states.

(N) Fraction of roaming and dwelling states found in each AR-HMM state.

(O) Empirical complementary cumulative distribution functions (ccdfs) comparing state durations from the 4-state AR-HMM to those of roaming and dwelling.

(P) Example behavioral trace with two lawn leaving events. Absolute Speed and Lawn Boundary Distance are shown for a continuous 40-minute assay. Foraging decisions are annotated with colored tick marks above lawn boundary distance trace. Roaming, Dwelling, and AR-HMM states are annotated above Absolute Speed with colored bars.

Distributions are computed across wild type animals on small lawns (n = 1586). Violin plots show median and interquartile range.

See Supplementary Table 2.

Head Poke Reversals are associated with small changes in arousal states.

(A) Midbody forward speed aligned to head poke reversals. Left, heatmap of individual speed traces. Right, mean midbody forward speed computed across the heatmap traces.

(B) Overlap of head poke reversals with roaming and dwelling. Left, percentage of head poke reversals found in each state. Right, percentage of time bins roaming or dwelling that contain a head poke reversal.

(C) Roaming and dwelling aligned to head poke reversals. Left, heatmap of roaming/dwelling state classifications aligned to head poke reversals. Center, fraction of animals in roaming or dwelling state prior to head poke reversals. Right, total fraction of time spent roaming and dwelling in all assays that included a head poke reversal.

(D) Overlap of head poke reversals with AR-HMM states. Left, percentage of head poke reversals found in each state. Right, percentage of time bins per AR-HMM state that contain a head poke reversal.

(E) AR-HMM states aligned to head poke reversals. Left, heatmap of roaming/dwelling state classifications aligned to head poke reversals. Center, fraction of animals in each AR-HMM state prior to head poke reversals. Right, total fraction of time spent in each AR-HMM state in all assays that included a head poke reversal.

Data aligned to head poke reversals (n = 63,585) from wild type animals (n = 1586).

Dark lines represent the mean and shaded region represents the standard error.

In boxplots, median is highlighted, and interquartile range is indicated by shaded area.

See Supplementary Table 2.

Further quantification of roaming and leaving behaviors under food intake inhibition.

(A-B) Aztreonam affects roaming and leaving by affecting bacterial growth. In “pre-add” conditions, the drug is added to liquid cultures and agar plates during bacterial growth. In “post-add” conditions, the drug is added after bacterial growth just before testing behavior.

(A) Fraction of time roaming. Different letters mark significant differences in roaming by logit-transformation followed by One-way ANOVA followed by Tukey’s post hoc test. (pre-add: +DMSO/+aztreonam n = 12, +DMSO (control) n = 15; post-add: +DMSO/+aztreonam n = 12, +DMSO (control) n = 16).

(B) Number of lawn leaving events in the same assays as (A). Different letters mark significant differences in roaming by Kruskal-Wallis followed by Dunn’s multiple comparisons test.

(C) Animals on inedible food accelerate speed before leaving the lawn. Statistics by Wilcoxon rank-sum test.

(D-G) Quantification of controls relating to feeding inhibition experiments.

(D) Light exposure does not induce roaming in animals not pre-treated with all-trans retinal. Statistics by paired t-test on logit-transformed data.

(E) Light exposure reliably induces roaming in animals pre-treated with all-trans retinal. Statistics by paired t-test on logit-transformed data.

(F) Light exposure does not increase the fraction of animals that leave lawns when animals are not pre-treated with all-trans retinal. Statistics by Fisher’s Exact Test.

(G) Light exposure does not increase the number of lawn leaving events when animals are not pre-treated with all-trans retinal. Statistics by Wilcoxon rank-sum test.

(H) Cumulative distribution of time until the first head poke reversal or lawn leaving event while the light is OFF. Statistics by Kolmogorov-Smirnov 2-sample test.

(I-J) Quantification of roaming and leaving in animals with or without pre-treatment with all-trans retinal without light exposure. (-ATR n = 67, +ATR n = 57).

(I) Pre-treatment with all-trans retinal does not alter the fraction of time roaming. Statistics by Student’s t-test on logit-transformed data.

(J) Pre-treatment with all-trans retinal does not alter the number of lawn leaving events per animal. Statistics by Mann-Whitney U test.

Statistics: ns not significant (p > 0.05), **** p < 10-4 Violin plots show median and interquartile range.

In (D,E,G), each dot pair connected by a line represents data from a single animal. In (C), each dot pair connected by a line represents data preceding a single lawn leaving event.

See Supplementary Table 3.

Optogenetic feeding inhibition in neuromodulatory mutants stimulates roaming and leaving.

(A-B) Optogenetic feeding inhibition in pdfr-1 mutants.

(A) Left, Fraction of animals roaming before, during and after optogenetic feeding inhibition in pdfr-1 mutants and paired wild type controls. Statistics by Student’s t-test comparing pdfr-1 and matched wild type data averaged and logit-transformed in intervals denoted by black bars above: Data compared at 0-10, 12-20, 22-30 minutes.

Right, Difference in fraction of time roaming between light ON and light OFF conditions per animal. Statistics by Mann-Whitney U test.

(B) Left and Middle, pdfr-1 animals and wild type controls execute more lawn leaving events under feeding inhibition while light is ON. Statistics by Wilcoxon rank-sum test. Right, difference in number of lawn leaving events between light ON and light OFF conditions per animal. Statistics by Mann-Whitney U test. (pdfr-1 n = 23, wild type controls n = 27)

(C-D) Optogenetic feeding inhibition in tph-1 mutants.

(C) Same as (A) for tph-1 animals and matched controls.

(D) Same as (B) for tph-1 animals and matched controls. (tph-1 n = 18, wild type controls n = 16)

Statistics: ns not significant (p > 0.05), * p < 0.05, ** p < 0.01, *** p < 10-3 Violin plots show median and interquartile range.

In time-averages, dark line represents the mean and shaded region represents the standard error.

In paired plots, each dot pair connected by a line represents data from a single animal. Thick black line indicates the average.

See Supplementary Table 4.

pdfr-1 genomic characteristics and expression patterns.

(A) Genomic region surrounding pdfr-1 (black boxes represent coding exons, gray boxes are non-coding exons), region deleted in pdfr-1(ok3425) mutants, proximal and distal promoters, PCR fragments used in transgenic rescue experiments.

(B) Rescue of pdfr-1 roaming phenotype by transgenic expression from the PCR fragments illustrated in

(A). Different letters mark significant differences in roaming by logit-transformation followed by Tukey’s post hoc test (wild type n = 55, pdfr-1 n = 59, PCR fragment #1; pdfr-1 n = 46, PCR fragment #2; pdfr-1 n = 51). Violin plots show median and interquartile range.

(C) pdfr-1 expression patterns from the proximal and distal promoters as reported (Barrios, et al (2012), Flavell, et al (2013)) and from this work.

See Supplementary Table 5.

Transgenic rescue of pdfr-1 in RIB neurons restores roaming

(A) Schematic depicting intersectional cell-specific rescue of pdfr-1 using an inverted Cre-Lox strategy.

(B) Restoring pdfr-1 expression in AIY, RIM, and RIA neurons did not rescue roaming on small lawns (wild type n = 64, inverted pdfr-1 transgene n = 64, AIY, RIM, RIA pdfr-1 rescue n = 64, pan-neuronal::Cre rescue n = 67).

(C) Restoring pdfr-1 expression in RIB neurons rescued roaming comparably to pan-neuronal rescue on small lawns (wild type n = 27, inverted pdfr-1 transgene n = 32, RIB pdfr-1 rescue n = 33, pan-neuronal::Cre rescue n = 31).

(D) Differential interference contrast (DIC), GFP fluorescence and composite images of an animal expressing pdfr-1 in the RIB neurons using the transgenic strategy shown in (A). Scale bar is 10μm. Statistics: In (B-C), different letters mark significant differences in roaming by logit-transformation followed by Tukey’s post hoc test.

Violin plots (B,C) show median and interquartile range.

See Supplementary Table 5.

Further quantification and controls of RIB::BlaC experiments.

(A-E) Quantification of RIB::BlaC controls.

(A) Blue light stimulation does not induce roaming in wild type animals. Statistics by paired t-test on logit-transformed data.

(B) Blue light stimulation reliably induces roaming in RIB::BlaC animals. Statistics by paired t-test on logit-transformed data.

(C) Blue light stimulation does not elevate the fraction of wild type animals that leave lawns. Statistics by Fisher’s Exact Test.

(D) Blue light stimulation does not elevate the number of lawn leaving events per wild type animal. Statistics by Wilcoxon rank-sum test.

(E) Cumulative distribution of time until the first head poke reversal or lawn leaving event while the light is OFF. Statistics by Kolmogorov-Smirnov 2-sample test.

(F) Roaming animals only accelerate slightly before leaving during RIB BlaC stimulation. Left, mean roaming speed of animals before leaving. Right, quantification of roaming speed changes before leaving. Statistics by Wilcoxon rank-sum test.

(RIB BlaC n = 35, wild type n = 34).

Statistics: ns not significant (p > 0.05), **** p < 10-4

In paired plots (A,B,D), each dot pair connected by a line represents data from a single animal. Thick black line indicates the average.

See Supplementary Table 5.

Further quantification of tax-4 mutants and tax-4 ASJ rescue on edible food

(A) Complementary cumulative distribution functions (ccdfs) for overall roam state durations for tax-4 rescues in ASJ. Different letters mark significant differences by Kolmogorov-Smirnov 2-sample tests with Bonferroni correction.

(B) Same as (A) for roam state durations before leaving events.

Wild type n = 143, tax-4 n = 156, tax-4 ASJ rescue n = 148. Statistics: different letters indicate significant differences.

See Supplementary Table 6.

tax-4 rescue in additional tax-4-expressing neurons

(A-B) Quantification of roaming and leaving in tax-4 mutants with tax-4 rescued in ASJ, ASK or ASJ+ASK neurons (wild type n = 95, tax-4 n = 104, ASJ rescue n = 91, ASK rescue n = 101, ASJ+ASK rescue n = 105).

(A) ASJ or ASJ+ASK tax-4 rescue restores roaming to tax-4 mutants.

(B) ASK tax-4 rescue suppresses lawn leaving below tax-4 levels.

(C-D) Quantification of roaming and leaving in tax-4 mutants with tax-4 rescued in AWC or ASI neurons (wild type n = 79, tax-4 n = 88, AWC rescue n = 68, ASI rescue n = 77).

(C) AWC or ASI tax-4 rescue fails to restore roaming to tax-4 mutants.

(D) AWC tax-4 rescue restores lawn leaving to wild-type levels.

(E-F) Quantification of roaming and leaving in tax-4 mutants with tax-4 rescued in AQR/PQR/URX neurons (wild type n = 35, tax-4 n = 32, AQR/PQR/URX rescue n = 19).

(E) AQR/PQR/URX tax-4 rescue fails to restore roaming to tax-4 mutants.

(F) AQR/PQR/URX tax-4 rescue fails to restore lawn leaving. Violin plots (A,C,E) show median and interquartile range.

Statistics: Different letters mark significant differences. ns not significant (p > 0.05), * p < 0.05, ** p < 0.01,

*** p < 10-3. Statistical tests for differences in fraction of time roaming by One way ANOVA followed by Tukey’s post hoc test on logit-transformed data. Statistical tests for differences in lawn leaving by Kruskal-Wallis test followed by Dunn’s multiple comparisons test.

See Supplementary Table 6.

Further quantification of tax-4 mutants and tax-4 rescues under optogenetic feeding inhibition

(A-D) Effects of tax-4 on roaming and leaving behavior induced by optogenetic feeding inhibition.

(A) Fraction of animals roaming before, during, and after optogenetic feeding inhibition. Light ON period denoted by yellow shading.

(B) Cumulative distribution of time until the first head poke reversal or lawn leaving event while the light is OFF. Statistics by all pairwise Kolmogorov-Smirnov 2-sample tests, Bonferroni corrected.

(C) Same as (D) for when the light is ON. Pairwise significant differences in time to first lawn leaving are indicated in the figure legend.

(D) Left, Roaming speed before leaving while the light is ON computed at times when less than 10% of aligned traces had missing data. Roaming speed from the last 30 seconds is averaged and compared by statistical testing: significant differences are reported in the figure legend under “before”. Right, paired plots indicate the average speed from minutes -3 to -1 and in the last 30 seconds before leaving per animal.

Each dot pair connected by a line represents data preceding a single lawn leaving event. Thick black line indicates the average.

Statistics: ** p < 0.01, *** p < 10-3, Different letters mark significant differences. Violin plots (B,C) show median and interquartile range.

See Supplementary Table 6.

tax-4 mutants leave less on inedible food and ASJ rescue restores leaving.

(A-B) In these panels, wild type n = 30, tax-4 n = 22, tax-4 ASJ rescue n = 10 on inedible food generated by pre-treatment of bacterial lawns with aztreonam before growth.

(A) wild type, tax-4 and tax-4 ASJ rescue animals all roam near-constantly on inedible food. Statistical tests of differences in roaming by One-way ANOVA followed by Tukey’s post hoc test on logit-transformed data.

(B) tax-4 mutants leave lawns of inedible bacteria less frequently than wild type. tax-4 ASJ rescue restores lawn leaving. Statistical tests of differences in lawn leaving by Kruskal-Wallis followed by Dunn’s multiple comparisons test.

See Supplementary Table 6.