Contrary to Lp, Ecc or Bt bacteria are found exclusively in the anterior part of the gut.

A: Pictures to illustrate the position of the green fluorescence of control L3 stage larvae as a group (upper panel) or individual (lower panel) after having been fed 1h with a media containing yeast and GFP-producing bacteria (Ecc or Bt or Lp). The white asterisk indicates the anterior part of the animal. The white arrow indicates the posterior limit of the area containing the fluorescent bacteria. Below the pictures are schematics representing larvae, their gut, and the relative position of the GFP- producing bacteria in green. Scale bar is 1mm.

B: Graphic representing the blockage ratio for L3 larvae exposed during 1h to a mixture composed of yeast and fluorescent bacteria. The ratio of control larvae with a distinguishable green fluorescence only in the upper part of the intestine, considered as blocked bacteria, is represented. The ratio is calculated as: x larvae with bacteria exclusively in the anterior part of the gut / (x larvae with bacteria exclusively in the anterior part of the gut + y larvae with bacteria all along the gut). Larvae with no distinguishable fluorescence were considered as non-eaters and discarded from the quantifications. The ratio of larvae with no distinguishable fluorescence was not influenced by the different conditions we tested. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 30 animals per condition and trial. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

Bacterial blockage is dose-dependent, occurs in less than 30 minutes, and does not involve a group effect.

A: Blockage ratio for control L3 larvae fed 1h with a mixture combining yeast with different concentrations of fluorescent Ecc or Bt, concentrations are in number of bacteria per ml. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 18 animals per condition and trial. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

B: Representative images of control larvae fed during 30 min. with Bt. Scale bar is 1mm.

C: Blockage ratio for control L3 larvae fed during various times with a mixture combining yeast with Ecc or Bt. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 20 animals per condition and trial. ns indicates values with differences not statistically significant, **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

D: Blockage ratio for control L3 larvae fed 1h as individual animals or as groups of 10 or >40 with a mixture combining yeast with a constant concentration of Ecc or Bt (4.1010 bacteria per ml). Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with the exact number of animals indicated per condition and trial. ns indicates values with differences not statistically significant, Fischer exact t-test. See the source data file for details.

The bacterial blockage necessitates Duox in enterocytes, the TrpA1 channel and Dh31 in Pros+ cells.

A: Pictures to illustrate the localization of the fluorescent bacteria within the intestine of control (ctrl), Trpa1[1] or Dh31- L3 larvae after having been fed 1h with a mixture of yeast and Ecc. Scale bar is 1mm.

B: Blockage ratio for control (ctrl) L3 larvae or mutants for Trpa1[1] or Dh31- fed 1h with a mixture combining yeast and Lp or Ecc or Bt or fluorescent Dextran with or without hCGRP hormone. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 30 animals per condition and trial. 0 indicates an absence of blockage. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

C: Pictures to illustrate the localization of the fluorescence within the intestine of control L3 larvae after having been fed 1h with a mixture of yeast and fluorescent Dextran with or without hCGRP hormone. Below the pictures are schematics representing larvae, their gut, and the relative position of the fluorescence in green. Scale bar is 1mm.

D: Blockage ratio for animals expressing RNA interference constructions directed against Duox mRNA or Dh31 mRNA, ubiquitously (Da-Gal4), in enterocytes (Mex- Gal4) or in enteroendocrine cells (Pros-Gal4) and then fed 1h with a mixture combining yeast and Ecc or Bt. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 30 animals per condition and trial. ns indicates values with differences not statistically significant, **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

Blocking the ROS with DTT prevents the compartmentalization of Bt, and the larvae with bacteria in the posterior part of the intestine die.

A: Pictures to illustrate the localization of the fluorescence within the intestine of control (ctrl) L3 larvae after having been fed 1h with a mixture of yeast and Bt with or without DTT. Below the pictures are schematics representing larvae, their gut, and the relative position of the fluorescent bacteria in green. Scale bar is 1mm.

B: Blockage ratio for control (ctrl) L3 larvae fed 1h with a mixture combining yeast, DTT and fluorescent Dextran or Bt. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 18 animals per condition and trial. ns indicates values with differences not statistically significant, Fisher exact t-test. See the source data file for details.

In the absence of blockage in TrpA1[1] or Dh31- mutants, Bt and Ecc proliferate in the larval intestine and the larvae die.

