vcf-sort
Quick Start
- Command:
vcf-sort [options] < input.vcf > sorted.vcf - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/vcf-sort - Full reference: See
references/help.md
When To Use This Tool
- Sort an unsorted VCF before indexing or downstream comparison.
- Apply natural chromosome ordering with
-cinstead of raw lexicographic order. - Repair ordering after concatenation or ad hoc editing.
- Prefer
bcftools sortin newer pipelines if you want a more actively maintained implementation.
Common Patterns
# 1) Sort a plain-text VCF from stdin
cat input.vcf | vcf-sort > sorted.vcf
# 2) Use natural chromosome ordering
zcat input.vcf.gz | vcf-sort -c > sorted.vcf
# 3) Set a custom temp directory for large sorts
zcat input.vcf.gz | vcf-sort -t /scratch > sorted.vcf
Recommended Workflow
- Decompress or stream the input into stdin because
vcf-sortis stdin-driven. - Use
-cwhen chromosome-like names should follow natural version order. - Write the sorted output to a new file, then recompress and index it if later tools expect
.vcf.gz. - Validate sort order before assuming region-based tools will behave correctly.
Guardrails
- This utility reads from stdin and writes to stdout; it does not take an input filename as a positional argument.
- Natural chromosome ordering with
-cdepends on asortimplementation that supports--version-sort. - Header lines are preserved at the top, but malformed body records can still propagate into the output.
- Remember to
bgzipandtabixthe result if downstream tools require indexed compressed VCF.