Introduction

Horizontal gene transfer (HGT) can markedly affect the evolutionary fate of microbes [1,2,3]. Besides transformation—where bacteria directly take up environmental DNA—all horizontal movement of genetic material is catalysed by mobile genetic elements (MGEs), Darwinian entities with dynamics of their own [4]. Last century, a multiplicity of MGEs has been observed, ranging from the distinctly parasitic bacteriophages [5,6,7,8,9] and transposons [10,11,12], to plasmids [13,14,15], and integrative and conjugative elements (ICEs) [16,17,18,19]. More recently, new mobile elements are being discovered all across the microbial world, such as REPINs [20, 21], Starships [22], and Borgs [23], and even entire fungal chromosomes appear to be on the move [24,25,26].

The relationship between MGEs and hosts are complex, ever changing, and highly context-dependent. For example, while conjugative elements are typically benign, they may also promote self-survival at the expense of hosts [19, 27]. Similarly, while bacteriophages are typically predatory or parasitic, they can be co-opted to benefit hosts [5, 28,29,30]. Moreover, MGEs may recombine with one another or parasitise other mobile elements [31,32,33,34,35]. Taken together, these processes may be fundamental to our understanding of microbial communities as collections of locally adaptive genes, rather than locally adapted species [36, 37]. While the scope and scale of DNA flux through microbial communities via MGEs is currently poorly understood, recent work suggests that the flux may be highly significant even to the extent that it defines and drives a community-level process with effects similar to sex within populations [38, 39].

In addition to moving genes necessary for self-replication and transmission, MGEs often mediate transfer of host genes to which they become linked. Whether by design, or accident, MGEs that acquire genes that enhance host fitness stand to be rapidly amplified by selection with captured genes being widely disseminated. On occasion the effects can be highly consequential, for example, movement of ICEs carrying genes for nodulation and nitrogen fixation convert non-symbiotic rhizobia into plant symbionts in a single step [40, 41]. ICEs have also been identified by observing the movement of antimicrobial resistance [42, 43], and heavy metal resistance genes [18]. However, such routes to discovery depend on both abilities to culture focal microbes and carriage of selectable phenotypic traits.

With increasing ability to sequence complex communities, discovery of MGEs has been fuelled by metagenomics through culture-independent assembly of DNA replicons, without prior assumptions about biological relevance. Moreover, bioinformatic tools have been developed that can separate a wide range of candidate MGEs from microbial hosts [44,45,46,47,48,49,50,Full size image

Here, we describe a broadly applicable ‘xenoseq’ pipeline (github.com/bramvandijk88/xenoseq) that takes as input, raw sequencing reads from time series experiments, and identifies sequences that have been transferred from allopatric communities and amplified by replication in the current community. When applied to metagenomic data from the experiment performed by Quistad et al., we show that xenoseq readily detects candidate MGEs whose dynamics (including community of origin) can be followed through time. One important attribute of xenoseq is ability to distinguish between sequences that are selected due to demographic changes in patterns of species abundance, and those that are horizontally disseminated from an allopatric community. The latter are hereafter referred to as ‘xenotypic sequences’. We show that xenotypic sequences are enriched in recognisable components of phages and IS-elements, that is, canonical selfish genetic elements (SGEs). Less expected was the observation of horizontally transmitted nanobacteria and large plasmids. To explore the dynamics of MGEs through the course of the year-long study, Metagenome-Assembled Genomes (MAGs) were constructed by cross assembly, providing insights into the potential hosts of these unexpected elements, and allowing the dissemination of MGEs to be linked to the community-level changes in ammonia production rates.