Twitcher
Template switch aligner.
A tool to find and annotate short-range template switch mutations (TSMs). We want to explain clusters of SNVs/MNVs/indels with one or more short-range template switches (Löytynoja and Goldman (2017)).
The tool operates in two stages:
- While reading the input (a VCF or BAM file, from stdin or a file), find suspicious™ clusters of SNVs, MNVs and indels, e.g. at least 2 variants with at most 20 bp between consecutive ones.
- Realign those clusters under consideration of a few hundred surrounding base pairs. If the mutation cluster can be better explained with one or more template switches, output the new, reannotated VCF records instead of the original ones, and/or a CSV row describing the event.
In vcf mode, the tool is designed to enrich the VCF file with more information. Unaffected records are output as-is.
For a more thorough, user-facing introduction see the Overview.
Installation
Prebuilt binary (Linux, x86-64)
Every release ships a prebuilt binary; no Rust toolchain required:
The binary is built for portability (x86-64-v2, glibc ≥ 2.17); for best performance build from source. See the installation docs for checksum verification and version pinning.
From source
You can also install the tool from source using cargo (needs at least version 1.95.0):
Get cargo e.g. via rustup. You'll also need the clang C compiler to compile the underlying htslib bindings.
Usage
Twitcher has two main commands:
twitcher vcf— Re-annotate VCF files with template switch mutationstwitcher reads— Find template switch mutations in sequencing reads
and twitcher viz to render found template switches as SVGs.
Quick Start
This realigns suspicious mutation clusters and outputs reannotated variants.
Full Documentation
Complete documentation is available in docs/.
Examples
# Realign with larger context window
# Only output realigned variants
# Additionally write a CSV with details on every template switch
# Use reads to (try to) phase ambiguous clusters
# Export template switch regions
# Use a database to store known cases
# Scan reads for template switches, then render the hits as SVGs
Development
See CONTRIBUTING.md for the architecture and contribution guidelines.
Background
The underlying pairwise aligner, tsalign, is developed by Sebastian Schmidt.