samtools-ampliconclip(1)
π samtools-ampliconclip(1) β the clip different π
okay bestie, so this is the samtools ampliconclip page, from the samtools(1) manual family, and it's genuinely one of the most useful little gremlins in the whole toolbox. Sit down, hydrate, let's go π«Ά
β¨ NAME β¨
samtools ampliconclip β clip reads using a BED file. that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
samtools ampliconclip [-o out.file] [-f stat.file] [--soft-clip]
[--hard-clip] [--both-ends] [--strand] [--clipped] [--fail] [--filter-
len INT] [--fail-len INT] [--unmap-len INT] [--no-excluded] [--rejects-
file rejects.file] [--original] [--keep-tag] [--tolerance] [--no-PG]
[-u] -b bed.file in.file
like, feed it a BED file and a file of reads and it does its thing. iconic. π
π¦ DESCRIPTION π¦
okay so what it actually does: it clips the ends of read alignments if they intersect with regions defined in a BED file. that's the whole bit. and even though this tool was originally written for clipping read alignment positions which correspond to amplicon primer locations, it can also be used in other contexts. so don't feel boxed in, bestie β it's versatile π
the BED file entries it uses are chrom, chromStart, chromEnd and, optionally, strand. standard BED file format must be used, so if strand is needed then the name and score fields must also be present (even though ampliconclip does not read them β they're literally just standing there for format compliance, main character energy of them tbh). there is a default tolerance of 5 bases when matching chromStart and chromEnd to alignments.
by default the reads are soft clipped and the clip is only done from the 5' end. the way that 5'-end-only default just keeps things chill π
now the things to be aware of section, and ngl, this part matters:
- while ordering is not significant, adjustments to the left most mapping position (POS) will mean that coordinate sorted files will need resorting. in such cases the sorting order in the header is set to unknown. so like, heads up π«
- clipping of reads results in template length (TLEN) being incorrect. this can be corrected by
samtools fixmates. - any
MDandNMaux tags will also be incorrect, which can be fixed bysamtools calmd. by defaultMDandNMtags are removed though, if the output is in CRAM format these tags will be automatically regenerated. cute little regeneration moment β¨
π real talk: those TLEN andMD/NMcaveats are not optional reading. if you skip them and then act surprised about your stats, that's on you, bestie. fix your mates, run yourcalmd, be free.
π₯ OPTIONS π₯
-bFILE β BED file of regions (e.g. amplicon primers) to be removed. this one's not really optional, it's the whole point.-oFILE β output file name (defaults tostdout). no file, no problem, it'll just scream into your terminal.-fFILE β file to write stats to (defaults tostderr).-uβ output uncompressed SAM, BAM or CRAM. raw, unfiltered, no compression, we love a low-key chaotic choice.--soft-clipβ soft clip reads (default). the OG behavior, the standard, the moment.--hard-clipβ hard clip reads. gone gone, not just flagged. π--both-endsβ clip at both the 5' and the 3' ends where regions match. when using this option the--strandoption is ignored. so like, don't bother passing both, it won't listen.--strandβ use thestrandentry from the BED file to clip on the matching forward or reverse alignment. directional girlie behavior π§--clippedβ only output clipped reads. filter all others. if it wasn't clipped, it's not invited to the party π--failβ mark unclipped reads as QC fail. instead of ghosting them, you're publicly labeling them π--filter-lenINT β filter out reads of INT size or shorter. in this case soft clips are not counted toward read length. an INT of0will filter out reads with no matching bases. so0basically means "if it's not matching anything, it's out."--fail-lenINT β as--filter-lenbut mark as QC fail rather then filter out. same energy, different exit strategy.--unmap-lenINT β as--filter-lenbut mark as unmapped. default is0(no matching reads).-1will disable. so-1is the "actually never mind" setting.--no-excludedβ filter out any reads that are marked asQCFAILor are unmapped. this works on the state of the reads before clipping takes place. important detail, don't forget it.--rejects-fileFILE β write any filtered reads out to a file. the rejected get their own little club π--primer-countsFILE β file to write with read counts per bed entry (bedgraph format). stats girlies, this one's for you π--originalβ add anOAtag with the original data for clipped files. receipts, kept π--keep-tagβ in clipped reads, keep the possibly invalidNMandMDtags. by default these tags are deleted. (see the description β they're wrong anyway, so like, choose consciously π)--toleranceINT β the amount of latitude given in matching regions to alignments. default5bases. be as generous or as strict as you want β¨--no-PGβ do not at a PG line to the header. (that typo is in the original, we're keeping it, it's part of the lore π)
π AUTHOR π
written by Andrew Whitwham and Rob Davies, both from the Sanger Institute. legends, honestly. π«Ά
β SEE ALSO β
samtools website: <http://www.htslib.org/> π
okay and the cute little sign-off: this was samtools-1.24, dated 9 July 2026, and it's the samtools-ampliconclip(1) page in all its glory. go clip something, bestie β and remember to fix your mates after ππ
π¦ where this page comes from
- epel 10: samtools 1.24-2.el10_3 Β· MIT
- nixpkgs unstable: samtools 1.24
- Copyright (C) 2008-2011, 2013-2021 Genome Research Ltd
- copyright (C) 2010, 2011 Broad Institute
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms