Skip to main content
Microbiome logoLink to Microbiome
. 2026 Jan 26;14:50. doi: 10.1186/s40168-025-02297-2

Plasmids as persistent genetic reservoirs of bacterial defense systems in wastewater treatment

Haotian Zheng 1, Leighton Payne 1, Wanli He 1, Mario Rodríguez Mestre 1, Lili Yang 1, Arnaud Dechesne 2, Rafael Pinilla-Redondo 1, Joseph Nesme 1, Søren J Sørensen 1,
PMCID: PMC12853721  PMID: 41588461

Abstract

Background

Bacterial antiphage defense systems play essential roles in microbial ecology, yet their dynamics within urban wastewater systems (UWS) remain poorly characterized.

Results

In this study, we performed comprehensive metagenomic and plasmidome analyses on 78 wastewater samples collected during two seasons and four sampling points across UWS from three European countries. We observed a significant reduction in the abundance, diversity, and mobility potential of defense systems during biological treatment. However, these reductions were not directly correlated with changes in microbial abundance. Defense systems were significantly enriched on plasmids, particularly conjugative plasmids, where their gene density was approximately twice as high as on chromosomes and remained relatively stable across compartments. In contrast to chromosomal defense systems, plasmid-borne systems exhibited more frequent co-localization with a wide range of mobile genetic elements (MGEs)-associated genes, thereby facilitating multilayered dissemination networks. Furthermore, we detected a strong correlation between phage abundance and host defense system profiles, indicating ongoing phage-host co-evolutionary dynamics in these environments.

Conclusions

In summary, our results demonstrate that UWS reduce the abundance and diversity of bacterial defense system genes. However, plasmid-associated defense systems can persist through shared mobile genetic reservoirs. These findings underscore the critical role of plasmids in bacterial immunity and provide new insights into defense system dynamics within urban wastewater environments.

Graphical Abstract

graphic file with name 40168_2025_2297_Figa_HTML.jpg

Supplementary Information

The online version contains supplementary material available at 10.1186/s40168-025-02297-2.

Keywords: Antiphage defense systems, Plasmid, Wastewater, Metagenome, Plasmidome

Background

Antimicrobial resistance (AMR) is a pressing global health concern, driven largely by the dissemination of resistance genes among bacteria through horizontal gene transfer (HGT) [66, 74]. In response, phage therapy has gained renewed attention as a viable alternative to traditional antibiotics. This approach uses bacteriophages, viruses that specifically infect bacteria, which can be isolated, pre-adapted, or engineered to target antimicrobial resistant pathogens [38, 62]. However, the efficacy of phage therapy is challenged by the intrinsic ability of bacteria to defend against phage infection [68]. Throughout billions of years of coevolution with bacteriophages, bacteria have evolved a diverse arsenal of antiphage defense systems, including both innate and adaptive immune strategies [42] such as restriction-modification (RM) [4] and CRISPR-Cas systems [6, 41, 44], respectively. In response to this selective pressure, phages have evolved diverse inhibitors of bacterial immune systems, so-called anti-defense proteins [43].

Plasmids are self-replicating mobile genetic elements [27] that play a pivotal role in mediating the horizontal gene transfer among bacteria, facilitating the spread of adaptive traits across bacterial communities [55], including antibiotic resistance. However, little is known about their contribution to the exchange of antiphage defense systems beyond CRISPR-Cas [51]. Therefore, understanding the distribution and mobility of these defense systems in natural microbial ecosystems is essential for optimizing phage therapy strategies. Although recent studies have shown that defense systems are widely distributed across diverse environments, including soil, oceans, and the human gut [8], the diversity and dynamics of these systems in urban microbial communities, particularly among clinically relevant pathogens, remain underexplored.

Urban wastewater systems (UWS) serve as hubs connecting residential and hospital wastewater and receive large amounts of pathogens, plasmids, viruses, and bacteria [76]. Thus, studying the spread of defense systems in wastewater provides an excellent window for observing the microbial gene pool of entire urban populations, reflecting the collective gene pool shaped by human-associated microbiomes. Due to the typically high-density characteristics of microbial communities in UWS, these facilities are often considered hotspots for the spread of antimicrobial resistance [72]. However, their potential role in promoting the spread of defense systems has yet to be thoroughly investigated.

The rapid development of sequencing technologies has provided powerful tools for research in this field: metagenomic sequencing can quantify genes in wastewater samples, providing information on bacterial community composition and plasmid distribution [59].

Metamobilome or plasmidome sequencing specifically extracts and sequences plasmid DNA from environmental samples [13, 37], thus facilitating the exploration of plasmids in the environment [20], which is crucial for assessing gene transfer between bacteria [63]. The analysis of large amounts of sequencing data has facilitated the development and refinement of bioinformatics tools designed to identify and annotate prokaryotic defense systems in genome data [48, 58, 67] and defense system databases, laying the foundation for our comprehensive understanding of diverse defense systems.

To address these critical knowledge gaps, this study presents the first comprehensive investigation of bacterial defense system dynamics across urban wastewater treatment processes. By integrating metagenomic and plasmidome analyses of 78 samples collected from four connected key compartments of urban wastewater systems in three European countries (Spain, UK, and Denmark) and two seasons: residential sewers, hospital sewers, treatment plant inlet, and biological treatment basin, we aimed to elucidate how wastewater conveyance and treatment processes influence the abundance and diversity of defense systems and the underlying impact on specific mechanisms of horizontal gene dissemination. Our findings reveal that while biological treatment reduces defense system abundance and diversity and alters microbial community composition, plasmids serve as persistent genetic reservoirs with the capacity to maintain and facilitate horizontal dissemination of these crucial immunity genes across bacterial communities. We further explored the dissemination patterns of plasmid-borne defense systems and demonstrated ongoing phage-host co-evolutionary dynamics that shape anti-defense strategies in these environments. This work provides critical insights into the fate of bacterial immune functions across UWS, particularly highlighting the pivotal role of plasmids as mobile genetic reservoirs, and has important implications for understanding microbial community resilience and informing phage therapy applications in both clinical and environmental contexts.

Methods

Sample collection

This study builds on a previously described standardized sampling campaign across three comparable urban wastewater systems (UWS) located in Odense, Denmark; Santiago de Compostela, Spain; and County Durham, UK. A detailed description of the sampling design, protocols, and wastewater pipeline configurations is available in the original studies [36, 77].

In each UWS, four key compartments were sampled: hospital sewage (HS), residential sewage (RS), mixed sewage at the inlet of municipal sewage treatment plant (MS, representing a mixture of hospital and residential wastewater), and biological treatment process (BTP). Notably, the biological treatment technologies employed varied slightly across the three countries. In Denmark and Spain, activated sludge systems—also referred to as biological treatment basins (BTB)—were employed, relying on suspended microbial growth and aeration to enhance the removal of organic matter and nutrients. In contrast, the UK facility utilized biological treatment filters (BTF), in which microbial activity occurs on fixed biofilms attached to filter media, facilitating both physical filtration and biological degradation.

Sampling was conducted in winter and summer of 2018. Denmark and the UK employed ISCO automatic samplers for 24-h flow-proportional sampling, while Spain used 24-h time-proportional sampling. Hospital sewage in Denmark was collected from two separate pipelines serving different wards, whereas the UK and Spain sampled from single hospital pipelines. All sites were sampled over three consecutive dry-weather days in each season, resulting in a total of 78 samples (30 from Denmark, 24 from Spain, and 24 from the UK). All samples and their corresponding grouping information are documented in Table S1, and an overview of the treatment flow and sampling strategy is provided in Supplementary Fig. S1.

DNA extraction, PCR amplification, and sequencing

Upon collection, samples were immediately placed on ice to minimize microbial activity during transport. In the laboratory, 100 mL of each sample was centrifuged at 10,000 × g for 8 min at 4 °C. The supernatant was discarded, and the resulting pellet was resuspended in 20% glycerol to a final volume of 10 mL. Samples were then stored at −80 °C for long-term preservation.

To specifically extract plasmid DNA, samples were filtered, vortexed, and sonicated, followed by resuspension in the TE buffer. Lysis was performed using a cocktail of lysozyme, mutanolysin, and lysostaphin to disrupt gram-positive cell walls, followed by alkaline lysis plasmid preparation and treatment with plasmid-safe DNase to enrich plasmid DNA. Sample processing, including DNA extraction and circular element enrichment, was performed as previously described [36].

Both total DNA and purified plasmid DNA that passed quality control were used to construct sequencing libraries using Nextera XT Library Prep Kit (Illumina, San Diego, CA, USA). High-throughput sequencing data were generated using the Illumina NextSeq platform and v2.5 kit (Illumina, San Diego, CA, USA) [77].

Quality control and assembly

The raw sequencing data generated in this study were also used for a separate analysis described in a companion paper [29]. The preprocessing of raw metagenomic and plasmidomic data was executed using the Plaspline workflow [77]. Initial quality assessment of raw sequences was conducted using FastQC (v 0.11.9) [69]. Subsequently, sequence preprocessing was performed using the BBduk from BBMap (v 35.85) [15]. This step encompassed the removal of genomic contamination and adapter sequences utilizing stringent parameters (ktrim = r k = 23 mink = 11 hdist = 1). Quality control measures included implementing a quality threshold of 15, establishing a minimum sequence length of 50 bp, and performing sequence trimming with specified parameters (qtrim = r trimq = 10 minlen = 60 ftr = 139).

The preprocessed sequences were then subjected to de novo assembly using the metagenomic-specific algorithm (metaspades.py) of SPAdes (v 3.15.0) [54]. The assembly process employed automatic k-mer size optimization parameters to generate high-quality contigs. Assembly parameters were configured to ensure robust contig generation, with a minimum contig length threshold of 200 bp and a k-mer range of 21–141.

Post-assembly processing involved contig filtration using BBMap with stringent quality parameters to eliminate short sequences and reduce sequence redundancy, thereby enhancing the overall quality of the assembled dataset. Specifically, contigs < 1000 bp were removed (minscaf = 1000) and sorted by length (sort = length). To remove redundancy, clustering required 90% identity (minidentity = 90) and 90% length coverage (minlengthpercent = 90).

Chromosome, plasmid, and phage contig classification

