htsfile
Quick Start
- Command:
htsfile [OPTIONS] FILE... - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/htsfile - Version: 1.22.1
- Full reference: See
references/help.mdfor complete options and usage details
When To Use This Tool
- Quickly identify whether a file is BAM, CRAM, VCF, BCF, or another HTSlib-supported format.
- View the text form or just the header of a binary HTS file.
- Debug “what format is this file actually?” problems before using heavier tools.
- Use it as a lightweight probe, not a full analysis step.
Common Patterns
# 1) Identify file type
htsfile sample.bam
# 2) Show only the header
htsfile -c -h sample.bam
# 3) View textual representation
htsfile -c sample.bcf
# 4) Copy exact contents
htsfile --copy sample.bam sample.copy.bam
Recommended Workflow
- Use
htsfilefirst when file-type confusion is blocking the workflow. - Switch to
samtoolsorbcftoolsonce the file type is confirmed. - Use header-only viewing when you just need metadata and not the full text dump.
- Keep it as a diagnostic helper in scripts that need early format validation.
Guardrails
--copyis a dedicated mode and requires one source plus one destination.-hand-Hmean opposite things in view mode.htsfileis for inspection and diagnosis, not rich editing or filtering.- Text view of large files can be enormous, so prefer header-only mode when possible.
Guardrails
- The
--copysubcommand requires exactly one source FILE and one DESTFILE - Options
-h(header-only) and-H(no-header) have opposite effects in view mode - Verbosity increases with
-v; use for additional diagnostics and warnings