Introduction

The locomotive ability of bacteria allows them to actively explore environments favorable for their growth, facilitating their proliferation. Though diverse forms of bacterial motility are known, the flagellum has been the primary machinery. The rotation of extracellular flagella possessed by, for example, Escherichia coli, Salmonella enterica, and Vibrio cholera, propels the bacteria through interaction with fluids1,2,3. Some species employ extracellular flagella for swarming over surfaces covered with viscous agents4. When the species are causative agents of diseases, motility is usually involved in invasion, migration within the host, and disease development1,2,5. Thus, understanding the responsibility of motility as a virulence factor will lead to the development of medications and the proposal of novel strategies for protecting against infection.

Leptospirosis is an emerging zoonosis spreading globally. Regarding the threat to human health, the spirochete pathogens of leptospirosis, Leptospira spp., have caused ~1 million severe cases and ~60,000 deaths yearly6. Pathogenic Leptospira spp. have been classified into more than 250 serovars, and clinical signs in infected animals differ depending on the combination of host species and Leptospira serovars7,8,9. Susceptible animals, including humans, can develop severe manifestations, such as jaundice, pulmonary hemorrhage, and nephritis, whereas rodents are asymptomatic carriers for particular serovars. Some animals, such as dogs, maintain the host-adopted pathogens after recovery from the disease. Leptospira spp. colonize in the kidneys of particular reservoir animals and are excreted in the urine. Bacteria excreted into the environment infect animals through the percutaneous or permucosal route. In the host body, Leptospira spp. migrate to specific organs and break tissues7,8,9,10. Leptospira spp. have two flagella in the periplasmic space11. It is believed that the rotation of the periplasmic flagella (PFs) beneath the outer membrane drives the rolling of the spiral body12. The PF-dependent rotation of the cell body produces the thrust needed to swim in liquid media and crawl on a solid surface (Fig. 1). In other words, spirochetes have an amphibious motility system13. Animal experiments have shown that motility-deficient mutants were attenuated14,15, suggesting that leptospiral virulence likely involves motility. However, the beneficial role of motility for leptospiral pathogenicity remains unclear.

Fig. 1: Observation of bacterial locomotion over cultured cells.
figure 1

Cultured kidney cells form a monolayer on the glass of a chamber slide filled with a liquid medium. Leptospirosis spirochetes swim in the medium and crawl on the kidney cells.

Direct observation of bacteria in various conditions, such as in solutions, tissues, and artificial microstructures, has been the conventional method for investigating disease mechanisms in terms of pathogen dynamics and motility mechanisms16,17,18,19. These experiments usually pursue representative bacteria in a crowd or detect bacteria dwelling in living cells, which requires labeling the objects with fluorescent proteins or dyes. However, not all bacterial strains can endure genetic engineering and express fluorescent proteins. Labeling can possibly affect bacterial physiology and dynamics. We previously used a green fluorescent protein (GFP) to observe Leptospira spp. over the cultured kidney cells. The experiment showed that the pathogenic species L. interrogans, which causes leptospirosis, moved more actively than the saprophytic L. biflexa16. We attempted to label several pathogenic strains with a GFP, but only two strains yielded fluorescence and were available. Hence, label-free techniques allow experiments that are not restricted by the properties of biological samples.

In this study, we developed a method for label-free motion tracking to elucidate the mechanism by which leptospirosis spirochetes move on host cells. Our label-free bacterial tracking method uses machine learning-based image processing that highlights moving objects by subtracting the background from raw images. The processed images allowed label-free analysis of bacteria motility on the cultured animal cells, providing insight into the mechanism of leptospiral locomotion on host cells and the significance of motility as a virulence factor.

Results

Label-free motion tracking

We used a dark-field microscope to observe a thin cell body of L. interrogans (~100 nm in width). In the in vitro infection assay (Fig. 1), scattering from cultured cells prevents the visualization of bacteria (Fig. 2a, Step 1 and Supplementary Movie S1). Therefore, we first obtained brightness distributions of individual pixels in the time axis direction and then subtracted the background cluster from the raw image by the pixel (Fig. 2a, Step 2, 2b, and Supplementary Movie S2). We recognized the background (mainly signals from cultured cells) in the complex distribution using a Gaussian mixture model (GMM). The GMM was sequentially updated every time a new pixel value was added through maximum a posteriori (MAP) estimation (Fig. 2c, d)20,21. The background subtraction results processed by the pixel were integrated (Fig. 2a, Step 3 and Supplementary Movie S3), and bacteria were recognized according to area and shape (Fig. 2a, Step 4 and Supplementary Movie S4). As such, we successfully determined the locomotion trajectories of bacteria without labeling by tracking their centroids based on the frame (green lines in Fig. 2a, Step 5 and Supplementary Movie S5).

Fig. 2: Label-free bacterial tracking on cultured cells using machine learning.
figure 2