We integrated two complementary pipelines to identify and validate plasmid sequences from metagenomic and plasmidome assembled contigs and from classified chromosome, plasmid, and phage sequences. Initially, Plaspline was used for preliminary plasmid sequence identification, incorporating three complementary methods: sequence similarity-based Platon (v 1.7) [61] (https://github.com/oschwengers/platon) (using default parameters); graph-based SCAPP (v 0.1.1) [49] (https://github.com/Shamir-Lab/SCAPP), which applies an iterative peeling algorithm guided by plasmid-specific gene annotations and a logistic regression-based classifier (PlasClass), was run with default parameters; and random forest-based PlasForest (v 1.4) [53] (https://github.com/leaemiliepradier/PlasForest) with a default threshold parameter of 0.5.

Subsequently, PlasmidVerify [3] (https://github.com/ablab/plasmidVerify) was used to validate potential plasmid sequences based on gene content and functional domain profiles. To ensure accurate classification of all contig sequences, we utilized geNomad’s (v 1.8.0) [16, 17] (https://github.com/apcamargo/genomad) end-to-end model and default database to categorize sequences as chromosomal, plasmid, or phage-derived.

We classified sequences from both metagenome and plasmidome assemblies using a priority rule (Fig. S2). First, phages were identified from metagenomes via geNomad. Second, plasmids were defined as the union of sequences identified by either geNomad or Plaspline (v 1.4.1) from both assemblies. Finally, the remaining metagenomic sequences explicitly classified as “chromosomal” by geNomad were retained.

MMseqs2 (v 15.6f452) [65] was used for sequence clustering of contigs to enhance analysis accuracy and reduce redundancy. To optimize clustering accuracy, we implemented the following parameters: easy cluster mode with an identity threshold of 0.9, coverage threshold of 0.9, coverage mode 1, and cluster mode 2. Figure S2 provides a comprehensive workflow detailing all raw reads processing and contig classification steps.

Identification of defense genes, anti-defense genes, and MGE-associated genes

Following the acquisition of non-redundant contig sequences, we conducted comprehensive gene annotation and analysis. Initially, open reading frames (ORFs) were predicted using Prodigal (v 2.6.3) [30] (https://github.com/hyattpd/Prodigal) with default parameters. The predicted ORFs were subsequently processed for identification of defense systems using a combination of PADLOC (v1.4.0) [48] (https://github.com/padlocbio/padloc) with PADLOC-DB (v2.0.0), DefenseFinder (v 2.0.0) [67] (https://github.com/mdmparis/defense-finder) with defense-finder-models (v2.0.2), and CRISPRCasTyper (v 1.8) [58] (https://github.com/Russel88/CRISPRCasTyper). Results from these tools were merged based on operon structure to obtain a unified defense system annotation. Putative defense systems identified by PADLOC “PDC,” “DMS,” or “_other” models were classified as defense candidates as they are either unvalidated or incomplete systems. HEC-01 and HEC-09 were treated similarly.

For anti-defense gene annotation, we used three complementary approaches. The first approach involved sequence similarity searches against the anti-prokaryotic immune systems (APIS) database [75] (https://bcb.unl.edu/dbAPIS/), which encompasses experimentally validated viral proteins that counter prokaryotic immune systems and their associated protein families. These searches were conducted using DIAMOND [14] blastp (v 2.0.8) (parameters: -e 1e-10 --id 30) and HMMER (v 3.4) [23] (parameters: -E 1e-10). The second approach utilized reference sequence comparison, incorporating viral anti-defense protein sequences documented by [43] in their review. A total of 36 protein sequences were retrieved from NCBI, used to construct a DIAMOND database, and performed BLASTp searches against our viral protein set (v2.0.8, parameters: -e 1e-10 --id 30). The third approach utilized DefenseFinder (v 2.0.0) together with its internal database defense-finder-models (v 2.0.2) to predict viral anti-defense genes. The final anti-defense gene set was curated by removing redundancies among the results from all three approaches, prioritizing hits with the lowest E-values.

MGE-associated genes were identified by scanning proteins in contigs using hidden Markov model (HMM) algorithms via hmmscan in HMMER (v 3.4) against a manually merged database combining the proMGE database (v 1.0) [33] (https://promge.embl.de/) and MGEfams database (v 0.5) [28] (https://github.com/emblab-westlake/MGEfams). We employed a “-cut_ga” threshold with a significant hit E-value threshold of 1e-5. For ORFs with multiple hits, only the lowest E-value match was retained, ensuring each protein was represented by its most significant domain. The identified genes were subsequently categorized into six major categories: Conjugative, transposase, recombinase, integrase, resolvase, and mobilization.

The details of the gene annotation pipeline can be found in Supplementary Fig. S3.

Taxonomy annotation

For the taxonomic classification of chromosomal contigs, we constructed a custom Kraken2 (v 2.1.3) [73] database from GTDB Release 214 [45] (https://gtdb.ecogenomic.org/). To facilitate integration with certain analyses, particularly those involving the PLSDB (v 31_5_2024) [60] (https://ccb-microbe.cs.uni-saarland.de/plsdb2025), we developed a mapping table between GTDB and NCBI taxonomic systems using the metadata from GTDB Release 214.

Plasmid features and phage taxonomy classification

Plasmid replicon family, relaxase type, mate-pair formation type, and predicted transferability were predicted using the MOB-typer module of MOB-suite (v 2.0.1) [56] with minimum identity threshold of 80% and coverage threshold of 60%. Bacteriophage taxonomic classification was performed using PhaGCN2.0 (v 2.3.0) [31] with default parameters.

Plasmid and phage host prediction

To predict plasmid hosts, we conducted sequence similarity analyses between our plasmids and two databases: PLSDB (v 31_5_2024) [60] and IMGPR database (v 8_8_2023) [16, 17]. Following the methodology described by Acman [1], genomic similarities were estimated using Jaccard index (JI) calculations based on shared 21-bp k-mers, with a minimum JI threshold of 0.3. JI values were computed using Bindash (v 1.0) [79]. At the NCBI species level, all unique matches were recorded as potential transfer hosts for each plasmid. Despite the extensive coverage provided by these plasmid databases, to mitigate potential bias, we supplemented our analysis by downloading all bacterial representatives from GTDB, extracting and predicting their plasmid sequences to achieve more comprehensive host predictions.

For bacteriophage host prediction, we implemented the iPHoP pipeline (v 1.3.3) [57], using a database constructed from 3813 prokaryotic MAGs identified in the iPHoP_db_Aug23_rw. The pipeline employs a multifaceted approach to host prediction, incorporating both sequence homology analysis through Blastn (v 2.12.0) [2] for viral genome alignment against the iPHoP_db_Aug23_rw database and its CRISPR spacer database, as well as k-mer compositional similarity analysis between viral and host genomes. The latter was accomplished using four complementary methods: RaFAH (v 0.3) [18], WIsH (v 1.0) [52], VirHostMatcher-Net [71], and PHP [71]. To enhance prediction accuracy, particularly for alleles identified with CRISPR-Cas systems, we employed CRISPRCasFinder (v 4.2.21) [19] to identify CRISPR arrays flanking Cas genes. Extracted spacers exceeding 25 base pairs were subjected to local alignment against viral genomes using Blastn, with high-confidence matches defined as alignments achieving 100% coverage with no more than two mismatches.

Calculation of gene abundance and gene density

To quantify defense system gene abundance, we used bwa-mem (v 0.7.17) [34] and mapped quality-controlled (QC) reads to a nonredundant contig catalog, clustered using MMseqs2 (v15.6f452) with --easy-cluster, --min-seq-id 0.9, -c 0.9, -cov-mode 1, and --cluster-mode 2 to reduce redundancy and improve accuracy. SAMtools (v 1.9) [35] was used for SAM to BAM format conversion. The abundance values in the metagenome were normalized using transcripts per kilobase million (TPM) to account for inter-sample sequencing depth variations and reference observation probability.

Individual gene abundance was calibrated based on the abundance of its hosting contig, with the total gene abundance calculated as the sum of abundances across all nonredundant contigs containing the gene. The TPM calculation is defined by Eq. 1:

TPMi=ReadCountsiContigLengthij=1MReadCountsiContigLengthi×106 1

where i represents the i-th contig, j serves as the index for each contig in the sample, and M denotes the total number of contigs. This methodology ensures that the relative abundance calculations for different contigs within a sample are independent of sequencing depth.

Gene density, expressing the frequency of gene occurrence per million genome base pairs, is calculated according to Eq. 2:

GeneiDensity(gc/Gb)=1mAlignmentend-AlignmentstartLengthreference(bp)1nLengthread(bp)/109bp/Gp 2

where i denotes the i-th gene, m represents the total number of reads mapping to the reference gene, and n indicates the total number of reads in the sample. This calculation involves summing the mapping coverage of all reads to the reference gene, normalizing by the reference gene length, and dividing by the total number of quality-controlled bases in the sample, ultimately standardized to gene copies per gigabase (Gb).

Statistical analysis

All statistical analyses and data visualizations were implemented using Python (v 3.11.8) and R (v.3.5.2). Species richness analysis of defense systems was computed using the vegan package (v 2.6.4) [21] in R. Alpha diversity was evaluated using observed and rarefied richness (number of defense system subtypes), Pielou’s evenness index (J′), Shannon index (log base 2), and Simpson index. The relationships between gene abundance, diversity, and species were assessed using Spearman’s rank correlation coefficient, while correlation modeling employed linear and multiple linear regression models (implemented through the lm function in R). Statistical significance was set at P ≤ 0.05, with significant correlations defined as correlation coefficients ≤ −0.8 or ≥ 0.8 and FDR-adjusted P ≤ 0.05. Community structure differences were analyzed using nonmetric multidimensional scaling (NMDS) based on Bray–Curtis distances of defense system gene abundances across samples. Inter-group differences were evaluated through pairwise comparisons using permutational multivariate analysis of variance (PERMANOVA), followed by two-way ANOVA with Šídák’s multiple comparison test, implemented via the rstatix package (v 0.7.2). Co-localization analysis of defense systems and MGE-associated genes was performed using the CooccurrenceAffinity (v 1.0) [40] package, with filtering criteria set for gene pairs occurring together more than 10 times and individually more than 20 times, selecting results with maximum likelihood estimation α-values greater than 2 for subsequent analysis. All statistical tests were conducted at a significance level of 0.05, with P-values adjusted for multiple comparisons using the Bonferroni correction method. A complete summary of all statistical test results is provided in Supplementary Table S2.

For data visualization, donut charts were generated using the ChiPlot (https://www.chiplot.online/) online platform. Stack plots, box plots, violin plots, heatmaps, and Venn diagrams were created using the ggplot2 package (v 3.5.1) [70] in R. Chord diagrams were constructed using the circlize package (v 0.4.16) [26]. Gene alignment analysis and gene map visualization were performed using the clinker tool (v 0.0.31) [25]. Network construction and visualization were done in Gephi (v 0.10.1) [7], with network layouts optimized using the Fruchterman-Reingold algorithm. In network visualizations, node sizes were proportionally mapped to degree centrality, while edge thicknesses reflected correlation strength.

Results

Sample collection and dataset overview

In this study, we analyzed 78 UWS samples classified according to three different grouping schemes (Fig. 1a): compartment (hospital sewer [HS], residential sewer [RS], mixed sewer [MS], and biological treatment process [BTP]), country (Denmark [DK], Spain [SP], and United Kingdom [UK]), and season (winter and summer). The UWS begins with hospital and residential sewage being collected separately and then mixing together before entering wastewater treatment plants for processing.

Fig. 1.

Fig. 1

Defense systems distribution and diversity in UWS across three European countries. a Schematic illustration of four compartments: hospital sewer (HS), residential sewer (RS), mixed sewer (MS), and biological treatment process (BTP), across three countries: Denmark (DK), Spain (SP), and the United Kingdom (UK) and two seasons: summer and winter. b Donut charts display the composition and classification of defense systems. The left chart shows the proportion of verified and candidate systems. The top right and bottom right charts represent the subtype composition of verified and candidate defense systems, respectively. c Venn diagrams illustrate the overlap and specificity of defense systems across genomic locations (chromosome and plasmid), countries (DK, SP, and UK), and compartments (HS, RS, MS, and BTP). Percentages in the Venn diagrams represent the proportion of defense subtypes in each category, while those by arrows denote their relative abundance among all defense systems. d Boxplots show the distribution of defense system alpha-diversity indices (rarefied richness and Pielou’s evenness J′) and abundance in chromosomes (upper panels) and plasmids (lower panels) across different compartments in DK, SP, and UK. e The stacked bar chart shows the average relative abundance of defense systems across three different countries with four different compartments. f Nonmetric multidimensional scaling (NMDS) of Bray–Curtis distances reveals the β-diversity structure of defense system composition among samples. Arrows indicate major defense subtypes correlated with the ordination axes. The stacked bar chart besides shows the independent explained variance of defense system composition by season, country, and compartment

Bioinformatic analysis of the metagenomic and plasmidome datasets from these samples yielded 8,871,614 high-quality contigs, of which 3,202,363 were unique. These comprised 3,065,959 chromosomal contigs, 83,919 plasmid contigs, and 52,485 phage contigs. A comparison of our metagenome and plasmidome assemblies validated our dual approach, confirming they capture complementary subsets: the plasmidome preferentially recovered smaller plasmids (3995), while the metagenome reconstructed larger ones (1987), with minimal overlap (583 plasmids; Fig. S4). The distribution of contigs varied across regions, with DK, SP, and UK contributing 41%, 33%, and 26% of the sequences, respectively. When analyzed by compartment, HS contributed 31% contigs, RS 19% contigs, MS 14% contigs, and BTP 36% contigs. Summary statistics of contig classification and annotation results are provided in Supplementary Table S3.

High diversity and widespread distribution of defense systems in urban wastewater

Based on protein sequence homology searches, we identified 233,135 defense system genes across all samples, which were further classified into 371 distinct types and 497 subtypes, including 162 different defense candidates (Tables S4 and S5). Candidate systems include “_other,” “DMS,” “PDC,” HEC-01, and HEC-09 models from PADLOC [47], as these are candidate defense systems or systems lacking key components. Among the experimentally verified defense system families, RM type II (15%), SoFic (11%), RM type I (8%), and PD-T4-6 (7%) showed the highest abundance (Fig. 1b). For candidate defense systems, PDC-S01 (14%), PDC-S02 (12%), and PDC-S05 (11%) were the most prevalent. The defense systems were categorized into four major functional groups: Degradation of foreign nucleic acids (65%), population-level protection (29%), inhibition of DNA and RNA synthesis (4%), and others (2%). Verified defense systems dominated (58%), but candidate systems still accounted for 42% (Fig. 1b), suggesting that there is a substantial reservoir of novel and uncharacterized defense systems in the UWS. The distribution analysis of defense system subtypes across countries, compartments, and genome locations revealed a high degree of commonality (Fig. 1c). Specifically, 75% of defense system subtypes were present on both chromosomes and plasmids, with these shared subtypes accounting for 99% of the total defense system abundance. Only 21% of subtypes were exclusively chromosomal (Table S6). Similarly, defense system subtypes showed high conservation across countries and wastewater compartments, with location-specific or compartment-specific subtypes representing relatively low abundances, suggesting a relatively uniform distribution of defense system types in urban wastewater.

Significant reduction and compositional shifts of defense systems in BTP

We further explored how the abundance and diversity of bacteria defense systems vary throughout the wastewater system. Overall, we observed a general decline in defense system abundance and diversity from sewage collection points (HS, RS, MS) to samples collected from BTP compartments (Fig. 1d). This pattern was particularly evident in countries using biological treatment basins (BTB, activated sludge systems; DK and SP) compared to those using biological treatment filters (BTF; UK), (Kruskal–Wallis tests; richness: chi-square (2) = 11.80, p = 0.003; evenness: chi-square (2) = 12.12, p = 0.002; abundance: chi-square (2) = 12.32, p = 0.002). For chromosomal defense systems in BTB-equipped facilities, richness, evenness, and abundance all showed marked reductions in the BTP environment compared to all sewage compartments (Wilcoxon tests; p < 0.001). This simultaneous reduction suggests not only a loss of subtype diversity but also increasing dominance of a few specific systems—possibly reflecting genetic hitchhiking with bacteria hosts that are selectively retained through the treatment process, a hypothesis further examined in subsequent sections by comparing plasmid- and chromosome-associated defense systems. In contrast, plasmid-borne defense systems exhibited a distinct trend. While both abundance and richness of plasmid-borne defenses declined in DK and SP samples during BTP (Wilcoxon tests, p < 0.001), evenness remained unchanged (Wilcoxon tests, p > 0.05). This suggests that although the types of defense systems retained by plasmids are reduced, their relative abundances become more balanced. PERMANOVA (Adonis) analysis further supported these observations. HS, RS, and MS samples displayed similar defense system compositions (R2 = 0.092–0.13, p < 0.001), whereas BTP samples showed significantly different compositions (R2 = 0.29–0.32, p < 0.001). These results indicate that biological treatment not only reduces overall abundance but also reshapes the compositional structure of bacterial defense systems. Notably, while many defense systems were depleted in BTP samples, the PD-T4-6 system exhibited a substantial increase in relative abundance, particularly in DK and SP samples (Fig. 1e, Wilcoxon tests, p < 0.001). The magnitude of reduction was also country-specific. In DK and SP samples—where BTB was employed—we observed the most substantial decreases (Wilcoxon tests, p < 0.001). In contrast, the UK site, which used BTF, exhibited a milder reduction (Wilcoxon tests, p > 0.05). This decline across multiple countries indicates that biological treatment is associated with substantial reductions in defense system abundance, possibly reflecting both direct selection for defense systems and indirect effects mediated through bacterial community shifts.

Urban wastewater compartments dominates over geographic and seasonal factors in defense composition

To assess the relative importance of factors shaping defense system distributions, we conducted variance partitioning analysis across compartments, countries, and seasons (Fig. 1f). This revealed that compartment was the dominant factor, independently accounting for 51.2% of the observed variation in defense system composition, presumably due to distinct bacterial taxonomic compositions. Country explained 10.6% of the variation, while seasonal effects contributed minimally (0.7%). This strong influence of the compartment was further supported by nonmetric multidimensional scaling (NMDS) analysis (Fig. 1f, ANOSIM R = 0.422, p < 0.001), which showed clear clustering patterns according to compartment—most notably, BTP samples were clearly separated from other compartments. Bray–Curtis dissimilarity analysis also showed significantly higher between-group distances than within-group distances across both countries and compartments, reinforcing the conclusion that the sewage treatment process is the principal driver of defense system composition, outweighing geographic and temporal factors (Fig. S5).

Moreover, the ordination (indicated by arrows in Fig. 1f) revealed the association of specific defense systems with sample differentiation. Notably, PD-T4-6 showed a strong association with BTP samples from Denmark and Spain, suggesting that this system plays a key role in shaping the posttreatment defense in these countries. In contrast, defense systems such as AbiL and RM type II were more strongly associated with UK samples, particularly those from BTP compartments. Meanwhile, systems like AbiE were more prevalent in sewage samples, indicating their potential loss during BTP.

Bacteria harboring defense systems are distinct from the overall community

To investigate whether the observed changes in defense systems were driven by shifts in microbial community structure or by other mechanisms such as HGT, we conducted a systematic analysis of microbial community composition. Across all compartments, bacteria harboring defense systems formed a distinct community subset from the overall bacterial population (Fig. 2a, ANOSIM R: 0.983, p < 0.001). The defense-carrying bacterial community exhibited significantly greater within-group beta-diversity dispersion compared to the overall community (Tukey’s HSD test, p < 0.001) (Fig. 2a), suggesting that bacteria harboring defense systems represent a nonrandom subset of the overall community, and indicating certain taxonomic groups may be more likely to possess defense systems.

Fig. 2.

Fig. 2

Bacterial community composition and its relationship with defense systems across different wastewater environments. a NMDS ordination analysis (Bray–Curtis dissimilarity) comparing bacterial community structures calculated from (i) all bacterial taxa (whole bacteria) versus (ii) only taxa harboring defense systems (with defense). Each sample is represented by two points corresponding to these two analyses. b Relative abundance of GTDB phyla in (left) all bacterial communities and (right) subcommunities carrying defense systems across compartments and countries. c Chord diagrams showing compartment-specific associations between bacterial phyla and defense systems based on gene abundance in HS, RS, MS, and BTP in DK. d Phylogenetic tree of the top 400 most abundant bacterial species, which together account for 85% of the total bacterial abundance. From the inner to the outer rings: (i) Ecological affiliation of each species (orange, predominantly human associated; blue, environmental; white, unclassified) and (ii) enrichment of corresponding defense systems (red, enriched in sewage; green, enriched in BTP). The heatmap displays the relative abundance of 20 representative defense systems across species. e Scatter plots showing the relationship between defense system richness and bacterial phylum abundance across samples. Each dot represents a sample, colored by phylum; linear regression lines are shown for each phylum. f Scatter plots showing the relationship between total defense system abundance and phylum-level bacterial abundance. Linear regression lines are provided per phylum. g Boxplot comparing pairwise between-sample Bray–Curtis dissimilarities calculated from of defense system abundance profiles versus taxonomic abundance profiles at different classification levels. Lower dissimilarity indicates greater compositional consistency across samples

The microbial community composition in BTP of Denmark and Spain showed, as anticipated from the strong compartment effect observed in Fig. 1f, striking differences compared to other compartments (Fig. 2b, PERMANOVA: DK: R2 = 0.85, SP: R2 = 0.65, all p < 0.001). Notably, UK samples, which employed BTF rather than BTB, did not exhibit similar trends, possibly due to environmental conditions that did not favor the growth of these bacterial groups.

Taxonomic shifts and defense system redistribution during wastewater treatment

We further explored how defense systems were distributed across bacterial phyla in different wastewater compartments. Figure 2c illustrates the Danish data as a representative example; comparable patterns were also observed in Spain and the UK (Fig. S6). In Danish sewage compartments (HS, RS, and MS), the overall composition of defense systems was relatively consistent across samples, suggesting a stable core set of defense strategies in environments dominated by taxa containing numerous pathogenic species, such as Campylobacterota. In contrast, BTP exhibited fewer total phylum-defense system connections, but the relative contributions of phyla, such as Myxococcota, increased substantially.

To explore the taxonomic distribution of defense systems at the species level, we constructed a taxonomy tree of the top 400 most abundant bacterial species and annotated each species by its ecological role (Fig. 2d). These species account for 85% of total species level abundance and were classified as “Predominantly human-associated,” “Environmental,” or “Unclassified” based on literature sources (Table S7). Representative “Predominantly human-associated” taxa include Phocaeicola dorei, Phocaeicola vulgatus, Faecalibacterium longum, and Agathobacter rectalis, whereas “Environmental” taxa included Cloacibacterium rupense, Malikia spinosa, and Acidovorax defluvii. Samples from HS, RS, and MS were averaged as “sewage,” while BTP samples were treated as a distinct group. A striking shift in bacterial composition was observed in the BTP compartment: predominantly, human-associated species declined sharply or disappeared in BTP, while environmental taxa became dominant. Consistently, in sewage, defense systems were largely concentrated in predominantly human-associated bacteria. By contrast, in the BTP, these defense systems became prevalent among environmental taxa, indicating a redistribution of defense functions across ecological niches during wastewater treatment.

Potential horizontal gene transfer is shaping defense system distribution

Building upon the observed shifts in bacterial and defense system composition across compartments, we next examined how microbial community structure relates to defense system profiles. Bray–Curtis dissimilarity analysis revealed that defense system composition was more conserved across samples than taxonomic profiles at any level (Fig. 2g, Fig. S8), and this finding was not an artifact of differing feature numbers, as confirmed by rarefaction analysis (Fig. S7), indicating that defense systems exhibit greater stability despite substantial changes in host composition. In contrast, antibiotic resistance genes (ARGs) showed significantly higher compositional variability, highlighting this unique stability (Wilcoxon tests; p < 0.001). To formally test whether defense system distributions deviate from expectations under strict vertical inheritance, we constructed null models that predict defense composition from taxonomic composition at each classification level. At finer taxonomic resolutions (class through species), observed defense system dissimilarities were significantly lower than predicted by vertical inheritance alone (Wiloxon test, all p < 0.001), indicating that defense systems are more homogeneously distributed across taxonomically diverse hosts than expected under vertical transmission, consistent with active horizontal redistribution. To investigate potential drivers of this stability, we assessed the relationship between phylum-level bacterial abundance and defense system diversity and abundance. We observed strong positive correlations between phylum-level abundance and defense system richness (Fig. 2e), particularly in phyla such as Pseudomonadota (r = 0.51), Campylobacterota (r = 0.76), and Bacillota_A (r = 0.67). In contrast, no consistent correlation was found between phylum abundance and total defense system abundance (Fig. 2f) for phyla such as Pseudomonadota (r = 0.08), Bacteroidota (r = 0.08), and Bacillota_A (r = −0.02). This decoupling indicates that although more diverse communities encode more types of defense systems, their total defense gene copy number does not scale with microbial abundance profiles.

Collectively, these findings suggest that HGT plays an important role in shaping the distribution of defense systems across diverse bacterial hosts, contributing to both the observed compositional stability across compartments and the decoupling between defense abundance and microbiome abundance. This is consistent with a dynamic redistribution of defense elements that operate independently of host dominance patterns.

Defense systems are enriched on plasmids, especially highly mobile plasmids

Building on our previous results, we concluded that HGT plays an important role in shaping the distribution of defense systems. Accordingly, we then focused on how defense genes partition between chromosomes and plasmids. We quantified the normalized abundance of each defense subtype on chromosomes and plasmids (Fig. 3a) and found a strong positive correlation between them (Spearman r = 0.82, p < 0.001), indicating that subtypes abundant on plasmid tend to also be abundant on chromosome. Most defense systems are enriched on plasmids (shown in red), while only certain defense systems, particularly PD-T4-6, predominantly appear on chromosomes (Fig. 3b; Fig. S9). This enrichment pattern remained consistent across compartments, including during BTP. Figure 3c further shows that the density of defense genes on plasmids was consistently about twice as high as that on chromosomes across all compartments, reinforcing the role of plasmids as compact reservoirs of defense elements. Furthermore, 31.5% of conjugative plasmids carried at least one defense system, compared to only 3.8% of mobilizable and 3.7% of non-mobilizable plasmids (Fig. 3d). Conjugative plasmids also harbored the greatest diversity of defense subtypes, while non-mobilizable plasmids were largely restricted to the SoFic system. These results highlight that defense systems are enriched on plasmids, particularly conjugative ones, and that this pattern persists during BTP. The preferential association with conjugative plasmids is significant, as these elements possess autonomous transfer machinery that enables active and reliable horizontal dissemination of defense systems across bacterial communities, independent of the presence of helper elements.

Fig. 3.

Fig. 3

Genomic distribution and mobility patterns of bacterial defense systems in wastewater environments. a Bar chart showing the total normalized abundance of defense systems, with separate bars indicating plasmid (red) and chromosome (blue) localization across different defense system types. b Heatmap showing the abundance and genomic location (plasmid vs. chromosome) of individual defense systems across all compartments. Rows represent samples grouped by compartment and country; columns represent defense system types, ordered in increasing tendency for plasmid association. Color intensity reflects log-transformed relative abundance, with red and blue indicating plasmid- and chromosome-localized systems, respectively. Circles denote systems exclusively plasmid or chromosome-borne. c Stacked bar chart showing the defense density distribution between plasmids and chromosomes. d Stacked bar charts displaying the presence rate of defense systems in three plasmid mobility classes: conjugative (31.49%), mobilizable (3.8%), and non-mobilizable (3.74%). e Box plots comparing taxonomic breadth (phylum, genus, species) among plasmids with different mobility types, based on the number of unique taxa of plasmids with defense (top row) and plasmids without defense (bottom row), each dot represents the number of unique predicted host taxa for plasmids of a given mobility type within one country-compartment group. f Coefficient of variation (CV) in defense system density across bacterial phyla, plasmids, and phages, highlighting that plasmids show the lowest variability, followed by Pseudomonadota and Bacteroidota

Conjugative plasmids represent the broadest host-range reservoir of defense systems

To explore the extent of defense system transmission between different bacterial hosts via plasmids, we predicted plasmid hosts based on sequence similarity and classified them into six levels: phylum, class, order, family, genus, and species. We defined “unique taxa” as the total number of distinct bacterial taxa predicted to harbor each plasmid (Fig. 3e, Fig. S10). Our analysis confirms that plasmid mobility is a primary determinant of host range, as conjugative plasmids demonstrated significantly (Kruskal–Wallis test, p < 0.001) higher potential unique taxa than mobilizable and non-mobile plasmids. Notably, these differences between mobility types become more pronounced at more specific classification levels. We then tested whether the presence of a defense system itself correlated with host range. However, when comparing plasmids within the same mobility class, we found no statistically significant difference in the average number of unique taxa (Mann–Whitney U test, p > 0.05). This finding suggests that the broader host range is an intrinsic property of highly mobile plasmids rather than a trait conferred by the defense system. This reinforces that conjugative plasmids can distribute defense systems across a wider variety of bacterial taxa, potentially conferring adaptive advantages to both bacterial hosts and the plasmids themselves in their competition with other MGEs.

Higher stability of defense systems on plasmids during wastewater treatment process

To investigate the stability of plasmid-encoded defense systems during sewage treatment, we calculated defense system gene density across compartments and compared the coefficient of variation (CV) of defense system densities on plasmids, phage, and across bacterial phyla (Fig. 3f). Results revealed that defense systems on plasmids exhibited lower coefficients of variation compared to all bacterial phyla, indicating that their gene density maintained relative stability across different compartments. This difference became particularly pronounced when contrasted with the significant increase of the PD-T4-6 defense system in the Myxococcota phylum following treatment (median abundance increased from ~214–299 to 2456 in BTP, Wilcoxon rank-sum test, p < 0.001; Spearman, ρ = 0.62, p < 0.001). This stability suggests that plasmids serve as consistent carriers of defense systems throughout the treatment process, potentially facilitating the persistence and transmission of these genetic elements despite environmental pressures that may cause substantial shifts in bacterial community composition.

Differential host range of defense systems in plasmid-mediated transfer

We observed that different defense systems on plasmids exhibited host specificity (Fig. 4a). Certain defense systems such as Shedu, Gabija, CBASS type I, RM type III, RM type II, and RM type I predominantly had predicted hosts within the phylum Pseudomonadota, while others like AbiL and AbiD were primarily hosted within the phylum Bacteroidota. In contrast, defense systems such as SoFic and AbiE were identified across multiple different phyla.

Fig. 4.

Fig. 4

Host range dynamics and co-mobilization patterns of defense systems through plasmid-MGE-associated gene interactions. a Box plots showing the log₁₀-scaled abundance of selected plasmid-encoded defense systems (e.g., SoFic, Gabija, RM type II, AbiEI) across dominant bacterial species. The GTDB-based phylogenetic tree on the left clusters host species. b Line plots showing the percentage of co-localization events between defense systems and MGE-associated genes across compartments (HS, RS, MS, BTP), stratified by country (DK, SP, UK) and genomic location (chromosome vs. plasmid). Each color represents a different MGE-associated gene category (e.g., conjugative, transposase, recombinase, integrase, resolvase, mobilization). c Co-localization network of defense systems (blue nodes) and MGE-associated genes (orange nodes) identified on plasmids. Node size reflects relative abundance, while edge thickness and color represent the strength and direction of correlations (green: positive; red: negative). d Representative gene maps displaying examples of plasmid-to-chromosome and plasmid-to-plasmid transfer events. Blue arrows denote defense systems, and orange arrows denote MGE-associated genes, with percentages indicating genomic similarity

The mobility of defense systems decreases during BTP

To further investigate the patterns between defense systems and MGEs on plasmids, we annotated and classified plasmid-encoded MGE-associated genes into six major categories: conjugative, transposase, recombinase, integrase, resolvase, and mobilization (Table S8). Among the 597,282 identified genes, rve (5.3%) and DDE Tnp 1 (5.2%) were most abundant, and the abundance of MGE-associated genes was higher on plasmids than chromosomes (Table S9). We defined co-localization as the presence of defense system genes and MGE-associated genes within a 10-gene window on the same contig. Throughout the compartments, the co-localization ratio between defense systems and MGE-associated genes showed a generally declining trend, from sewage (HS, RS) through MS to BTP across most MGE categories, with Spearman correlations indicating negative associations in the majority of analyses (Fig. 4b). The co-localization patterns exhibited different dynamic characteristics between genomic locations: on chromosomes, co-localization showed a general declining pattern (83% of MGE categories with negative, average ρ≈−0.54), whereas on plasmids co-localization demonstrated more variable dynamics (average ρ≈0) with partial increases in some compartments. This contrast suggests that plasmids serve as more flexible platforms for defense system mobilization, with variable dynamics potentially reflecting horizontal transfer or positive selective under specific treatment conditions, while chromosomal patterns primarily reflect shifts in bacterial community composition.

Co-mobilization of defense systems through plasmid—MGE-associated genes interactions

To gain deeper insight into how defense systems spread among microorganisms through the interaction of plasmids and MGE-associated genes, we constructed a co-localization network between specific defense systems subtypes and individual MGE-associated genes (Fig. 4c). Our network analysis revealed that such gene pairs are more frequently co-localized on plasmids than on chromosomes (co-localization rates: 29.95% vs 4.42%, Fisher’s exact test p < 0.001, OR = 9.25; Fig. S11, Fig. S12, Table S10), suggesting that plasmids may provide efficient vehicles for their coordinated transmission within microbial communities. We observed distinct pairing preferences between certain defense subtypes and specific MGE-associated genes: for example, resolvase co-localized with SoFic and HTH 7 with AbiE, while other elements such as serine-ce exhibited broader associations, linking to ShosTA, HEC-03, Her-SIR, retron type VI, and others. Although fewer in number, comparable co-localization patterns were also detected on chromosomes, with distinct configurations from those on plasmids (Fig. S13). Figure 4d shows four representative examples of transfer events between different genomic contexts. These include plasmid-to-chromosome transfers and plasmid-to-plasmid transfers, demonstrating various scenarios of defense system mobilization. The genomic maps display different combinations of defense systems (blue arrows) and MGE-associated genes (orange arrows); additional illustrative cases are provided in Supplementary Fig. S14.

All together, these findings demonstrate that plasmids and their MGE-associated genes play crucial roles in the HGT and dissemination of defense systems across bacterial communities in wastewater environments.

Phage pressure drives plasmid defense in wastewater bacteria

We were able to predict hosts for 80.5% of phages and 30.2% of plasmids. Among the predicted bacterial hosts of phages, the predominant genera were Acinetobacter (24.22%), Bacteroides (15.40%), and Aeromonas (14.94%) (Fig. 5a). The high abundance of the Phocaeicola genus is likely due to biases in the prediction database. Correlation analysis revealed that as phage abundance increases, defense system abundance also increases both on the chromosomes and plasmids of their predicted bacteria hosts, with significant positive correlations observed for both plasmids (R = 0.79, p < 0.001) and chromosomes (R = 0.44, p < 0.001) of phage hosts (Fig. 5b). These patterns suggest that increased phage pressure potentially drives the accumulation of defense systems in both chromosomal and host-associated plasmid compartments, with plasmid-encoded defenses showing stronger correlations, reflecting their prominent role in defense system carriage under phage pressure.

Fig. 5.

Fig. 5

Distribution and co-evolution patterns of viral anti-defense systems and bacterial defense strategies in wastewater environments. a Donut charts showing the abundance proportions of plasmids and phages and the percentage with predicted hosts, along with the genus-level distribution of phage hosts. b Correlation analysis between phage abundance and defense system abundance in their predicted hosts across samples, with corresponding defense system abundance on plasmids sharing the same host species. c Pie chart showing the relative abundance of defense systems versus anti-defense systems. d Comparison of anti-defense system abundance between plasmids and phages. e Scatter plots showing correlations for each host species between anti-defense system abundance in phages and defense system abundance in plasmids (top) or chromosomes (bottom) of the same host species. Each point represents a host species. f Network visualization showing actual pairing patterns between defense systems on chromosomes/plasmids and anti-defense systems on phages, with different colors representing distinct anti-defense system types. g Representative examples showing specific matched defense-anti-defense pairs with their genomic organization

Coevolution of defense and anti-defense strategies in urban wastewater systems

During long-term evolution, phages have developed numerous anti-defense mechanisms to counteract host defense systems. Our analysis revealed that anti-defense systems were more abundant than defense systems in samples, with anti-defense systems accounting for 52.45% and defense systems 47.55% of the total abundance (Fig. 5c). The final standardized names of all anti-defense genes are provided in Supplementary Table S11. Most anti-defense types were enriched in phages, except for anti-RecBCD (Fig. 5d, Table S12). At the species level, we found significant correlations between anti-defense abundance in phages and defense abundance in both plasmids (R = 0.63, p < 0.001) and chromosomes (R = 0.44, p < 0.001) of the same host species (Fig. 5e, Table S13), indicating a potential co-evolutionary arms race where phages develop counter-defense strategies in response to host defense systems.

Based on spacer-based pairing, network analysis revealed specific pairing patterns between defense and anti-defense systems (Fig. 5f, Table S14), with different anti-defense types (anti-CRISPR, anti-RM, anti-CBASS, anti-retron, anti-thoeris) targeting their corresponding defense systems. Representative examples demonstrate the genomic organization of these matched pairs (Fig. 5g); additional cases are provided in Supplementary Fig. S15. However, current anti-defense research focuses primarily on CRISPR-Cas and RM systems, which may introduce detection biases in our analysis. These findings collectively suggest an evolutionary arms race in wastewater environments, where phages develop sophisticated counter-strategies to overcome host defenses. Importantly, plasmids emerge as key players in this dynamic process, showing stronger responses to phage pressure compared to chromosomal defenses.

Discussion

Antimicrobial resistance is a growing global health threat, driven by the rapid spread of resistance genes through horizontal gene transfer [74]. Phage therapy has emerged as a promising alternative, but its success critically depends on understanding the ecology and evolution of bacterial immune systems [68], which serve as barriers to phages and HGT. Urban wastewater provides a unique lens into these dynamics, reflecting the collective microbiome of entire populations. In this study, we present the first large-scale analysis of bacterial defense systems across wastewater treatment processes in three European countries.

We found a high diversity and widespread distribution of defense systems in urban wastewater systems with a total of 233,135 identified defense genes across all samples, classified into 371 types. Our results demonstrate a general trend toward a decreased abundance and diversity of bacterial defense systems following biological treatment, with the magnitude varying significantly across the three countries studied, likely due to different treatment technologies employed. The biological treatment basins (BTB, activated sludge) used in Denmark and Spain demonstrated substantially greater reductions in defense system abundance and richness compared to the biological treatment filters (BTF) employed in the UK. This technological disparity can be attributed to the longer retention times and more intense selective pressures in activated sludge systems, which create fluctuating oxygen gradients, pH variations, and enhanced predator–prey dynamics that disproportionately affect bacteria harboring defense systems [78]. This systematic reduction across different treatment technologies mirrors previous observations of reduced antimicrobial resistance genes (ARGs), virulence factors, and mobile genetic elements during wastewater treatment [32, 50], suggesting that BTP act as ecological filters that constrain gene mobility and microbial functions with potential ecological implications for bacterial adaptation to phage predation pressures in downstream environments. However, it is important to note that a considerable portion of defense systems still persisted in treated effluent across all sites. This persistence parallels previous reports of residual ARGs and MGEs post-treatment [9, 24], raising concerns about the downstream dissemination of immune traits into natural environments.

Our results reveal a surprising decoupling between microbial community structure and defense system abundance patterns during wastewater treatment, suggesting that horizontal gene transfer, rather than vertical inheritance with host lineages, plays an important role in shaping bacterial immune profiles. We found no significant correlation between phylum-level bacterial abundance and the corresponding defense system abundance within different phyla. While the observed decoupling between microbial community structure and defense system abundance could theoretically arise from vertical inheritance with lineage-specific loss, this explanation alone cannot fully account for our results. First, defense system composition remained more stable across samples than host taxonomical composition (Fig. 2g), indicating that defense repertoires are not strictly constrained by host lineage turnover. Second, identical defense systems were detected across distantly related phyla (Fig. 4a), which is inconsistent with strictly vertical transmission. An additional possibility is hitchhiking, whereby noncarrier cells benefit indirectly from nearby carriers that express protective functions. However, such a mechanism is less likely to be a general explanation. While the collective action of many defended cells clearing virions can create an indirect, population-level benefit, the anti-phage defenses themselves are typically cell-specific, providing direct protection only to the encoding host, rather than functioning as diffusible, externally acting substances that protect the surrounding area. Consequently, the persistence and redistribution of defense systems across phylogenetically diverse hosts are more plausibly explained by a combination of vertical inheritance and horizontal gene transfer, with the latter contributing to the observed decoupling during wastewater treatment. Such decoupling has been similarly observed in other complex microbiomes such as soil and the human gut, where functional gene content frequently varies independently of taxonomic composition [22, 39]. This suggests that defense system dynamics are tightly linked to the environmental setting where bacteria reside and largely governed by HGT mechanisms. In other words, many defense systems appear to exist at relatively stable abundance across diverse bacterial hosts, rather than being enriched within specific dominant taxa. This pattern indicates that HGT plays an important role in the distribution of defense genes across microbial communities via MGEs, supporting the recently proposed pan-immune concept [10].

Genomic distribution analysis revealed that defense systems were significantly enriched on plasmids compared to chromosomes, with gene density on plasmids approximately twice that observed on chromosomes, as previously reported for CRISPR-Cas stems [51]. This marked enrichment was consistent across different countries and compartments, suggesting a fundamental relationship between defense systems and plasmid biology. Furthermore, the preferential localization of certain defense systems (such as Gabija and CBASS) on plasmids, while others (like PD-T4-6) remain predominantly chromosomal, indicates distinct evolutionary trajectories for different defense mechanisms. We also found that approximately 30% of conjugative plasmids contained at least one defense system, compared to significantly lower proportions in non-mobilizable plasmids. This enrichment on highly mobile genetic elements suggests that defense systems may contribute to plasmid fitness and stability during horizontal transfer events. This mirrors observations from ARG studies, where plasmid-borne genes are often stabilized by conferring selective advantages under environmental stress [46].

The significant enrichment of defense systems on conjugative plasmids, coupled with their enhanced network connectivity across taxonomic boundaries, points to a sophisticated evolutionary strategy that ensures the persistence and propagation of defense capabilities throughout microbial communities regardless of shifts in the dominant bacterial populations. Despite significant reductions in overall plasmid abundance during wastewater treatment, particularly in HS samples, the gene density of defense systems on plasmids remained remarkably stable throughout the treatment process. This stability contrasts sharply with the variable patterns observed for chromosomally encoded defense systems, which showed high coefficients of variation (CV) across different bacterial phyla. The low CV values for plasmid-encoded defense systems suggest strong selective pressures maintaining these genetic elements, potentially due to their role in conferring fitness advantages in diverse ecological contexts. Network analysis further revealed that plasmids carrying defense systems exhibited significantly higher connectivity across taxonomic boundaries than those without defense systems. This enhanced connectivity was particularly pronounced for conjugative plasmids, suggesting that defense systems may facilitate host range expansion. The maintenance of these network features despite the reduction in overall plasmid abundance during treatment indicates that defense systems contribute substantially to plasmid persistence in complex microbial communities.

The co-evolution between bacterial defense systems and phage anti-defense mechanisms has been widely discussed [11, 12, 64], yet its investigation in complex environmental settings has remained largely unexplored. Our study demonstrates this dynamic in wastewater ecosystems, where phage abundance and defense system abundance are mirrored across samples. This suggests that as phage pressure intensifies in the environment, bacteria develop or maintain more robust defense systems. In response to these continuously evolving bacterial defense systems, the taxonomic specialization of anti-defense strategies across different viral families reveals how phages have evolved targeted approaches to overcome specific defense barriers [42]. Our network analysis uncovered multiple matching relationships between distinct defense systems and their corresponding anti-defense genes.

Our correlation analysis revealed significant associations between anti-defense abundance in phages and defense abundance in both plasmids (R = 0.63, p < 0.001) and chromosomes (R = 0.44, p < 0.001) of the same host species. This significant correlation suggests that phage anti-defense strategies are selectively directed toward hosts with substantial defensive capabilities. This targeted approach likely reflects a resource optimization strategy, as maintaining anti-defense genes carries costs that are only offset in the presence of host defense system pressure [5]. Hence, our findings provide empirical evidence for the ongoing arms race between bacteria and phages in wastewater environments. In several instances, the presence of multiple anti-defense strategies within the same viral genome suggests that some phages adopt a comprehensive approach to host invasion, particularly when targeting bacteria with layered defense systems. These co-evolutionary dynamics have important implications for microbial ecology in wastewater systems and may inform the development of more effective phage-based applications by identifying phages with appropriate anti-defense capabilities against target bacteria.

Our comprehensive analysis of bacterial defense systems in UWS reveals that HGT plays a crucial role in governing their distribution across diverse bacterial communities. While biological treatment significantly reduces defense system abundance and diversity, plasmids—especially conjugative plasmids—serve as persistent genetic reservoirs, maintaining defense functions despite environmental changes. We found that defense systems are enriched on mobile plasmids, with each system exhibiting distinct host preferences and unique co-localization preferences with specific MGE-associated genes. Importantly, plasmids play a crucial role in the phage-host evolutionary arms race, showing stronger correlations with phage pressure than chromosomal defenses. These findings advance our understanding of the dynamics of bacterial defense systems in UWS and suggest that while wastewater treatment drastically changes the bacterial community, and therefore the defenses in that community, plasmids and mobile genetic elements sustain their dissemination potential throughout microbial communities. These mobile defense systems constitute a persistent and transferable network of phage resistance mechanisms that can disseminate rapidly through bacterial communities, suggesting that environmental reservoirs of plasmid-mediated immunity may represent an important but underexplored factor in determining the success of phage therapeutic strategies across different ecological contexts.

Supplementary Information

40168_2025_2297_MOESM1_ESM.pdf (6.3MB, pdf)

Additional file 1: Supplementary Figures (PDF). Figure S1. Overview of the UWS Treatment Flow and Sampling Strategy. This schematic illustrates the key treatment steps and corresponding sampling points across three representative urban wastewater systems (UWSs). Wastewater originated from hospital sewage (HS) and residential sewage (RS) first entering the mixed sewer (MS) pipeline, followed by passage through the primary settler. In Denmark and Spain, the flow subsequently continued into a biological treatment basin, whereas in the United Kingdom, a biofilter was used instead. Effluent from all systems then passed through a secondary settler before being discharged into the downstream river (RU). The infrastructure layout and sampling framework were adapted from [77], which provided a detailed description of the UWS designs. National flags indicate the sampling sites corresponding to each country’s UWS. Figure S2. Workflow for the Identification and Classification of Chromosome, Plasmids and Phages Contigs from Metagenomic and Plasmidome Datasets. This workflow outlines the processing of samples through parallel metagenome and plasmidome assembly pipelines. Plasmid contigs, both linear and circular, are identified using Platon, PlasForest, SCAPP, and MetaPlasmidSPAdes. Contig classification into chromosomes, plasmids and phages is performed using GeNomad and Plaspline. Redundant sequences are removed using MMSeqs2 with a 90% identity and 90% coverage threshold. Circular plasmids are further validated with PlasmidVerify. The final output consists of 3,065,959 chromosomal contigs, 83,919 plasmid contigs, and 52,485 phage contigs. Numbers in parentheses indicate the number of contigs retained at each processing step. Figure S3. Gene annotation and downstream analysis pipeline for classified genomic contigs. Functional annotation of classified contigs from 78 samples using multiple tools including PADLOC, DefenseFinder, and CRISPRCasTyper for defense systems; dbAPIS database for anti-defense annotation; proMGE database and MGEfams for MGEs annotation; and various specialized tools for plasmid-host prediction, phage taxonomy, and spacer identification. Abundance calculations are performed using BWA mapping and TPM normalization. Quality filtering removes contigs with mapping rates <55%, and redundancy is removed using MMSeqs2 (90% identity, 90% coverage). Final outputs include annotated defense/anti-defense systems, taxonomically classified contigs, and abundance profiles. Figure S4. Comparison of plasmid length distributions recovered from metagenome versus plasmidome assemblies. This figure presents density plots comparing the length distribution (X-axis, "Plasmid length (bp)") of plasmids identified from the metagenome assembly (dark blue line) versus those identified from the plasmidome assembly (light blue line). The bottom panel shows the overall distribution up to 100k bp, while the top panel provides a zoomed-in view of the high-density peak for smaller plasmids (0-20k bp). The plots visually confirm that the two methods capture complementary, yet distinct, subsets of the plasmid pool: the plasmidome method preferentially recovered 3,995 smaller plasmids (light blue peak < 20k bp), whereas the metagenome assembly was more effective at reconstructing 1,987 larger plasmids (dark blue peaks > 20k bp). This analysis confirms that our combined strategy, which identified 583 plasmids common to both methods, provides a far more comprehensive picture than either method could alone. Figure S5. Differences in Bray–Curtis distances of defense system composition across groups. Boxplots show within-group (red) and between-group (blue) Bray–Curtis dissimilarities of defense system gene abundance profiles, calculated across 78 wastewater samples. (Left) Comparisons by country (DK: Denmark, SP: Spain, UK: United Kingdom); (Right) comparisons by compartment (HS: Hospital Sewer, RS: Residential Sewer, MS: Mixed Sewer, BTP: Biological Treatment Process). Significance was assessed by two-sided Wilcoxon rank-sum tests. P values were adjusted using the Bonferroni method. Asterisks indicate significance levels (P ≤ 0.05, P ≤ 0.01, P ≤ 0.001, P ≤ 0.0001); “ns” denotes non-significant differences. Figure S6. Phylum-defense system associations across wastewater compartments in Denmark, Spain and United Kingdom. Chord diagrams showing compartment-specific associations between bacterial phyla and defense systems based on gene abundance in hospital sewer (HS), residential sewer (RS), mixed sewer (MS), and biological treatment process (BTP) in DK (Denmark, top row), SP (Spain, middle row) and UK (United Kingdom, bottom row). Each chord connects a bacterial phylum (colored according to legend) with a defense system, with chord thickness representing the strength of association. All three countries show reduced complexity of phylum-defense connections in BTP compared to sewage compartments (HS, RS, MS), while maintaining distinct country-specific patterns. Figure S7. Feature subsampling curve of Bray-Curtis distances. Rarefaction analysis showing mean Bray-Curtis distances across different numbers of features sampled for taxonomic profiles at different levels (phylum to species) and defense systems. Each line represents a different taxonomic level or defense systems, with error bars indicating standard deviation. The analysis confirms that defense systems (pink line) maintain consistently lower Bray-Curtis dissimilarity values compared to all taxonomic levels, regardless of the number of features sampled. This rarefaction approach validates that the observed conservation of defense system composition across samples (as shown in Fig. 2g) is not an artifact of differential feature abundance but represents a genuine biological pattern of defense system stability in urban wastewater environments. Figure S8. Distribution of rarefied Bray–Curtis distances by feature type. This boxplot compares the distribution of all pairwise between-sample Bray–Curtis dissimilarities (Y223 axis) for taxonomic profiles, defense systems, and antibiotic resistance genes (AMR) following feature rarefaction. Each boxplot represents the entire distribution of dissimilarity values for a specific feature category (X-axis), including taxonomic ranks, defense systems at two granularities, and AMR genes as a functional gene control. The analysis confirms that defense systems exhibit a significantly lower median dissimilarity compared to all finer taxonomic ranks. Crucially, it also shows that defense systems are significantly more stable than antibiotic resistance genes, which show a much higher median dissimilarity. Figure S9. Extended analysis of defense system enrichment patterns between plasmids and chromosomes. Heatmap showing the abundance and genomic location (plasmid vs. chromosome) of the top 100 defense systems across all 78 samples. Samples are grouped by compartment and country; defense systems are ordered by increasing tendency for plasmid association. The left panel shows log-transformed relative abundance across samples, with intensity reflecting defense system abundance. The right panels display: (1) Defense enrichment (log scale) showing overall abundance, (2) Normalized abundance on plasmids (blue), (3) Normalized abundance on chromosomes (red), and (4) Log2 fold change (Log2FC) indicating plasmid vs. chromosome preference. Most defense systems show enrichment on plasmids (positive Log2FC values), with only a few systems like PD-T4-6 showing strong chromosomal preference (negative Log2FC values). This comprehensive analysis expands upon Fig. 3a by including all defense system categories and demonstrating the consistent pattern of plasmid enrichment across the broader defense system repertoire. Figure S10. Extended taxonomic breadth analysis of plasmids with different mobility types. Box plots comparing taxonomic breadth across all taxonomic levels (Phylum, Class, Order, Family, Genus, Species) among plasmids with different mobility types, based on the number of unique taxa of plasmids with defense (top row) and plasmids without defense (bottom row). Each dot represents the number of unique predicted host taxa for plasmids of a given mobility type within one country compartment group. This comprehensive analysis extends Fig. 3e by including Class, Order, and Family levels, demonstrating that conjugative plasmids consistently show the highest taxonomic breadth across all taxonomic levels, followed by mobilizable plasmids, while non-mobilizable plasmids show the most restricted host range. The pattern is consistent regardless of defense system presence, with plasmids carrying defense systems showing slightly broader taxonomic breadth at finer taxonomic resolutions. Figure S11. MGE-defense co-occurrence patterns on chromosomes. Dot plot showing cooccurrence frequencies between the top 100 defense system subtypes (y-axis) and top 100 MGE subtypes (x-axis) on chromosomal contigs. Each dot represents a co-occurrence event, with dot size indicating co-occurrence frequency (30-120 events) and color representing MGE functional categories: conjugative (blue), integrase (light blue), mobilization (orange), recombinase (pink), resolvase (light gray), and transposase (green). The analysis reveals distinct co-localization preferences between specific defense systems and MGE elements. This comprehensive view expands the network analysis shown in Fig. 4c by providing quantitative co-occurrence data for the full spectrum of defense-MGE interactions on chromosomes, demonstrating the complex mobilization patterns that facilitate horizontal gene transfer of defense systems. Figure S12. MGE-defense co-occurrence patterns on plasmids. Dot plot showing co-occurrence frequencies between the top 100 defense system subtypes (y-axis) and top 100 MGE subtypes (x-axis) on plasmid contigs. Each dot represents a co-occurrence event, with dot size indicating co-occurrence frequency (50-250 events) and color representing MGE functional categories: conjugative (blue), integrase (light blue), mobilization (orange), recombinase (pink), resolvase (light gray), and transposase (green). The analysis reveals more frequent and intensive co-localization events on plasmids compared to chromosomes (Figure S8), with particularly strong associations between defense systems like SoFic, AbiE, Gabija, and RM systems with various conjugative and transposase elements. This enhanced cooccurrence pattern on plasmids demonstrates their role as active vehicles for coordinated mobilization of defense systems and MGE elements, supporting the findings presented in Fig. 4c regarding plasmid-mediated horizontal gene transfer of bacterial immunity. Figure S13. MGE-defense co-localization network on chromosomes. Network visualization showing co-localization patterns between defense systems (blue nodes) and MGE elements (orange nodes) identified on chromosomal contigs. Node size reflects relative abundance, while edge thickness represents the strength of co-localization associations. The network reveals distinct co-localization preferences between specific defense systems and MGE elements on chromosomes, with some defense systems like SoFic, AbiE, and RM systems showing strong associations with various MGE elements including rve, HTH_Tnp_1, and integrase elements. This chromosomal network complements Fig. 4c (plasmid network) by demonstrating that while defense-MGE co-localization occurs on both genomic contexts, the patterns and intensities differ between chromosomes and plasmids, reflecting distinct mobilization mechanisms and evolutionary pressures in these two genomic. Figure S14. Additional examples of defense system mobilization across genomic contexts. Representative gene map showing co-localization and potential transfer of defense system genes (blue arrows) and MGE-associated genes (orange arrows) across different genomic elements, including plasmids and chromosomes. Each panel represents a distinct transfer scenario observed in the dataset, annotated by sample origin, genomic location (e.g., plasmid mobilizability), and taxonomic assignment. Sequence similarity between homologous regions is indicated by colored blocks connecting genes (percent identity shown). These cases extend the examples shown in Fig. 4d, further illustrating diverse patterns of horizontal gene transfer involving defense systems across environmental compartments and host taxa. Figure S15. Additional representative examples of matched defense and anti-defense systems across genomic contexts. Gene map diagrams illustrating co-occurrence and pairing of defense systems (dark blue arrows) and their corresponding anti-defense systems (light gray arrows) across phage, plasmid, and chromosomal contigs. Each panel shows a matched pair, identified based on spacer-target network analysis, representing functional couplings such as Anti-CRISPR with CRISPR352 Cas systems, Anti-RM with restriction-modification systems, and Anti-CBASS, Anti-Retron, or Anti-Thoeris systems with their respective counterparts. These examples span diverse hosts (e.g., Hydrogenophaga, Klebsiella, Acinetobacter) and genomic locations (e.g., phage-plasmid, chromosome-phage), and demonstrate the structural organization and potential mobilization patterns of immune–counter-immune elements. These cases complement those shown in Fig. 5g.

40168_2025_2297_MOESM2_ESM.xlsx (1.5MB, xlsx)

Additional file 2: Supplementary Tables (Excel). Table S1. Comprehensive sample metadata and sampling details. Table S2. Statistical analysis results. Table S3. Sample grouping information and contig annotation summary. Table S4. Standardized defense system nomenclature mapping. Table S5. Defense systems abundance data across all samples. Table S6. Group-specific defense system subtypes. Table S7. Defense system enrichment in the top 400 most abundant bacterial species. Table S8. Standardized MGE nomenclature mapping. Table S9. MGE abundance data across all samples. Table S10. Statistically significant MGE-defense co-localization events. Table S11. Anti-defense system nomenclature standardization. Table S12. Anti-defense system abundance across samples. Table S13. Plasmid and phage host prediction results. Table S14.CRISPR spacer-based linkage between defense and anti-defense systems.

Acknowledgements

We hereby acknowledge the support of the NNF-funded project pTracker (NNF20OC0062223), awarded to S. J. S. H. T. Z. was funded by a scholarship from China Scholarship Council (202104910071). L. P. and R. P.-R. were supported by a research grant (VIL60763) from Villum Fonden.

Abbreviations

MGEs

Mobile genetic elements

HS

Hospital sewer

RS

Residential sewer

MS

Mixed sewer

BTP

Biological treatment process

BTB

Biological treatment basins

BTF

Biological treatment filters

UWS

Urban wastewater system

AMR

Antimicrobial resistance

ANI

Average nucleotide identity

CDS

Coding sequence

ORF

Open reading frame

Authors’ contributions

H.Z.: Investigation, Formal analysis, Data curation, Methodology, Visualization, Writing – original draft. L.P.: Conceptualization, Writing – review & editing, Formal analysis, Validation. W.H.: Formal analysis, Data curation, Software, Methodology. M.R.M.: Conceptualization, Methodology, Writing – review & editing, Validation. L.Y.: Conceptualization, Validation, Writing – review & editing, Formal analysis. A.D.: Writing – review & editing, Validation, Resources. R.P.R.: Writing – review & editing, Validation, Methodology. J.N.: Writing – review & editing, Validation, Supervision. S.J.S.: Conceptualization, Funding acquisition, Supervision, Project administration, Resources, Writing – review & editing

Funding

Open access funding provided by Copenhagen University This work was supported by the NNF-funded project pTracker (NNF20OC0062223) awarded to S. J. S. H. T. Z. was funded by the China Scholarship Council (202104910071). L. P. and R. P.-R. were supported by a research grant (VIL60763) from Villum Fonden.

Data availability

All the code can be found in this GitHub repository: [https://github.com/marveloushaotian/DURIS] (https:/github.com/marveloushaotian/DURIS). All results and associated scripts can be found in this Google Drive: [https://drive.google.com/drive/folders/11hMwINQzWZnb6MNSJNY4AT9G3xdLEOaZ] (https:/drive.google.com/drive/folders/11hMwINQzWZnb6MNSJNY4AT9G3xdLEOaZ). The original data tables used to support and reproduce the analysis are available in this Zenodo repository: 10.5281/zenodo.14883504. The raw sequences used in this study are available on NCBI SRA at BioProject accession number PRJEB85938.

Declarations

Ethics approval and consent to participate

Not applicable.

Consent for publication

Not applicable.

Competing interests

The authors declare no competing interests.

Footnotes

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  • 1.Acman M, van Dorp L, Santini JM, Balloux F. Large-scale network analysis captures biological features of bacterial plasmids. Nat Commun. 2020;11(1):2452. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2.Altschul SF, Gish W, Miller W, Myers EW, Lipman DJ. Basic local alignment search tool. J Mol Biol. 1990;215(3):403–10. [DOI] [PubMed] [Google Scholar]
  • 3.Antipov D, Raiko M, Lapidus A, Pevzner PA. Plasmid detection and assembly in genomic and metagenomic data sets. Genome Res. 2019;29(6):961–8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Arber W, Dussoix D. Host specificity of DNA produced by Escherichia coli: I. Host controlled modification of bacteriophage λ. J Mol Biol. 1962;5(1):18–36. [DOI] [PubMed]
  • 5.Babele PK, Srivastava A, Young JD. Metabolic flux phenotyping of secondary metabolism in cyanobacteria. Trends Microbiol. 2023;31(11):1118–30. [DOI] [PubMed] [Google Scholar]
  • 6.Barrangou R, Christophe F, Deveau H, Richards M, Boyaval P, Moineau S, et al. CRISPR provides acquired resistance against viruses in prokaryotes. Science (New York, NY). 2007;315(5819):1709–12. [DOI] [PubMed] [Google Scholar]
  • 7.Bastian M, Heymann S, Jacomy M. Gephi: an open source software for exploring and manipulating networks. Proceedings of the International AAAI Conference on Web and Social Media. 2009;3(1):361–2. [Google Scholar]
  • 8.Beavogui A, Lacroix A, Wiart N, Poulain J, Delmont TO, Paoli L, et al. The defensome of complex bacterial communities. Nat Commun. 2024;15(1):2146. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Bengtsson-Palme J, Larsson DGJ. Concentrations of antibiotics predicted to select for resistant bacteria: proposed limits for environmental regulation. Environ Int. 2016;86:140–9. [DOI] [PubMed] [Google Scholar]
  • 10.Bernheim A, Sorek R. The pan-immune system of bacteria: antiviral defence as a community resource. Nat Rev Microbiol. 2020;18(2):113–9. [DOI] [PubMed] [Google Scholar]
  • 11.Bondy-Denomy J, et al. Multiple mechanisms for CRISPR-Cas inhibition by anti-CRISPR proteins. Nature. 2013;497:119–123. [DOI] [PMC free article] [PubMed]
  • 12.Borges AL, et al. Discovery of multiple anti-CRISPRs highlights anti-defense gene clustering in mobile genetic elements. Nat Commun. 2020;11:5652.​ [DOI] [PMC free article] [PubMed]
  • 13.Kav B, Aya GS, Jami E, Doron-Faigenboim A, Benhar I, Mizrahi I. Insights into the bovine rumen plasmidome. Proc Natl Acad Sci USA. 2012;109(14):5452–7. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Buchfink B, Reuter K, Drost H-G. Sensitive protein alignments at tree-of-life scale using DIAMOND. Nat Methods. 2021;18(4):366–8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Bushnell B. BBMap: a fast, accurate, splice-aware aligner. LBNL-7065E. Lawrence Berkeley National Lab. (LBNL), Berkeley, CA (United States). 2014. https://www.osti.gov/servlets/purl/1241166.
  • 16.Camargo AP, Call L, Roux S, Nayfach S, Huntemann M, Palaniappan K, et al. IMG/PR: a database of plasmids from genomes and metagenomes with rich annotations and metadata. Nucleic Acids Res. 2024;52(D1):D164–73. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Camargo AP, Roux S, Schulz F, Babinski M, Xu Y, Hu B, et al. Identification of mobile genetic elements with geNomad. Nat Biotechnol. 2024;42(8):1303–12. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Coutinho FH, Zaragoza-Solas A, López-Pérez M, Barylski J, Zielezinski A, Dutilh BE, Edwards RA, Rodriguez-Valera F. RaFAH: a superior method for virus-host prediction. bioRxiv. 2020. bioRxiv. 10.1101/2020.09.25.313155.
  • 19.Couvin D, Bernheim A, Toffano-Nioche C, Touchon M, Michalik J, Néron B, et al. CRISPRCasFinder, an update of CRISRFinder, includes a portable version, enhanced performance and integrates search for Cas proteins. Nucleic Acids Res. 2018;46(W1):W246–51. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Dib JR, Wagenknecht M, Farías ME, Meinhardt F. Strategies and approaches in plasmidome studies—uncovering plasmid diversity disregarding of linear elements? Front Microbiol. 2015;6(May):463. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Dixon P. VEGAN, a package of R functions for community ecology. J Veg Sci. 2003;14(6):927–30. [Google Scholar]
  • 22.Fierer N, Leff JW, Adams BJ, Nielsen UN, Bates ST, Lauber CL, et al. Cross-biome metagenomic analyses of soil microbial communities and their functional attributes. Proc Natl Acad Sci U S A. 2012;109(52):21390–5. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Finn RD, Clements J, Eddy SR. HMMER web server: interactive sequence similarity searching. Nucleic Acids Res. 2011;39(Web Server issue):W29-37. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Galli E, Poidevin M, Le Bars R, Desfontaines J-M, Muresan L, Paly E, et al. Cell division licensing in the multi-chromosomal Vibrio cholerae bacterium. Nat Microbiol. 2016;1(9):16094. [DOI] [PubMed] [Google Scholar]
  • 25.Gilchrist CLM, Chooi Y-H. Clinker & clustermap.Js: automatic generation of gene cluster comparison figures. Bioinformatics. 2021;37(16):2473–5. [DOI] [PubMed] [Google Scholar]
  • 26.Gu Z, Gu L, Eils R, Schlesner M, Brors B. Circlize implements and enhances circular visualization in R. Bioinformatics. 2014;30(19):2811–2. [DOI] [PubMed] [Google Scholar]
  • 27.Hacker J, Carniel E. Ecological fitness, genomic islands and bacterial pathogenicity. A Darwinian view of the evolution of microbes. EMBO Rep. 2001;2(5):376–81. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.He L, Huang X, Zhang G, Yuan L, Shen E, Zhang Lu, et al. Distinctive signatures of pathogenic and antibiotic resistant potentials in the hadal microbiome. Environ Microbiome. 2022;17(1):19. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.He W, Yu Z, Wu Z, Olesen AK, Madsen JS, Dechesne A, et al. Beyond borders: plasmids drive a shared antibiotic resistome in European urban water systems. Microbiome. In press. [DOI] [PMC free article] [PubMed]
  • 30.Hyatt D, Chen G-L, Locascio PF, Land ML, Larimer FW, Hauser LJ. Prodigal: prokaryotic gene recognition and translation initiation site identification. BMC Bioinformatics. 2010;11(1):119. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 31.Jiang J-Z, Wen-Guang Yuan, Jiayu Shang, Ying-Hui Shi, Li-Ling Yang, Min Liu, et al. Virus classification for viral genomic fragments using PhaGCN2. Brief Bioinform. 2023. 10.1093/bib/bbac505. [DOI] [PubMed] [Google Scholar]
  • 32.Ju F, Beck K, Yin X, Maccagnan A, McArdell CS, Singer HP, et al. Wastewater treatment plant resistomes are shaped by bacterial composition, genetic exchange, and upregulated expression in the effluent microbiomes. ISME J. 2019;13(2):346–60. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Khedkar S, Smyshlyaev G, Letunic I, Maistrenko OM, Coelho LP, Orakov A, et al. Landscape of mobile genetic elements and their antibiotic resistance cargo in prokaryotic genomes. Nucleic Acids Res. 2022;50(6):3155–68. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Li H, Durbin R. Fast and accurate short read alignment with Burrows-Wheeler transform. Bioinformatics. 2009;25(14):1754–60. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Li, Heng, Bob Handsaker, Alec Wysoker, Tim Fennell, Jue Ruan, Nils Homer, Gabor Marth, Goncalo Abecasis, Richard Durbin, and 1000 Genome Project Data Processing Subgroup. The Sequence Alignment/Map format and SAMtools. Bioinformatics (Oxford, England). 2009;25(16):2078–9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Li L, Nesme J, Quintela-Baluja M, Balboa S, Hashsham S, Williams MR, et al. Extended-spectrum β-lactamase and carbapenemase genes are substantially and sequentially reduced during conveyance and treatment of urban sewage. Environ Sci Technol. 2021;55(9):5939–49. [DOI] [PubMed] [Google Scholar]
  • 37.Li LL, Norman A, Hansen LH, Sørensen SJ. Metamobilomics–expanding our knowledge on the pool of plasmid encoded traits in natural environments using high-throughput sequencing. Clin Microbiol Infect. 2012;18(Suppl 4):5–7. [DOI] [PubMed] [Google Scholar]
  • 38.Lin DM, Koskella B, Lin HC. Phage therapy: an alternative to antibiotics in the age of multi-drug resistance. World J Gastrointest Pharmacol Ther. 2017;8(3):162–73. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Lloyd-Price J, Mahurkar A, Rahnavard G, Crabtree J, Orvis J, Hall AB, et al. Strains, functions and dynamics in the expanded Human Microbiome Project. Nature. 2017;550(7674):61–6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40.Mainali KP, Slud E. Cooccurrenceaffinity: an R package for computing a novel metric of affinity in co-occurrence data that corrects for pervasive errors in traditional indices. PLoS ONE. 2025;20(1):e0316650. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 41.Makarova KS, Wolf YI, Iranzo J, Shmakov SA, Alkhnbashi OS, Brouns SJJ, et al. Evolutionary classification of CRISPR-Cas systems: a burst of class 2 and derived variants. Nat Rev Microbiol. 2020;18(2):67–83. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 42.Mayo-Muñoz D, Pinilla-Redondo R, Birkholz N, Fineran PC. A host of armor: prokaryotic immune strategies against mobile genetic elements. Cell Rep. 2023;42(7):112672. [DOI] [PubMed] [Google Scholar]
  • 43.Mayo-Muñoz D, Pinilla-Redondo R, Camara-Wilpert S, Birkholz N, Fineran PC. Inhibitors of bacterial immune systems: discovery, mechanisms and applications. Nat Rev Genet. 2024;25(4):237–54. [DOI] [PubMed] [Google Scholar]
  • 44.Mohanraju P, Makarova KS, Zetsche B, Zhang F, Koonin EV, van der Oost J. Diverse evolutionary roots and mechanistic variations of the CRISPR-Cas systems. Science. 2016;353(6299):aad5147. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 45.Parks DH, Chuvochina M, Rinke C, Mussig AJ, Chaumeil P-A, Hugenholtz P. GTDB: an ongoing census of bacterial and archaeal diversity through a phylogenetically consistent, rank normalized and complete genome-based taxonomy. Nucleic Acids Res. 2022;50(D1):D785–94. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 46.Partridge SR, Kwong SM, Firth N, Jensen SO. Mobile genetic elements associated with antimicrobial resistance. Clin Microbiol Rev. 2018;13. 10.1128/CMR.00088-17. [DOI] [PMC free article] [PubMed]
  • 47.Payne LJ, Hughes TCD, Fineran PC, Jackson SA. New antiviral defences are genetically embedded within prokaryotic immune systems. bioRxiv. 2024. 10.1101/2024.01.29.577857.
  • 48.Payne LJ, Meaden S, Mestre MR, Palmer C, Toro N, Fineran PC, et al. PADLOC: a web server for the identification of antiviral defence systems in microbial genomes. Nucleic Acids Res. 2022;50(W1):W541–50. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 49.Pellow D, Zorea A, Probst M, Furman O, Segal A, Mizrahi I, et al. Scapp: an algorithm for improved plasmid assembly in metagenomes. Microbiome. 2021;9(1):144. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 50.Pérez-Ramos IM, Matías L, Gómez-Aparicio L, Godoy Ó. Functional traits and phenotypic plasticity modulate species coexistence across contrasting climatic conditions. Nat Commun. 2019;10(1):2555. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 51.Pinilla-Redondo R, Russel J, Mayo-Muñoz D, Shah SA, Garrett RA, Nesme J, et al. CRISPR-Cas systems are widespread accessory elements across bacterial and archaeal plasmids. Nucleic Acids Res. 2022;50(8):4315–28. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 52.Portela J, Grunau C, Cosseau C, Beltran S, Dantec C, Parrinello H, et al. Whole-genome in-silico subtractive hybridization (WISH)–using massive sequencing for the identification of unique and repetitive sex-specific sequences: the example of Schistosoma mansoni. BMC Genomics. 2010;11(1):387. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 53.Pradier L, Tissot T, Fiston-Lavier A-S, Bedhomme S. Plasforest: a homology-based random forest classifier for plasmid detection in genomic datasets. BMC Bioinformatics. 2021;22(1):349. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54.Prjibelski A, Antipov D, Meleshko D, Lapidus A, Korobeynikov A. Using SPAdes de novo assembler. Curr Protoc Bioinformatics. 2020;70(1):e102. [DOI] [PubMed] [Google Scholar]
  • 55.Redondo-Salvo S, Fernández-López R, Ruiz R, Vielva L, de Toro M, Rocha EPC, et al. Pathways for horizontal gene transfer in bacteria revealed by a global map of their plasmids. Nat Commun. 2020;11(1):3602. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 56.Robertson J, Nash JHE. MOB-suite: software tools for clustering, reconstruction and typing of plasmids from draft assemblies. Microb Genom. 2018;4(8):e000206. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 57.Roux S, Camargo AP, Coutinho FH, Dabdoub SM, Dutilh BE, Nayfach S, et al. IpHop: an integrated machine learning framework to maximize host prediction for metagenome-derived viruses of archaea and bacteria. PLoS Biol. 2023;21(4):e3002083. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 58.Russel J, Pinilla-Redondo R, Mayo-Muñoz D, Shah SA, Sørensen SJ. CRISPRCasTyper: automated identification, annotation, and classification of CRISPR-Cas loci. CRISPR J. 2020;3(6):462–9. [DOI] [PubMed] [Google Scholar]
  • 59.Satam H, Joshi K, Mangrolia U, Waghoo S, Zaidi G, Rawool S, et al. Next-generation sequencing technology: current trends and advancements. Biology. 2023;12(7). 10.3390/biology12070997. [DOI] [PMC free article] [PubMed]
  • 60.Schmartz GP, Hartung A, Hirsch P, Kern F, Fehlmann T, Müller R, et al. PLSDB: advancing a comprehensive database of bacterial plasmids. Nucleic Acids Res. 2022;50(D1):D273–8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 61.Schwengers O, Barth P, Falgenhauer L, Hain T, Chakraborty T, Goesmann A. Platon: identification and characterization of bacterial plasmid contigs in short-read draft assemblies exploiting protein sequence-based replicon distribution scores. Microb Genom. 2020;6(10). 10.1099/mgen.0.000398. [DOI] [PMC free article] [PubMed]
  • 62.Skurnik M, Alkalay-Oren S, Boon M, Clokie M, Sicheritz-Pontén T, Dąbrowska K, et al. Phage therapy. Nature Reviews Methods Primers. 2025;5(1). 10.1038/s43586-024-00377-5.
  • 63.Stalder T, Press MO, Sullivan S, Liachko I, Top EM. Linking the resistome and plasmidome to the microbiome. ISME J. 2019;13(10):2437–46. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 64.Stanley SY, Maxwell KL. Phage-encoded anti-CRISPR defenses. Annu Rev Genet. 2018;52:445–64. [DOI] [PubMed] [Google Scholar]
  • 65.Steinegger M, Söding J. MMseqs2 enables sensitive protein sequence searching for the analysis of massive data sets. Nat Biotechnol. 2017;35(11):1026–8. [DOI] [PubMed] [Google Scholar]
  • 66.Tao S, Chen H, Li Na, Wang T, Liang W. The spread of antibiotic resistance genes in vivo model. The Canadian Journal of Infectious Diseases & Medical Microbiology = Journal Canadien Des Maladies Infectieuses et de La Microbiologie Medicale / AMMI Canada. 2022;2022(July):3348695. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 67.Tesson F, Hervé A, Mordret E, Touchon M, d’Humières C, Cury J, et al. Systematic and quantitative view of the antiviral arsenal of prokaryotes. Nat Commun. 2022;13(1):2561. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 68.Torres-Barceló C. Phage therapy faces evolutionary challenges. Viruses. 2018;10(6):323. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 69.Tully B. Quality assessment: FastQC v1. 2016. 10.17504/protocols.io.fa3bign.
  • 70.Villanueva RAM, Chen ZJ. ggplot2: elegant graphics for data analysis (2nd ed.). Meas Interdiscip Res Perspect. 2019;17(3):160–7. [Google Scholar]
  • 71.Wang W, Ren J, Tang K, Dart E, Ignacio-Espinoza JC, Fuhrman JA, et al. A network-based integrated framework for predicting virus-prokaryote interactions. NAR Genom Bioinform. 2020;2(2):lqaa044. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 72.Wengenroth L, Berglund F, Blaak H, Chifiriuc MC, Flach C-F, Gradisteanu Pircalabioru G, et al. Antibiotic resistance in wastewater treatment plants and transmission risks for employees and residents: the concept of the AWARE study. Antibiotics. 2021;10(5):478. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 73.Wood DE, Lu J, Langmead B. Improved metagenomic analysis with Kraken 2. bioRxiv. 2019. bioRxiv. 10.1101/762302. [DOI] [PMC free article] [PubMed]
  • 74.World Health Organization. Antimicrobial resistance. Global report on surveillance. Genève, Switzerland: World Health Organization; 2014. [Google Scholar]
  • 75.Yan Y, Zheng J, Zhang X, Yin Y. dbAPIS: a database of anti-prokaryotic immune system genes. Nucleic Acids Res. 2024;52(D1):D419–25. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 76.Yuan T, Pian Y. Hospital wastewater as hotspots for pathogenic microorganisms spread into aquatic environment: a review. Front Environ Sci. 2023;10(January). 10.3389/fenvs.2022.1091734.
  • 77.Yu Z, He W, Klincke F, Madsen JS, Kot W, Hansen LH, et al. Insights into the circular: the cryptic plasmidome and its derived antibiotic resistome in the urban water systems. Environ Int. 2024;183(108351):108351. [DOI] [PubMed] [Google Scholar]
  • 78.Zhang Lu, Huang X, Zhou J, Feng Ju. Active predation, phylogenetic diversity, and global prevalence of myxobacteria in wastewater treatment plants. ISME J. 2023;17(5):671–81. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 79.Zhao X. Bindash, software for fast genome distance estimation on a typical personal laptop. Bioinformatics. 2019;35(4):671–3. [DOI] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

40168_2025_2297_MOESM1_ESM.pdf (6.3MB, pdf)

Additional file 1: Supplementary Figures (PDF). Figure S1. Overview of the UWS Treatment Flow and Sampling Strategy. This schematic illustrates the key treatment steps and corresponding sampling points across three representative urban wastewater systems (UWSs). Wastewater originated from hospital sewage (HS) and residential sewage (RS) first entering the mixed sewer (MS) pipeline, followed by passage through the primary settler. In Denmark and Spain, the flow subsequently continued into a biological treatment basin, whereas in the United Kingdom, a biofilter was used instead. Effluent from all systems then passed through a secondary settler before being discharged into the downstream river (RU). The infrastructure layout and sampling framework were adapted from [77], which provided a detailed description of the UWS designs. National flags indicate the sampling sites corresponding to each country’s UWS. Figure S2. Workflow for the Identification and Classification of Chromosome, Plasmids and Phages Contigs from Metagenomic and Plasmidome Datasets. This workflow outlines the processing of samples through parallel metagenome and plasmidome assembly pipelines. Plasmid contigs, both linear and circular, are identified using Platon, PlasForest, SCAPP, and MetaPlasmidSPAdes. Contig classification into chromosomes, plasmids and phages is performed using GeNomad and Plaspline. Redundant sequences are removed using MMSeqs2 with a 90% identity and 90% coverage threshold. Circular plasmids are further validated with PlasmidVerify. The final output consists of 3,065,959 chromosomal contigs, 83,919 plasmid contigs, and 52,485 phage contigs. Numbers in parentheses indicate the number of contigs retained at each processing step. Figure S3. Gene annotation and downstream analysis pipeline for classified genomic contigs. Functional annotation of classified contigs from 78 samples using multiple tools including PADLOC, DefenseFinder, and CRISPRCasTyper for defense systems; dbAPIS database for anti-defense annotation; proMGE database and MGEfams for MGEs annotation; and various specialized tools for plasmid-host prediction, phage taxonomy, and spacer identification. Abundance calculations are performed using BWA mapping and TPM normalization. Quality filtering removes contigs with mapping rates <55%, and redundancy is removed using MMSeqs2 (90% identity, 90% coverage). Final outputs include annotated defense/anti-defense systems, taxonomically classified contigs, and abundance profiles. Figure S4. Comparison of plasmid length distributions recovered from metagenome versus plasmidome assemblies. This figure presents density plots comparing the length distribution (X-axis, "Plasmid length (bp)") of plasmids identified from the metagenome assembly (dark blue line) versus those identified from the plasmidome assembly (light blue line). The bottom panel shows the overall distribution up to 100k bp, while the top panel provides a zoomed-in view of the high-density peak for smaller plasmids (0-20k bp). The plots visually confirm that the two methods capture complementary, yet distinct, subsets of the plasmid pool: the plasmidome method preferentially recovered 3,995 smaller plasmids (light blue peak < 20k bp), whereas the metagenome assembly was more effective at reconstructing 1,987 larger plasmids (dark blue peaks > 20k bp). This analysis confirms that our combined strategy, which identified 583 plasmids common to both methods, provides a far more comprehensive picture than either method could alone. Figure S5. Differences in Bray–Curtis distances of defense system composition across groups. Boxplots show within-group (red) and between-group (blue) Bray–Curtis dissimilarities of defense system gene abundance profiles, calculated across 78 wastewater samples. (Left) Comparisons by country (DK: Denmark, SP: Spain, UK: United Kingdom); (Right) comparisons by compartment (HS: Hospital Sewer, RS: Residential Sewer, MS: Mixed Sewer, BTP: Biological Treatment Process). Significance was assessed by two-sided Wilcoxon rank-sum tests. P values were adjusted using the Bonferroni method. Asterisks indicate significance levels (P ≤ 0.05, P ≤ 0.01, P ≤ 0.001, P ≤ 0.0001); “ns” denotes non-significant differences. Figure S6. Phylum-defense system associations across wastewater compartments in Denmark, Spain and United Kingdom. Chord diagrams showing compartment-specific associations between bacterial phyla and defense systems based on gene abundance in hospital sewer (HS), residential sewer (RS), mixed sewer (MS), and biological treatment process (BTP) in DK (Denmark, top row), SP (Spain, middle row) and UK (United Kingdom, bottom row). Each chord connects a bacterial phylum (colored according to legend) with a defense system, with chord thickness representing the strength of association. All three countries show reduced complexity of phylum-defense connections in BTP compared to sewage compartments (HS, RS, MS), while maintaining distinct country-specific patterns. Figure S7. Feature subsampling curve of Bray-Curtis distances. Rarefaction analysis showing mean Bray-Curtis distances across different numbers of features sampled for taxonomic profiles at different levels (phylum to species) and defense systems. Each line represents a different taxonomic level or defense systems, with error bars indicating standard deviation. The analysis confirms that defense systems (pink line) maintain consistently lower Bray-Curtis dissimilarity values compared to all taxonomic levels, regardless of the number of features sampled. This rarefaction approach validates that the observed conservation of defense system composition across samples (as shown in Fig. 2g) is not an artifact of differential feature abundance but represents a genuine biological pattern of defense system stability in urban wastewater environments. Figure S8. Distribution of rarefied Bray–Curtis distances by feature type. This boxplot compares the distribution of all pairwise between-sample Bray–Curtis dissimilarities (Y223 axis) for taxonomic profiles, defense systems, and antibiotic resistance genes (AMR) following feature rarefaction. Each boxplot represents the entire distribution of dissimilarity values for a specific feature category (X-axis), including taxonomic ranks, defense systems at two granularities, and AMR genes as a functional gene control. The analysis confirms that defense systems exhibit a significantly lower median dissimilarity compared to all finer taxonomic ranks. Crucially, it also shows that defense systems are significantly more stable than antibiotic resistance genes, which show a much higher median dissimilarity. Figure S9. Extended analysis of defense system enrichment patterns between plasmids and chromosomes. Heatmap showing the abundance and genomic location (plasmid vs. chromosome) of the top 100 defense systems across all 78 samples. Samples are grouped by compartment and country; defense systems are ordered by increasing tendency for plasmid association. The left panel shows log-transformed relative abundance across samples, with intensity reflecting defense system abundance. The right panels display: (1) Defense enrichment (log scale) showing overall abundance, (2) Normalized abundance on plasmids (blue), (3) Normalized abundance on chromosomes (red), and (4) Log2 fold change (Log2FC) indicating plasmid vs. chromosome preference. Most defense systems show enrichment on plasmids (positive Log2FC values), with only a few systems like PD-T4-6 showing strong chromosomal preference (negative Log2FC values). This comprehensive analysis expands upon Fig. 3a by including all defense system categories and demonstrating the consistent pattern of plasmid enrichment across the broader defense system repertoire. Figure S10. Extended taxonomic breadth analysis of plasmids with different mobility types. Box plots comparing taxonomic breadth across all taxonomic levels (Phylum, Class, Order, Family, Genus, Species) among plasmids with different mobility types, based on the number of unique taxa of plasmids with defense (top row) and plasmids without defense (bottom row). Each dot represents the number of unique predicted host taxa for plasmids of a given mobility type within one country compartment group. This comprehensive analysis extends Fig. 3e by including Class, Order, and Family levels, demonstrating that conjugative plasmids consistently show the highest taxonomic breadth across all taxonomic levels, followed by mobilizable plasmids, while non-mobilizable plasmids show the most restricted host range. The pattern is consistent regardless of defense system presence, with plasmids carrying defense systems showing slightly broader taxonomic breadth at finer taxonomic resolutions. Figure S11. MGE-defense co-occurrence patterns on chromosomes. Dot plot showing cooccurrence frequencies between the top 100 defense system subtypes (y-axis) and top 100 MGE subtypes (x-axis) on chromosomal contigs. Each dot represents a co-occurrence event, with dot size indicating co-occurrence frequency (30-120 events) and color representing MGE functional categories: conjugative (blue), integrase (light blue), mobilization (orange), recombinase (pink), resolvase (light gray), and transposase (green). The analysis reveals distinct co-localization preferences between specific defense systems and MGE elements. This comprehensive view expands the network analysis shown in Fig. 4c by providing quantitative co-occurrence data for the full spectrum of defense-MGE interactions on chromosomes, demonstrating the complex mobilization patterns that facilitate horizontal gene transfer of defense systems. Figure S12. MGE-defense co-occurrence patterns on plasmids. Dot plot showing co-occurrence frequencies between the top 100 defense system subtypes (y-axis) and top 100 MGE subtypes (x-axis) on plasmid contigs. Each dot represents a co-occurrence event, with dot size indicating co-occurrence frequency (50-250 events) and color representing MGE functional categories: conjugative (blue), integrase (light blue), mobilization (orange), recombinase (pink), resolvase (light gray), and transposase (green). The analysis reveals more frequent and intensive co-localization events on plasmids compared to chromosomes (Figure S8), with particularly strong associations between defense systems like SoFic, AbiE, Gabija, and RM systems with various conjugative and transposase elements. This enhanced cooccurrence pattern on plasmids demonstrates their role as active vehicles for coordinated mobilization of defense systems and MGE elements, supporting the findings presented in Fig. 4c regarding plasmid-mediated horizontal gene transfer of bacterial immunity. Figure S13. MGE-defense co-localization network on chromosomes. Network visualization showing co-localization patterns between defense systems (blue nodes) and MGE elements (orange nodes) identified on chromosomal contigs. Node size reflects relative abundance, while edge thickness represents the strength of co-localization associations. The network reveals distinct co-localization preferences between specific defense systems and MGE elements on chromosomes, with some defense systems like SoFic, AbiE, and RM systems showing strong associations with various MGE elements including rve, HTH_Tnp_1, and integrase elements. This chromosomal network complements Fig. 4c (plasmid network) by demonstrating that while defense-MGE co-localization occurs on both genomic contexts, the patterns and intensities differ between chromosomes and plasmids, reflecting distinct mobilization mechanisms and evolutionary pressures in these two genomic. Figure S14. Additional examples of defense system mobilization across genomic contexts. Representative gene map showing co-localization and potential transfer of defense system genes (blue arrows) and MGE-associated genes (orange arrows) across different genomic elements, including plasmids and chromosomes. Each panel represents a distinct transfer scenario observed in the dataset, annotated by sample origin, genomic location (e.g., plasmid mobilizability), and taxonomic assignment. Sequence similarity between homologous regions is indicated by colored blocks connecting genes (percent identity shown). These cases extend the examples shown in Fig. 4d, further illustrating diverse patterns of horizontal gene transfer involving defense systems across environmental compartments and host taxa. Figure S15. Additional representative examples of matched defense and anti-defense systems across genomic contexts. Gene map diagrams illustrating co-occurrence and pairing of defense systems (dark blue arrows) and their corresponding anti-defense systems (light gray arrows) across phage, plasmid, and chromosomal contigs. Each panel shows a matched pair, identified based on spacer-target network analysis, representing functional couplings such as Anti-CRISPR with CRISPR352 Cas systems, Anti-RM with restriction-modification systems, and Anti-CBASS, Anti-Retron, or Anti-Thoeris systems with their respective counterparts. These examples span diverse hosts (e.g., Hydrogenophaga, Klebsiella, Acinetobacter) and genomic locations (e.g., phage-plasmid, chromosome-phage), and demonstrate the structural organization and potential mobilization patterns of immune–counter-immune elements. These cases complement those shown in Fig. 5g.

40168_2025_2297_MOESM2_ESM.xlsx (1.5MB, xlsx)

Additional file 2: Supplementary Tables (Excel). Table S1. Comprehensive sample metadata and sampling details. Table S2. Statistical analysis results. Table S3. Sample grouping information and contig annotation summary. Table S4. Standardized defense system nomenclature mapping. Table S5. Defense systems abundance data across all samples. Table S6. Group-specific defense system subtypes. Table S7. Defense system enrichment in the top 400 most abundant bacterial species. Table S8. Standardized MGE nomenclature mapping. Table S9. MGE abundance data across all samples. Table S10. Statistically significant MGE-defense co-localization events. Table S11. Anti-defense system nomenclature standardization. Table S12. Anti-defense system abundance across samples. Table S13. Plasmid and phage host prediction results. Table S14.CRISPR spacer-based linkage between defense and anti-defense systems.

Data Availability Statement

All the code can be found in this GitHub repository: [https://github.com/marveloushaotian/DURIS] (https:/github.com/marveloushaotian/DURIS). All results and associated scripts can be found in this Google Drive: [https://drive.google.com/drive/folders/11hMwINQzWZnb6MNSJNY4AT9G3xdLEOaZ] (https:/drive.google.com/drive/folders/11hMwINQzWZnb6MNSJNY4AT9G3xdLEOaZ). The original data tables used to support and reproduce the analysis are available in this Zenodo repository: 10.5281/zenodo.14883504. The raw sequences used in this study are available on NCBI SRA at BioProject accession number PRJEB85938.


Articles from Microbiome are provided here courtesy of BMC

RESOURCES