vcf-fix-newlines
Quick Start
- Command:
vcf-fix-newlines [OPTIONS] [file.vcf|file.vcf.gz] > out.vcf - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/vcf-fix-newlines - Full reference: See
references/help.md
When To Use This Tool
- Normalize a VCF transferred from Windows or legacy systems before downstream parsing.
- Detect whether a file's newline style matches the current platform with
-i. - Clean a plain VCF or
.vcf.gzbefore feeding it into stricter tooling. - Repair line-ending issues without changing the variant content itself.
Common Patterns
# 1) Report the source newline style only
vcf-fix-newlines -i file.vcf
# 2) Normalize a gzipped VCF into a plain-text output VCF
vcf-fix-newlines file.vcf.gz > fixed.vcf
# 3) Normalize a streamed VCF
cat file.vcf | vcf-fix-newlines > fixed.vcf
Recommended Workflow
- Probe first with
-iif you are not sure whether newline normalization is actually needed. - Convert into a new output file instead of trying to overwrite the source.
- Recompress and reindex afterward if the downstream pipeline expects
.vcf.gzplus tabix. - Validate the resulting VCF with a parser once the line endings are fixed.
Guardrails
- On this Linux machine, if the input already uses
\n, the tool printsNo conversion needed.and exits without echoing the file to stdout; do not use it as a transparent pass-through stage. .vcf.gzinput relies ongunzip -cbeing available.-ionly reports the detected platform / newline style; it does not emit the converted file.- This script determines newline style from an initial sample of the file and errors if the format is too inconsistent to classify cleanly.
- The tool writes normalized content to stdout, so always redirect it to a new file.