samtools-addreplacerg(1)
π samtools-addreplacerg β the read-group glow-up tool
Hey bestie, so this is from the samtools manual, page samtools-addreplacerg (like, the whole samtools suite, but this specific little icon). It's the one you call when your BAM file's read groups are looking a mess and you need to fix the vibes. β¨
πΈ NAME πΈ
samtools addreplacerg β adds or replaces read group tags. That's it, that's the whole job. It adds them, it replaces them, it slays.
π SYNOPSIS π
samtools addreplacerg [-r rg-line | -R rg-ID] [-m mode] [-u] [-o
out.bam] in.bam
π DESCRIPTION π
Okay so picture this: you've got a file, and its read group tags are either missing or just not it. This command adds or replaces read group tags in a file. And because it's an overachiever, it also lets you add and update the @RG lines up in the header. Both. At once. Main character energy honestly. π
β¨ OPTIONS β¨
-rSTRING β lets you specify a read group line to append to the header, and then it applies that to the reads picked out by the-moption. And here's the cute part: if you repeat it, it automatically adds tabs between invocations. No cap, it just does it for you. π«Ά-RSTRING β lets you specify the read group ID of an existing@RGline, and it applies that to the reads you specified.-mMODE β picks the mode, bestie. If you chooseorphan_onlythen existing RG tags are not overwritten. If you chooseoverwrite_all, existing RG tags are overwritten. The default isoverwrite_all.-oSTRING β writes the final output to STRING. The default is to write to stdout. Also, by default,samtoolstries to select a format based on the output filename extension; if the output is going to standard output, or if no format can be deduced,samis selected.-uβ output uncompressed SAM, BAM or CRAM. Straight up, no compression, raw vibes.-wβ overwrite an existing@RGline, but only if a new one with the same ID value is provided. Conditional icon. π--no-PGβ do not add a@PGline to the header of the output file. If you don't want that line, you don't get that line.-@,--threadsINT β number of input/output compression threads to use in addition to the main thread. Default is[0]. Give it more threads if you're feeling impatient. π₯
π AUTHOR π
Written by Martin Pollard from the Sanger Institute. Respect the author, fr fr.
π SEE ALSO π
Samtools website: <http://www.htslib.org/>
ngl bestie, this one's pretty forgiving β but rememberoverwrite_allis the default, so if you didn't want your existing RG tags clobbered, you gotta sayorphan_onlyout loud. Choose your mode deliberately, okay? π
That's the whole page! Shoutout to samtools-1.24, dated 9 July 2026 β that's the version and date this little diva came from. Go forth and tag your reads. π¦π
π¦ where this page comes from
- epel 10: samtools 1.24-2.el10_3 Β· MIT
- nixpkgs unstable: samtools 1.24
- Copyright (C) 2008-2011, 2013-2018, 2020 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