Fast interval similarity and scalable clustering for bacterial transcript units (TUs) from mapped long reads.
This repository ships the Rust trackclustertu CLI.
- Repository: lrslab/trackclusterTU
- License: MIT
For bacteria, each mapped read is treated primarily as a single genomic interval [start, end) using 0-based, half-open coordinates.
Reads are clustered into candidate transcript units using overlap-based similarity.
score1(Jaccard-like):overlap / unionscore2(containment-like):overlap / min(lenA, lenB)
By default, trackclustertu cluster and trackclustertu run use score1 to form seed clusters and then use score2 in a second pass to attach truncated reads.
If you want to keep the score1 seed clusters as the final TUs, pass --skip-score2-attachment.
Prebuilt release tarballs are published from GitHub Actions on tagged releases:
- Releases: lrslab/trackclusterTU/releases
- Artifact naming:
trackclustertu-<tag>-<target>.tar.gz
Download the archive for your platform, extract it, and place trackclustertu somewhere on your PATH.
git clone https://github.com/lrslab/trackclusterTU.git
cd trackclusterTU
cargo build --release --bin trackclustertuThe built executable will be:
target/release/trackclustertu
To install it into Cargo's bin directory instead:
cargo install --path . --bin trackclustertutrackclustertu map and trackclustertu run require these tools to be installed and available on PATH:
minimap2samtools
Tested versions:
minimap2 2.30-r1287samtools 1.22.1
If you only use bam-to-bed, gff-to-bed, cluster, or recount, these external mapping tools are not required.
Help:
trackclustertu --help
trackclustertu run --help
trackclustertu map --help
trackclustertu cluster --help
trackclustertu recount --help
trackclustertu bam-to-bed --help
trackclustertu gff-to-bed --helpDocs and examples:
doc/README.mdexamples/README.md
Quick examples:
trackclustertu cluster \
--in reads.bed \
--format bed6 \
--out-dir resultstrackclustertu cluster \
--manifest samples.bed.tsv \
--format bed6 \
--annotation-bed genes.bed \
--out-dir resultstrackclustertu recount \
--manifest samples.bed.tsv \
--pooled-membership results/membership.tsv \
--out-dir recount_resultstrackclustertu gff-to-bed \
--annotation-gff genes.gff3 \
--out-bed genes.bedtrackclustertu bam-to-bed \
--in-bam sample.sorted.bam \
--out-bed sample.bedSupported workflow:
FASTQ -> sorted BAM -> BED6 -> TU clustering -> TU/gene counts
sample group reads
sampleA control data/sampleA.fastq.gz
sampleB treated data/sampleB.fastq.gzsampleis requiredreadsis requiredgroupis optional
Relative reads paths are resolved relative to the manifest file.
trackclustertu run \
--manifest samples.fastq.tsv \
--reference-fasta ref.fa \
--annotation-gff genes.gff3 \
--out-dir resultsThis writes:
results/bam/<sample>.sorted.bamresults/bam/<sample>.sorted.bam.bairesults/bed/<sample>.bedresults/samples.bam.tsvresults/samples.bed.tsvresults/annotation.bedwhen--annotation-gffis usedresults/tus.bedresults/membership.tsvresults/tu_count.csvresults/gene_count.csvwith annotation
You do not need to run these commands after Step 2.
Use this staged workflow only if you want to run each step separately instead of trackclustertu run.
trackclustertu map \
--manifest samples.fastq.tsv \
--reference-fasta ref.fa \
--out-dir mappedtrackclustertu bam-to-bed \
--manifest mapped/samples.bam.tsv \
--out-dir mappedtrackclustertu gff-to-bed \
--annotation-gff genes.gff3 \
--out-bed genes.bedtrackclustertu cluster \
--manifest mapped/samples.bed.tsv \
--format bed6 \
--score1-threshold 0.95 \
--score2-threshold 0.99 \
--annotation-bed genes.bed \
--out-dir resultsThe default clustering thresholds are --score1-threshold 0.95 and --score2-threshold 0.99.
trackclustertu recount \
--manifest mapped/samples.bed.tsv \
--pooled-membership results/membership.tsv \
--out-dir recount_resultstus.bedmembership.tsvpooled.bedin manifest modetu_count.csvtu_sample_long.tsvin manifest modetu_sample_matrix.tsvin manifest modetu_group_matrix.tsvin manifest mode when groups existtu_gene.tsvwith annotationtus.anchored.bed12with annotationgene_count.csvwith annotationgene_sample_matrix.tsvwith annotation and manifest modegene_group_matrix.tsvwith annotation and group-aware manifest mode
bed6:chrom start end name score strandbed12: transcript span[tx_start, tx_end)is used for TU clusteringtsv:contig start end id strand