The roles of the
-H options in
samtools view and
bcftools view have historically
been inconsistent and confusing.
The 1.15 releases improve this by adding new
head commands alongside the previous releases’
consistent sets of
view long options.
To display only the headers of a SAM/BAM/CRAM or VCF/BCF file, use
samtools head FILE bcftools head FILE
head commands also have options to limit the number of header lines displayed and/or to display the
first few alignment/variant records as well.
When displaying all or a subset of alignment/variant records, the two
view commands differ as to
whether header lines will be included by default:
samtools view omits headers by default;
-h can be used to include them.
bcftools view includes headers by default;
-H can be used to omit them.
view commands accept the same long options specifying whether to include header lines:
samtools view [--no-header] FILE samtools view --with-header|-h FILE bcftools view --no-header|-H FILE bcftools view [--with-header] FILE
The square brackets indicate options that are strictly speaking unnecessary as they select the
default behaviour anyway. However especially in scripts it can be useful to use them for explicitness,
and they have the effect of resetting previously specified
view commands also have an option to display only headers, similarly to
samtools view --header-only FILE bcftools view --header-only FILE
For compatibility with earlier versions, there are also equivalent
view short options.
On the command line we recommend using the more succinct
head commands instead; trying to remember the
view --header-only short options mostly results only in confusion about which of the
does what with which command.
(Note that to be exactly equivalent to
view commands would also need to use
headcommand is new in release 1.15, and the header-related
viewlong options were new in 1.13.
headcommand is new in release 1.15, and the
view --with-headeroption was new in 1.14. (BCFtools view has had
--header-onlysince release 1.0.)
Copyright © 2022 Genome Research Limited (reg no. 2742969) is a charity registered in England with number 1021457. Terms and conditions.