a An overview flowchart. A mass of overlapped bacteria observed in Step 3, indicated by a yellow arrow, is removed by Step 4. b A schematic explanation of background subtraction. Sequential measurements of the pixel brightness along the time axis yield brightness distributions by the pixel. Focus on three pixels indicated by blue, green, and red squares. The blue and green pixels show single clusters with different mean brightness. The red pixel shows two clusters caused by the invasion of a brighter object. Major and minor clusters generally correspond to background (BG) and foreground (FG) signals, respectively, which are thus discriminated without setting the uniquely specified threshold. c Update of GMM upon the addition of a new data. The new data x(t+1) is classified based on the Mahalanobis distance Dm from the clusters comprising the distribution at t: \({D}_{m}({x}^{(t+1)})=| {x}^{(t+1)}-{\hat{\mu }}_{m}| /{\hat{\sigma }}_{m}\), where \({\hat{\mu }}_{m}\) and \({\hat{\sigma }}_{m}\) are the mean and variance of the component m. d Anticipated GMM updates. Adding new data could cause an increase (Case 1) or decrease (Case 2) in existing clusters or the generation of a new one (Case 3). If Dm(x(t+1)) is less than the threshold, then x(t+1) is classified to the mth cluster; if Dm(x(t+1)) is larger than the threshold (i.e., there are no close clusters), then a new (m + 1)th component is generated with \({\hat{\pi }}_{m+1}=\alpha\), \({\hat{\mu }}_{m+1}={x}^{(t+1)}\) and \({\hat{\sigma }}_{m+1}={\sigma }_{0}\), where α decays the past data, \({\hat{\pi }}_{m}\) is the weighting parameter (non-negative, add up to 1), and σ0 is some appropriate initial variance. The minor cluster vanishes when the number of clusters exceeds the upper limit set arbitrarily.

Confined crawling in association with reservoir host cells

We first compared the Leptospira swimming and crawling motility between two pairs of the leptospiral strain and host species. One of the pairs, L. interrogans serovar Manilae vs. NRK (normal rat kidney) cells, was used as an example of asymptomatic because rats are known to be typically asymptomatic carriers of serovar Manilae strains22. The other pair, L. interrogans serogroup Hebdomadis strain D-OW16-2K (isolated from a seriously ill dog) vs. MDCK (Madin–Darby canine kidney) cells, was assumed to develop severe disease. In the asymptomatic pair, leptospires swam smoothly, but their translational locomotion was reduced while crawling in association with the kidney cells (Fig. 3a, left panels). In contrast, leptospires in the severely symptomatic pair showed long-distance migration on the cell surface (Fig. 3a, right panels). We previously observed crawling of GFP-labeled L. interrogans on kidney cells, showing higher mobility of pathogenic strains than a non-pathogenic strain16. The present label-free experiment showed a similar tendency.

Fig. 3: The motion of the leptospirosis spirochetes over kidney cell monolayer.
figure 3

Swimming bacteria were measured in liquid phases over kidney cells (Fig. 1). a Swimming and crawling trajectories of representative bacteria are presented in 3-s runs. The analyzed trajectories for swimming and crawling were 182 and 133 in the asymptomatic pair and 20 and 127 in the severely symptomatic pair. b Probability distribution functions (PDFs) of swimming and crawling speeds. The box-and-whisker plots (insets) show the 25th (the bottom line of the box), 50th (middle), and 75th (top) percentiles and the minimum and maximum values (whiskers) of the speed data set obtained in each pair. The measured bacteria were 123 (swimming of asymptomatic), 23 (swimming of severely symptomatic), 125 (crawling of asymptomatic), and 84 (crawling of severely symptomatic). c Time plot of the mean square displacement (MSD). The log–log plots show the ballistic (  Δt2) and diffusive (  Δt) regimes; the time dependence changes at ~1 s (see also the main text). The upper right panels show the diffusion coefficients determined by the line fitting to the regime  Δt.

The previous study using GFP-labeled strains showed that the crawling speed of leptospires was not associated with disease severity16. However, the label-free experiment revealed that leptospires swam faster in the asymptomatic pair than in the severely symptomatic pair (Fig. 3b, upper panel) but that the opposite was true for crawling speed (Fig. 3b, lower panel). We also evaluated the two-dimensional movements of leptospires according to the time plot of the mean square displacement (MSD) < r2t) > = < r(t + Δt) − r(t)2 > (Fig. 3c). It is known that the < r2t) > of particles moving unidirectionally is proportional to Δt2, whereas that of diffusive motion is proportional to Δt23. Every < r2t) > plot of leptospires showed a quadratic curve at a very short time scale (Δt2) and a proportional line at a longer time scale (Δt. See also log–log plots). The observed time dependences of < r2t) > represent bacteria moving in a direction for a short duration and those showing diffusion for an extended duration. A swimming analysis of E. coli proposed a model determining the duration for smooth unidirectional locomotion: \( < {r}^{2}({{\Delta }}t) > =2{v}_{0}^{2}\tau [t-\tau (1-\exp (-{{\Delta }}t/\tau ))]\), where v0 is the speed at which the bacterium swims in one direction and τ is the duration of the ballistic swimming24,25. Applying the model to the leptospiral locomotion showed that τ 1 s. The predicted duration for ballistic swimming agrees with the change in the time dependence of < r2t) > observed in Fig. 3c. We determined the diffusion coefficients of swimming (Ds) and crawling (Dc) using linear regression to the regime proportional to Δt. Accordingly, we found that leptospires in the asymptomatic pair diffused more readily by swimming than those in the severely symptomatic pair but that the opposite was true for the magnitude of diffusion by crawling (Fig. 3c). These results suggest that the confined behavior of leptospires on tissue cells enables host animals to carry the bacteria without apparent clinical signs.

