A Snakemake pipeline for detecting and classifying horizontal gene transfer (HGT) events from long-read metagenomic assemblies.
Status: pre-release / actively developed. Interfaces, config keys, and output schemas may still change before the first tagged version.
kairos-lr takes a long-read metagenomic assembly and identifies contigs that carry regions of likely horizontally-transferred DNA, based on taxonomic discordance between a region and its host contig, and/or overlapping regions shared between taxonomically distinct contigs. It reports per-event, per-group, and donor–recipient summaries. Do quick assessment of results using companion streamlit tool.
The pipeline covers:
- ORF calling — Prodigal (meta mode), parallelized via input splitting
- Clustering / homology search — identification of homologous gene pairs across contigs
- Taxonomic assignment — per-contig lineage assignment
- HGT detection — two complementary criteria (below)
- HGT classification — hierarchical classification across seven taxonomic ranks (domain → species), union-find grouping of implicated contigs, and donor–recipient inference
- Annotation — functional annotation of HGT-associated regions
- Criteria 1: a region's taxonomic assignment differs from its host contig's assignment.
- Criteria 2: two taxonomically discordant contigs share an overlapping internal region (via pairwise homology search).
For each pair/region, the pipeline records the most inclusive taxonomic rank at which discordance occurs (domain, phylum, class, order, family, genus, species), then groups all implicated contigs globally (not per-rank) using a union-find over every HGT event found at any rank. Where a paired contig in the overlap table shares the region's taxon rather than the host contig's, that paired contig is flagged as the putative donor.
git clone https://github.com/clb21565/kairos-lr.git
cd kairos-lr
conda env create -f environment.yml
conda activate kairos-lrCopy the example config and fill in the required reference database paths:
vi config.yaml'config.yaml` requires (no defaults are provided — the pipeline validates these at startup):
| key | description |
|---|---|
ripdb |
path to RIP database |
mobileog |
path to mobileOG-db |
mobtyper |
path to MOB-typer database |
card |
path to CARD database |
gtdb_db |
path to GTDB reference |
snakemake --cores <N> --configfile config/config.yaml \
--config fasta="<sample>_assembly.fasta" threads=<N>Results are written to result/<sample>/, including:
- Per-level HGT event tables (one per taxonomic rank)
- Global HGT group and group-report tables (
hgt_groups.tsv, compact one-row-per-group summary with distinct-taxon counts per rank) - Per-level donor–recipient pair tables
- Functional annotation of HGT-flanking regions
~25 TSVs are produced per sample in total; see docs/output_schema.md for full column definitions (WIP).
see HGT_viz repo for current draft streamlight app
kairos-lr/
├── Snakefile # entry point; includes rules/, defines rule all
├── config.yaml
├── workflow/
│ ├── rules/
│ │ ├── orf_calling.smk
│ │ ├── clustering.smk
│ │ ├── taxonomy.smk
│ │ ├── hgt_detection.smk
│ │ ├── hgt_classification.smk
│ │ └── annotation.smk
│ └── envs/
├── scripts/ # Python/R logic called by rules
├── test/
│ ├── data/
│ └── expected/
├── docs/
│ ├── hgt_methodology.md
│ └── output_schema.md
└── environment.yml