A, B and C: quantification over time of the amount of Lp, (A), Bt (B) or Ecc (C) live bacteria within the larval intestine of control (ctrl) (A, B and C), Dh31- (B and C) and TrpA1[1] (B and C) animals following a 1h feeding period with a solution containing yeast and bacteria. CFU stands for Colony Forming Units. Shown is the average ± SEM of at least 3 independent experiments with at least 7 guts each. After 8h, either all the TrpA1[1] or Dh31- larvae were dead or the intestines were severely damaged preventing the CFU counting. * Indicates p<0,05, Mann Whitney, two-tailed test. See the source data file for details.

D: Pictures of control (ctrl) or TrpA1[1] or Dh31-larvae after 8h in a wet chamber following a 1h feeding with a mixture of yeast and Bt. For control larvae, some animals made pupae that are visible while for TrpA1[1] and Dh31-mutants, the dark larvae are dead non-moving melanized animals. Scale bar is 1mm.

E: Ratio of dead control or TrpA1[1] or Dh31- larvae after 8h in a wet chamber following or not (water) a 1h feeding period with yeast mixed with Lp or Ecc or Bt. Shown is the average with 95% confidence interval of at least 3 independent experiments with at least 21 larvae per trial and condition. The 0 symbol indicates an absence of lethality.

**** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

F: Ratio of dead control (ctrl) larvae after 8h in a wet chamber following a 1h feeding period with a mixture combining yeast, DTT and Dextran fluorescent beads or Bt. Shown is the average with 95% confidence interval of at least 3 independent experiments with at least 18 larvae per trial and condition. The 0 symbol indicates an absence of lethality. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

TrpA1+ cells in the gut are enteroendocrine cells concentrated in a portion of the intestine bordering the blocked bacteria.

Confocal fluorescent pictures of the anterior portions of L3 larval intestines to detect; longitudinal and transversal muscles concentrated in actin (F, G, H and H’), TrpA1+ cells producing RFP (A, A’, B, C, C’’ and F), GFP-bacteria (B, G and H), Dh31+ cells (C’, C’’, D and E), Pros+ cells (D and E) and nuclei with DNA staining (A, A’, B, C’’, D, E and G).

In B, D, E, G, H and H’; animals were previously fed for 1h with a mixture containing bacteria and yeast with Bt (B, D and E) or Ecc (G, H and H’). When present, the white star indicates the anterior part of the intestinal portion shown, the arrows point to TARMs and the > symbols point to TrpA1+ cells. The empty squares in A and H with dashed lines correspond to the portion of the image magnified in A’ and H’, respectively. Scale bar in A, B, F, G and H represents 500µm, in A’, C, D, E and H’ represents 100 µm.

IMD pathway is not required for the blockage but essential for larvae survival and Bt or Ecc clearance.

A: Pictures to illustrate the localization of the fluorescence within the intestine of PGRP-LC[ΔE] L3 larvae after having been fed 1h with a mixture of Lp or Ecc or Bt. Scale bar is 1mm.

B: Blockage ratio for control L3 larvae or mutants of the IMD pathway fed 1h with a mixture combining yeast and Lp or Ecc or Bt. Shown is the average with 95% confidence interval of at least 3 independent experiments with at least 20 larvae per trial and condition. ns indicates values with differences not statistically significant, Fisher exact t-test. See the source data file for details.

C: Pictures of PGRP-LC[ΔE], Rel[E20] or ΔAMP14 mutant larvae after 18h in a wet chamber following a 1h feeding with a mixture of yeast and Bt. The dark larvae are dead non-moving melanized animals. ΔAMP14 is a mutant deleted for 14 antimicrobial-encoding genes.

D: Ratio of dead control or TrpA1[1] or Dh31- larvae after 18h in a wet chamber following or not (water) a 1h feeding period with yeast mixed with Lp or Ecc or Bt. Shown is the average with 95% confidence interval of at least 3 independent experiments with at least 20 larvae per trial and condition. The 0 symbol indicates an absence of lethality. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