Leptospires crawl faster on dog kidney cells

Focusing on speeds, we examined the motility of various Leptospira strains (Supplementary Table S1) over NRK and MDCK. Swimming speed does not seem to be related to the host-bacteria combination, but crawling speed is likely to be faster for strains infected to MDCK (Fig. 4a).

Fig. 4: Motility of various Leptospira strains on NRK or MDCK cells.
figure 4

a Swimming and crawling speeds. Percentiles (boxes) and the minimum and maximum values (whiskers) of the speed data set are shown as described in the legend of Fig. 3. b The ratio of speeds measured using MDCK and NRK. The values of ratio and error were obtained from the averaged speeds and standard errors of the data set shown in a (see Supplementary Note 1 for details on error propagation). The strain names are presented by serovar names, and some of them are abbreviated: Hebd Hebdomadis, Ictero Icterohaemorrhagiae, Autum Autumnalis. Full names and the number of samples measured are shown in Supplementary Table S2.

Such a tendency could be seen more clearly by comparing the speeds measured on MDCK and NRK (Fig. 4b). Most of the measured strains showed faster crawling on MDCK (MDCK/NRK > 1). Dogs are susceptible to many pathogenic Leptospira serovar strains, and in some cases serious illness develops8. Although virulence of serovar Manilae strain in dogs remains unclear, anti-serovar Manilae antibodies were frequently detected in dogs in the Philippines, indicating the infectivity of the serovar to dogs26. Among the strains measured, some strains, such as serogroups Australis and Autumnalis (Autum), showed no significant enhancement of crawling. Therefore, these results suggest that crawling is not a sole determinant of virulence but is involved in the pathogenicity of Leptospira along with many other virulence factors.

OMPs contribute to crawling

The crawling of the periodontal spirochete Treponema denticola involves dentilisin, a protein located on the outer membrane27. Studies on Leptospira crawling also showed the possible contribution of outer membrane proteins (OMPs)28 and lipopolysaccharides (LPS)13 to surface locomotion, but the responsible Leptospira cell surface molecules remain unidentified. Note that the leptospiral OMPs LenA and LigA have the ability to bind to the host cells29,30,31,32. Examining the effect of the deficiency of LenA and LigA on the adhesion of L. interrogans serovar Manilae, we found that both disruptions reduced the leptospiral adherence to NRK cells (Fig. 5a).

Fig. 5: Effect of the loss of functional OMP genes on adhesion and crawling.
figure 5

a Adhesion of the wild-type strain (WT) and mutants (Δ lenA and Δ ligA) of L. interrogans serovar Manilae to rat kidney cells. Percentiles (boxes) and the minimum and maximum values (whiskers) of the speed data set are shown as described in the legend of Fig. 3. b Crawling ability was evaluated by normalizing crawling speeds (vCR) by the free-swimming speed (vSW). vCR and vSW were averaged values of the speeds measured for individual bacteria (Supplementary Fig. S1). The error bars are the propagated errors yielded by calculations using average speeds and their standard errors (Supplementary Table S2 and Supplementary Note 1). The number of samples measured is shown in Supplementary Table S2.

The malfunction of LenA and LigA affected the swimming speed (Supplementary Note 1 and Fig. S1). The swimming speed is given by free cell rotation without interaction with surfaces (equivalent to v0 in the crawling model described later). We thus evaluated the crawling ability by normalizing the crawling speed vCR with the swimming speed vSW: vCR/vSW. The crawling ability of L. interrogans serovar Manilae on its reservoir’s cells (NRK) was facilitated by the LenA and LigA deficiency (Fig. 5). These results suggested that LenA and LigA could be involved in adhesion and crawling along with LPS and other unknown adhesins. LenA binds to the complement regulatory protein factor H, suggesting the contribution of the protein to immune evasion29. LigA has the ability to bind to fibrinogen and extracellular matrix proteins (e.g., collagen and laminin)31. The targeted repression of the ligA expression attenuated L. interrogans serovar Manilae, suggesting the significance of LigA as a virulence factor33. On MDCK cells, the crawling ability of lenA mutant was also enhanced, whereas few adherent and crawling cells were observed in the ligA mutant (Supplementary Note 1 and Fig. S2), suggesting that LigA might be a crucial adhesin for the leptospiral colonization to dogs.

