Stand alone version of ARTIC's fieldbioinformatics align_trim.py. It assigns aligned reads from a tiling amplicon scheme to their amplicons, soft-clips the primers and can normalise depth per amplicon.
From conda
conda install bioconda::align_trimfrom pypi
pip install align_trimfrom source
git clone https://github.com/artic-network/align_trim.git
cd align_trim
uv sync
uv run align_trim --helpalign_trim primer.bed --samfile input.bam --output trimmed.bamprimer.bedis the primer scheme in primer.bed v3 format.input.bamis a sorted BAM of reads aligned to the scheme's reference. Leave out--samfileto read SAM/BAM from stdin.- The output format follows the extension (
.bamor.sam). Leave out--outputto write SAM to stdout.
Normalise to 200x per amplicon and write the genome coverage and amplicon QC reports:
align_trim primer.bed --samfile input.bam --output trimmed.bam \
--normalise 200 --qc-prefix sample1| option | meaning |
|---|---|
--normalise N, -n |
keep reads until each amplicon reaches a depth of N fragments (a read pair counts once). 0 turns it off (default) |
--min-mapq, -m |
minimum mapping quality (default: 20) |
--primer-match-threshold, -p |
how far, in bases, a read end can be from a primer and still match it (default: 5) |
--allow-incorrect-pairs |
keep reads whose two ends match primers from different amplicons (reads inside two neighbouring amplicons are still removed) |
--require-full-length |
only keep reads spanning a whole amplicon (not for rapid barcoding or other fragmented libraries) |
--no-trim-primers |
assign reads but leave primers untrimmed |
--qc-prefix PREFIX |
write the genome coverage and amplicon QC reports as PREFIX.<name>.tsv |
Run align_trim --help for every option. Progress, coverage and QC summaries and warnings are printed to stderr; see terminal output.
- Usage: every option, examples and output formats
- Report outputs:
--report,--amp-depth-reportand the genome coverage reports - QC reports: the
--qc-prefixreports and how to read them - Changelog: changes in each release, including behaviour changes in 2.0.0