samtools-reheader - Man Page

replaces the header in the input file

Synopsis

samtools reheader [-iP] [-c CMD | in.header.sam ] in.bam

Description

Replace the header in in.bam with the header in in.header.sam. This command is much faster than replacing the header with a BAM→SAM→BAM conversion.

By default this command outputs the BAM or CRAM file to standard output (stdout), but for CRAM format files it has the option to perform an in-place edit, both reading and writing to the same file. No validity checking is performed on the header, nor that it is suitable to use with the sequence data itself.

Options

-P,  --no-PG

Do not add a @PG line to the header of the output file.

-i,  --in-place

Perform the header edit in-place, if possible.  This only works on CRAM files and only if there is sufficient room to store the new header. The amount of space available will differ for each CRAM file.

-c,  --command CMD

Allow the header from in.bam to be processed by external CMD and read back the result. When used in this manner, the external header file in.header.sam has to be omitted.

CMD must take the original header through stdin in SAM format and output the modified header to stdout. CMD is passed to the system's command shell. Care should be taken to ensure the command is quoted correctly to avoid unwanted shell expansions (for example of $ variables).

CMD must return an exit status of zero.

Examples

Author

Written by Heng Li with modifications by James Bonfield and Valeriu Ohan, all from the Sanger Institute.

See Also

samtools(1)

Samtools website: <http://www.htslib.org/>

Referenced By

samtools(1).

7 July 2021 samtools-1.13 Bioinformatics tools