Inverse correlation between adhesion and crawling

We examined the relationship between the Leptospira adhesivity and crawling ability vCR/vSW. Figure 6a shows an inverse correlation between adhesion and vCR/vSW. In agreement with Fig. 4b, leptospires tend to adhere more strongly to NRK cells, suppressing crawling.

Fig. 6: Association of crawling and cell rotation with adhesion.
figure 6

a Inverse correlation between crawling and adhesion. N and M represent NRK and MDCK, respectively. The solid line is the result of curve fitting. The correlation coefficient was −0.82. The error bars are the propagated errors yielded by calculations using average speeds and their standard errors (Supplementary Table S2 and Supplementary Note 1). Full names and the number of samples measured are shown in Supplementary Table S2. b The rotation rate of the leptospiral cell body during swimming (fSW) and crawling (fCR), calculated from the velocity and (v/λ)/f (0.2 and 1 for swimming and crawling, respectively13). The values of fCR/fSW are normalization of the burdened rotation speeds on the surface by those of free swimming.

When a bacterium is propelled at the velocity of v by the rotation of helical flagella or helical cell body with the wavelength of λ at the frequency of f, the conversion efficiency from the rotation to translation can be evaluated by (v/λ)/f. The value indicates the degree of slippery. For example, Vibrio alginolyticus shows (v/λ)/f 0.07, indicating that the bacterium migrates by only 7% of the flagellar wavelength upon one flagellar revolution34. We have shown that L. biflexa showed (v/λ)/f 0.2 when swimming and  1 when crawling (λ 0.6 μm)13. Using the reported values of (v/λ)/f and λ together with the speeds measured in this study (vSW and vCR), we predicted the cell body rotation rates during swimming (fSW) and crawling (fCR). In Fig. 6b, the host-bacteria pairs were arranged in order of adhesivity, showing an tendency of fCR/fSW increasing with the decrease in adhesivity. This suggests that the sluggish crawling speed can be attributed to the deceleration of the cell rotation due to the strong adhesion to kidney cells. From the aspect of pathogenicity, strong adhesivity of bacteria would be advantageous to be maintained in the host, while weak adherence enables bacteria to explore a wide range of the host tissue. For Leptospira spp., fast and diffusive crawling would gain a chance to penetrate the deeper side of the tissue10,18, while they have a risk of elimination by a flow of body fluid. These are likely to be a trade-off relationship that pathogenic bacteria are imposed, which is as well as physiological constraints observed between growth and survival35, and migration and colonization36.

Crawling model

We demonstrate Leptospira crawling using a simple two-state model (Fig. 7a)37,38. Crawling occurs through successive binding and detachment of adhesins against the host cells with rate constants kon for binding and koff for detachment. A bacterium has Nad adhesins in total. Note that the effective Nad, \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }\), is defined by the number of host receptors per bacterial length Nr: If NadNr, \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }={N}_{{{{{{{{\rm{ad}}}}}}}}}\); if Nad > Nr, \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }={N}_{{{{{{{{\rm{r}}}}}}}}}\). The bound adhesins are linked with the host cells via a spring with the spring constant κ, and koff depends on the extension of the spring x: \({k}_{{{{{{{{\rm{off}}}}}}}}}(x)={k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }\exp [\kappa x/\kappa l]\), where l represents the typical length at which the bound OMP is released38. The force balance of motion in low Reynolds numbers, where the inertia can be negligible, is described by \(F-\gamma {v}_{{{{{{{{\rm{CR}}}}}}}}}-\kappa \mathop{\sum }\nolimits_{i=1}^{{N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }}{x}_{i}=0\), where F is the propulsive force produced by a Leptospira bacterium, γ is the viscous drag coefficient, vCR is the crawling velocity, and xi is the spring extension of the ith adhesin. Therefore, \({v}_{{{{{{{{\rm{CR}}}}}}}}}=(F/\gamma )-(\kappa /\gamma )\mathop{\sum }\nolimits_{i=1}^{{N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }}{x}_{i}\). Scaling vCR by the velocity without bonds F/γ ( ≡ v0) yields \({v}_{{{{{{{{\rm{CR}}}}}}}}}/{v}_{{{{{{{{\rm{0}}}}}}}}}=1-(\kappa /F)\mathop{\sum }\nolimits_{i=1}^{{N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }}{x}_{i}\). Here we assumed that κ/F = 1 for qualitative discussion.

Fig. 7: Crawling model.
figure 7