E and F: quantification over time of the amount of Bt (A) and Ecc (B) live bacteria within the larval intestine of control or IMD pathway mutant animals including ΔAMP14 following a 1h feeding period with a solution containing yeast and bacteria. CFU stands for Colony Forming Units. ΔAMP14 is a mutant deleted for 14 antimicrobial-encoding genes. Shown is the average ± SEM of at least 3 independent experiments with at least 7 guts each. After 8h, either all the mutants were dead or the intestines were severely damaged preventing the CFU counting. * Indicates p<0,05, Mann Whitney, two-tailed test. See the source data file for details.

Chronological coordination of ROS/TrpA1/Dh31 and IMD pathways for an efficient microbial elimination.

t0: larvae ingest bacteria from the food mixture (anterior on the left, only bacteria similar to Ecc or Bt are illustrated). This initial phase necessitates a discrimination between commensal and pathogenic bacteria, not elucidated in this study (symbolized by ‘?’). The presence of pathogenic bacteria induces the production of ROS by enterocytes (EC) in a Duox-dependent manner. Then ROS activates TrpA1 in enteroendocrine cells (EEC). t15 minutes: Dh31 secretion by EEC is responsible for the blockage of bacteria likely by promoting visceral muscle contractions leading to a closure of a valve-like structure. This phenomenon concentrates the bacteria in the anterior part of the gut. The bacterial concentration in this part of the intestinal lumen may facilitate the triggering of the IMD signaling cascade that controls the transcription of the genes (AMPs) encoding the antimicrobial peptides (AMPs). t6 hours: the valve-like structure is still closed. The bactericidal activity of AMPs has eliminated most of the bacteria accumulated in the anterior part of the intestine. Importantly, if confinement is prevented, the larvae die; if the response by antimicrobial peptides is hindered, the larvae die.

Ecc and Bt are blocked in the anterior part of the intestine and disappear while Lp transits to the posterior part and remains.

A: Timelapse from the movies of L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 1.

B: Timelapse from the movies of L3 Larvae fed 1h with a mixture of yeast and Bt then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 2.

C: Timelapse from the movies of L3 Larvae fed 1h with a mixture of yeast and Lp then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 3.

For A-C, the frames are separated by 5 minutes.

Contrary to Lp, Ecc or Bt bacteria are blocked in the anterior part of the gut.

A: Graphic representing the blockage ratio for dissected intestines of L3 larvae exposed during 1h to a mixture composed of yeast and fluorescent bacteria. Shown is the average blockage ratio with a 95% confidence interval from at least 3 independent assays with at least 8 organs per condition and trial. **** indicates p<0,0001, Fisher exact t-test. See the source data file for details.

SUPP3 Ecc is not blocked anteriorly in TrpA1[1] and Dh31- mutants, persists in the posterior part of the intestine and disappears while Lp can be blocked following exogenous addition of hCGRP.

A: Timelapse from the movies of TrpA1[1] L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 4.

B: Timelapse from the movies of Dh31- L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 5.

C: Timelapse from the movies of w- L3 Larvae fed 1h with a mixture of yeast and Lp + hCGRP then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 6.

For A-C, the frames are separated by 5 minutes.

TARMsT2 are attached to the longitudinal gut muscles.

Confocal fluorescent pictures of different TARMsT2 in the anterior portions of L3 larval intestines to detect longitudinal and transversal muscles concentrated in actin. The white star indicates the anterior part of the intestinal portion shown. The empty square with dashed lines in A corresponds to the portion of the image magnified in A’. Scale bar represents 500µm.

Bt and Ecc are blocked anteriorly and persist in PGRP-LC[ΔE] and PGRP-LE[112] mutants, respectively.

A: Timelapse from the movies of PGRP-LC[ΔE] L3 Larvae fed 1h with a mixture of yeast and Bt then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 8.

B: Timelapse from the movies of PGRP-LE[112] L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 9.

For A and B, the frames are separated by 5 minutes.

Bt and Ecc are blocked and persist anteriorly in Dredd[F64] and Rel[E20] mutants.

A: Timelapse from the movies of Dredd[F64] L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 10.

B: Timelapse from the movies of Rel[E20] L3 Larvae fed 1h with a mixture of yeast and Bt then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 11.

C: Timelapse from the movies of Rel[E20] L3 Larvae fed 1h with a mixture of yeast and Ecc then transferred on a glass slide, in a wet chamber, to be imaged overnight. Refers to Movie 12.

For A-C, the frames are separated by 5 minutes.