samtools split [options] merged.sam|merged.bam|merged.cram
Splits a file by read group, producing one or more output files matching a common prefix (by default based on the input filename) each containing one read-group.
Records without an RG tag or with an RG tag undefined in the header will cause the program to exit with an error unless the -u option is used.
RG values defined in the header but with no records will produce an output file only containing a header.
The -u option may be used to specify the output filename for any records with a missing or unrecognised RG tag. This option will always write out a file even if there are no records.
Output format defaults to BAM. For SAM or CRAM then either set the format with --output-fmt or use -f to set the file extension e.g. -f %*_%#.sam.
Put reads with no RG tag or an unrecognised RG tag into FILE1
Use the header from FILE2 when writing the file given in the -u option. This header completely replaces the one from the input file. It must be compatible with the input file header, which means it must have the same number of references listed in the @SQ lines and the references must be in the same order and have the same lengths.
Output filename format string (see below) ["%*_%#.%."]
Do not add a @PG line to the header of the output file.
Format string expansions:
|%.||output format filename extension|
Number of input/output compression threads to use in addition to main thread .
Written by Martin Pollard from the Sanger Institute.
samtools (1), samtools-addreplacerg (1)
Samtools website: <http://www.htslib.org/>
Copyright © 2023 Genome Research Limited (reg no. 2742969) is a charity registered in England with number 1021457. Terms and conditions.