a Two-state model for crawling. Adhesins (e.g., OMPs and LPS) bind to kidney cells via a spring. The release of the adhesin-surface bond depends on the spring extension (x) by the bacterial movement. b Qualitative prediction of the dependence of the fraction of bound adhesins on \({k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }/{k}_{{{{{{{{\rm{on}}}}}}}}}\). The inset shows accumulative displacements calculated by setting different values of \({k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }/{k}_{{{{{{{{\rm{on}}}}}}}}}\). The averages of 10 runs are shown. c The dependence of vCR/v0 on \({k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }/{k}_{{{{{{{{\rm{on}}}}}}}}}\). Based on the assumption of NadNr (i.e., \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }={N}_{{{{{{{{\rm{ad}}}}}}}}}\)), calculations were performed using \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }=\)1000 (gray), 2500 (red), or 5000 (blue). The averages of 10 runs are shown. d The upper schematic shows that a bacterium experiences a spatial change based on the density of host receptors (Nr). The lower panel demonstrates the change in the crawling speed with the variation of Nr. The simulations were performed using \({k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }/{k}_{{{{{{{{\rm{on}}}}}}}}}\)= 0.5 and 0.03 along with the temporal variation of Nr.

Our experiments suggested that excessive adherence of leptospires decreased the crawling speed. Moreover, the combination of leptospiral strains and host species affected adherence and crawling (Fig. 6). A plausible cause for these phenomena could be a difference in kinetic parameters by the bacterium-host combination. The two-state model assuming \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }={N}_{{{{{{{{\rm{ad}}}}}}}}}\) qualitatively demonstrated that an increment of \({k}_{{{{{{{{\rm{off}}}}}}}}}^{{\prime} }/{k}_{{{{{{{{\rm{on}}}}}}}}}\) decreased the fraction of the bound adhesins \({n}_{{{{{{{{\rm{on}}}}}}}}}/{N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }\) (Fig. 7b), affecting vCR/v0 anti-correlatively (Fig. 7c). L. interrogans serovar Manilae might be adapted to rats in terms of stronger adhesin binding to the ligands on the kidney cells. We also found that the reduced number of OMPs by gene knockout facilitated crawling (Fig. 5). The tendency was shown by the model in the \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }\) dependence of vCR/v0 (Fig. 7c). Given that Nr is likely not uniform in living cells and Nad can differ among bacteria, the bond strength acting on bacteria would accidentally change with locomotion (Fig. 7d, upper panel). This would be observed as speed fluctuation of crawling (Fig. 7d, lower panel). Spatial-temporal variation of \({N}_{{{{{{{{\rm{ad}}}}}}}}}^{{\prime} }\) may promote diversity in bacterial dynamics and ecology within the host body.

Quantitative modeling using practical values of parameters will be a subject for future studies. For example, the kinetic property of adhesins, assumed to be unity in the present model, is obviously diverse in the actual bacteria and host cell combinations32. κ and γ determine the relaxation time of the system by γ/κ. κ could be characterized by the interaction between bacterial adhesins and receptors on the host cells, whereas γ is governed by the environmental viscosity and bacterial morphology (especially size). Viscosity may differ according to bacterial habitat within the host body. Leptospires, which have a wide cell length range (~5 μm in the shortest and >20 μm in the longest), are observed in a population. Also, F is related to torque produced by the flagellar motor39,40. Although some of the values will be obtained as a fitting parameter, further model study should help determine the underlying physics of bacterial motility on surfaces.

Discussion

Adhesion is crucial for bacterial infection and pathogenicity, followed by invasion or toxin injection. For several motile bacteria, external flagella could have a role of adhesin, such as H2 and H6 of enteropathogenic E. coli (EPEC) and H7 of enterohemorrhagic E. coli (EHEC)41,42. Flagella-mediated adhesion of the genus Salmonella is serovar-dependent, which is essential for serovars Enteritidis and Dublin but not for serovar Typhimurium43. In this study, we showed that flagella-independent adhesion of Leptospira bacteria allows their movement on kidney cells. Our experiments using clinical isolates and OMP-deficient mutants showed an inverse correlation between bacterial adhesion and crawling. The responsibility of motility for virulence was reaffirmed by plotting the asymptomatic and severely symptomatic pairs data on the inverse correlation between adherence and crawling. In addition, a simple numerical analysis suggested the significance of bacterial adhesion for mobility in the bacteria–host interface. There is an enormous combination between pathogenic leptospires and host species, suggesting that the pathogenic mechanism includes a complicated battle between bacteria and hosts, which involves immune response and gene regulation. An abundance of proteins in the outer membrane of pathogenic leptospires have different adhesion affinities to host cell components32, and some of them, such as LigA examined in this study, show host-specific properties (Supplementary Fig. S2). Furthermore, although the present study focused on phenomena occurring a few hours after arrival at the organ, longer monitoring is needed for tangible discussions of pathogenesis and persistent infection in specific tissues. Identification of receptors on host cells involved in the adhesion and crawling of Leptospira spp. and their practical relevance to pathogenesis are future subjects.

None of our label-free experiments would have been successful without employing machine learning for motion analysis. Background subtraction has been a common process to detect intrusive objects in scene analysis of a surveillance system. We succeeded at introducing the computer vision technique to the in vitro bacterial infection assay, which can be applicable to diverse living cells in which probe labeling or genetic manipulations are difficult. In addition, the method will be useful for single molecule tracking to study membrane protein diffusion or turnover, which is generally difficult to detect due to low signal intensity, even if the target molecule is fluorescently labeled. There have been other methods developed to remove background noise from video data. In regard to their applications to infectious disease research, a method was developed to remove the background from video data of bacteria-derived scattering in patient biopsy by subtracting the minimum brightness on the time axis, the median brightness of all frames, and the local spatial background44. This method does not require cumbersome sample pretreatment and yet enables rapid diagnosis and antibiotic susceptibility testing over a wide range of bacterial concentrations. Thus, the background subtraction method is expected to contribute to diverse research aimed at elucidating the living system.

Methods

Bacteria and animal cells

Bacterial strains used in this study are listed in Supplementary Table S1. The Leptospira strains except L. interrogans serogroup Autumnalis strain D-SA11-5K were cultured in Ellinghausen-McCullough–Johnson–Harris (EMJH) liquid medium45 at 30 °C for 3–5 days; the Autumnalis strain was cultured in modified Korthof’s liquid medium46 at 30 °C for 3–5 days. E. coli β2163 was grown in LB medium supplemented with 0.3 mM diaminopimelate47. The mammalian kidney epithelial cell lines used were MDCK-NBL2 (dog) and NRK-52E (rat). Kidney cells were maintained in Eagle’s minimum essential medium (MEM) (Sigma-Aldrich, Darmstadt, Germany) for MDCK and Dulbecco’s modified Eagle’s medium (DMEM) (Thermo Fisher Scientific, MA, United States) for NRK containing 10% fetal bovine serum (Nacalai Tesque, Kyoto, Japan) and 1% antibiotic/antimycotic mixed solution (Nacalai Tesque) at 37 °C and 5% CO2.

Transposon insertion mutants

lenA::Tn and ligA::Tn mutants were obtained by random insertion mutagenesis of the L. interrogans strain UP-MMC-NIID using Himar1, which was conducted by conjugation with E. coli β2163 harboring pCjTKS2, as described previously48. After conjugation, cells were spread on a plate of EMJH agar (1.4% Bacto Agar, BD, USA) containing kanamycin at a final concentration of 25 μg/mL using glass beads (Bac’n’Roll Beads, Nippon Gene, Japan). The transposon insertion site was identified using semi-random PCR48 with some modifications: the concentration of primers for the first and second PCR was reduced to 0.2 μM. The transposon was inserted into 259 bp of the 738-bp lenA gene and 3154 bp of the 3675-bp ligA gene, respectively.

Expression and purification of recombinant GST/LenA fusion protein and production of anti-LenA serum

The DNA fragment corresponding to the amino acid position 27-241 of LenA from L. interrogans UP-MMC-NIID (WP_000809541) was amplified with PrimeSTAR GXL DNA polymerase (TaKaRa Bio) by using the upstream primer GSTSal-LenA-F (5'-CCCGGAATTCCCGGGTCAAGAAGCGCAGATCTTAGG-3') and the downstream primer GSTSal-LenA-R (5'-ATGCGGCCGCTCGAGTCCGAATTTTCCCGCAAGTG-3'). After an initial 1 min denaturation at 95 °C, the reaction mixture was subjected to 30 cycles of denaturation at 98 °C for 10 s, annealing at 55 °C for 15 s, and extension at 72 °C for 1 min. The PCR product was purified, and cloned into SalI-digested GST vector pGEX-6P-1 (Cytiva) by NEBuilder HiFi DNA Assembly cloning (New England BioLabs). To express the GST fusion protein, the plasmid was transformed into E. coli BL21. GST fusion protein expressed in E. coli BL21 was purified using glutathione Sepharose 4B (Cytiva) according to the supplier’s instruction. For the production of antiserum against LenA, 30 μg of purified GST/LenA fusion protein was subjected to SDS-PAGE, from which the corresponding band was excised. The excised gel was injected into a female mouse with complete Freund’s adjuvant and giving booster injections of the same amount of protein without adjuvant 2, 4, and 6 weeks later. The mouse was maintained at 23 ± 2 °C with 55 ± 5% humidity in a 12 h-light/12 h-dark cycle. The production of antiserum for LenA was approved by the animal research committee of National Institute of Infectious Diseases.

SDS-PAGE and immunoblotting experiments

About 1.5 × 108 cells of wild-type and lenA::Tn and ligA::Tn mutant cells suspended in SDS-PAGE sample buffer were subjected to SDS-PAGE and Western blotting. The blot was incubated with antisera raised against LenA described above and the C-terminal portion of LigA49. The dilutions of antisera were 500-fold and 1000-fold for anti-LenA and anti-LigA, respectively, and the secondary antibody, goat anti-mouse IgG (H+L)-HRP conjugate (Bio-Rad Labotatories, Inc.), was diluted at 1:25,000 (Supplementary Fig. S3).

Motility and adhesion assays

The cell density of the cultured leptospires were adjusted to 1 × 108 bacteria/mL (OD420 ~0.1) using cultured media (EMJH or Korthof’s medium). The bacterial suspension (20 μL) was infused to a chamber slide (SCS-N04, Matsunami Glass Ind., Ltd., Japan) where kidney cell monolayers were constructed as described previously16. After incubation for 15 min at 23 °C, Leptospira cells were observed using a dark-field microscope (BX53, × 40 UPlanFL N, × 5 relay lens, Olympus, Tokyo, Japan) and recorded using a CCD camera (WAT- 910HX, Watec Co., Yamagata, Japan) at a frame rate of 30 Hz. The number of bacteria attached to the kidney cells were counted, and then swimming cells in liquid phase and crawling cells on kidney cells were measured using the image analytical program written in-house with Python.

Background subtraction

The background model estimation method was based on ref. 20 with some modifications. Assuming a statistical model representing the background image (BG) without intrusive objects, we determined the appearance of masses of pixels that deviated from the modeled BG as intrusive foreground objects (FG).

Consider a single pixel value in grayscale x(t) at time t and a training set HT = {x(t),   , x(tT)} at time interval T. Given that the data set could possibly contain values corresponding to not only BG but also FG, the estimated probability density function from HT is denoted as \(\hat{p}({x}^{(t)}| {H}_{T},BG+FG)\). Such pixel value distribution comprising multiple components can be modeled using multi-peak Gaussian (GMM):

$$\hat{p}(x| {H}_{T},\, BG+FG)=\mathop{\sum }\limits_{m=1}^{M}{\hat{\pi }}_{m}{{{{{{{\mathcal{N}}}}}}}}(x;{\hat{\mu }}_{m},{\hat{\sigma }}_{m}^{2}),$$
(1)

where m is the number of each component in the order of the weighting parameter \({\hat{\pi }}_{m}\) (\(\mathop{\sum }\nolimits_{m=1}^{M}{\hat{\pi }}_{m}=1\)), M is the total number of components (i.e., m = 1 ~ M), and \({\hat{\mu }}_{m}\) and \({\hat{\sigma }}_{m}^{2}\) are the estimated values of the mean and variance, respectively. A new pixel value obtained at time t + 1, x(t+1), was classified based on the Mahalanobis distance, and GMM parameters are updated using the following equations (Fig. 2c, d):

$${\hat{\pi }}_{m}\leftarrow {\hat{\pi }}_{m}+\alpha ({o}_{m}^{(t)}-{\hat{\pi }}_{m})-\alpha {c}_{T},$$
(2)
$${\hat{\mu }}_{m}\leftarrow {\hat{\mu }}_{m}+{o}_{m}^{(t)}(\alpha /{\hat{\pi }}_{m}){\delta }_{m},$$
(3)
$${\hat{\sigma }}_{m}^{2}\leftarrow {\hat{\sigma }}_{m}^{2}+{o}_{m}^{(t)}(\alpha /{\hat{\pi }}_{m})({\delta }_{m}^{2}-{\hat{\sigma }}_{m}^{2}).$$
(4)

In short, the distribution at time t + 1 is predicted based on a set of images obtained before t. Repeating data acquisition and parameter estimation corresponds to learning a model for the scene. The decay parameter α(=0.001) affects the detection performance of bacteria. The background subtraction method recognizes a moving foreground against a static background. α is one of the parameters that determine the ‘time limit’ for being recognized as the foreground: If a bacterium remains immobile longer than the time limit, it is recognized as background, which is the limitation of this analysis (Supplementary Note 2 and and Supplementary Fig. S4). δm is the Euclidian distance from the mean of the cluster m (\(=\! {x}^{(t)}-{\hat{\mu }}_{m}\)). \({o}_{m}^{(t)}\) determines the cluster where the new data is classified by setting \({o}_{m}^{(t)}=1\) for the closest cluster and \({o}_{m}^{(t)}=0\) for others. When the new data does not belong to any existing cluster, a new cluster m = M + 1 is generated with \({\hat{\pi }}_{M+1}=\alpha\), \({\hat{\mu }}_{M+1}={x}^{(t)}\), and \({\hat{\sigma }}_{M+1}={\sigma }_{0}\). Equation (2) was obtained using MAP estimation20. MAP P(πn) is determined by a likelihood function P(nπ) and a prior distribution P(π) as follows:

$$\arg \mathop{\max }\limits_{{{{{{{{\boldsymbol{\pi }}}}}}}}}P({{{{{{{\boldsymbol{\pi }}}}}}}}| {{{{{{{\bf{n}}}}}}}})=\arg \mathop{\max }\limits_{{{{{{{{\boldsymbol{\pi }}}}}}}}}P({{{{{{{\bf{n}}}}}}}}| {{{{{{{\boldsymbol{\pi }}}}}}}})P({{{{{{{\boldsymbol{\pi }}}}}}}}),$$
(5)

where \({{{{{{{\bf{n}}}}}}}}=\left\{{{{{{{{{\bf{n}}}}}}}}}_{{{{{{{{\rm{1}}}}}}}}},{{{{{{{{\bf{n}}}}}}}}}_{2},\cdots \,,{{{{{{{{\bf{n}}}}}}}}}_{{{{{{{{\rm{T}}}}}}}}}\right\}\,\)\(({{{{{{{{\bf{n}}}}}}}}}_{{{{{{{{\rm{t}}}}}}}}}=\{{o}_{1}^{(t)},{o}_{2}^{(t)},\cdots \,,{o}_{M}^{(t)}\})\) indicates to which of the m components the t-th data belongs. For example, the Mahalanobis distance determined the classification of the t-th data to m = 1, \({o}_{1}^{(t)}=1\) and \({o}_{2 \sim M}^{(t)}=0\) as described above. P(nπ) was a multinominal distribution:

$$P({{{{{{{\bf{n}}}}}}}}| {{{{{{{\boldsymbol{\pi }}}}}}}})=\mathop{\prod }\limits_{i=1}^{T}\frac{1!}{\mathop{\prod }\nolimits_{m=1}^{M}{o}_{m}^{(i)}!}\mathop{\prod }\limits_{m=1}^{M}{\hat{\pi }}_{m}^{{o}_{m}^{(i)}}.$$
(6)

Therefore, the Dirichlet distribution was set as P(π):

$$P({{{{{{{\boldsymbol{\pi }}}}}}}})=\frac{1}{Z}\mathop{\prod }\limits_{m=1}^{M}{\hat{\pi }}_{m}^{{c}_{m}},$$
(7)

where Z is the beta function. The hyperparameter cm was set in the range of − 1 < cm < 0, assuming GMM comprising the dominant component with large \({\hat{\pi }}_{m}\) (i.e., BG signal from cultured cells) and the other minor components with small \({\hat{\pi }}_{m}\) (i.e., FG signal mainly from bacteria) (Supplementary Note 3 and Supplementary Fig. S5). In Eq. (2), cT = − cm/T.

Extraction of the targeted segments

Following the background subtraction processed by the pixels, the masses of pixels (segments) expected to be bacteria were extracted from the binarized images. First, dotted holes were filled by the dilation process, and then noise objects were removed using the erosion process. Next, the segments were screened according to area and aspect ratio based on the bacterial size (5–20 μm in length and ~150 nm in width). The aspect ratio was determined by ellipse fitting, and segments with <2 were excluded from the tracking objects. Migration velocities determined by the background subtraction method developed in this study were consistent with the results obtained by a conventional method, and the robustness of the present method against image quality (contrast and noise) was verified (Supplementary Note 4 and Supplementary Fig. S6).

When bacterial density is high, the overlapping of bacteria increases, and images at the moment of overlap are excluded by Step 4 of Fig. 2. Since the present study targets moving bacteria, the bacterial overlapping is temporary, and thus the tracking data before and after the overlap can be used for the measurement of motility. However, if the density of bacteria is extremely high and they are moving very slowly (the overlapping time is longer than the time limit discussed in Supplementary Fig. S4), the overlapping area could be recognized as background and excluded from the target of measurement. This problem did not occur under the present experimental condition (~1 × 108 bacteria/mL), but care should be taken in experiments using high bacterial densities.

Tracking of bacteria

Data set of object centroids obtained by ellipse fitting were compared to associate the same objects between frames. Consider consecutive frames k containing m objects and k + 1 containing n objects, having a data set of centroids ak,n = (xk,n, yk,n) and ak+1,m = (xk+1,m, yk+1,m), respectively. Calculating the square of distance ak,n − ak+1,m2 for n × m pairs, identifying the closest pair as the same bacteria. Swimming and crawling speeds and MSD were obtained from locomotion trajectories of individual bacteria. Speeds were determined by line fitting to accumulative displacements of the bacterial centroids.

Simulation

\(\mathop{\sum }\nolimits_{i=1}^{N}{x}_{i}\) at the (j + 1)th event was stochastically given by determining the bound or unbound state for individual adhesins (i = 1 ~ N) at the jth. Random numbers were generated for each adhesin, and whether the bound adhesin at j gets to the unbound state at j + 1 and vice versa was determined based on kon and koff(x). koff of xi,j depends on vCR at j.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.