sam2vcf-pl
Quick Start
- Command:
sam2vcf.pl [OPTIONS] < in.pileup > out.vcf - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/sam2vcf.pl - Reference: See references/help.md
When To Use This Tool
- Convert legacy
samtools pileup -ctext output into VCF. - Filter calls down to SNPs only with
-sor indels only with-i. - Keep reference alleles in the output with
-Rwhen a downstream comparison expects them. - Rescue older pileup-based workflows that predate current
bcftoolscalling conventions.
Common Patterns
# 1) Convert old pileup output to VCF
samtools pileup -c ref.fa alignments.bam | sam2vcf.pl > calls.vcf
# 2) Emit SNPs only
samtools pileup -c ref.fa alignments.bam | sam2vcf.pl -s > snps.vcf
# 3) Emit indels and provide the reference sequence explicitly
samtools pileup -c ref.fa alignments.bam | sam2vcf.pl -i -r ref.fa > indels.vcf
Recommended Workflow
- Generate pileup input from an older
samtools pileup -c-style workflow rather than modernmpileupdefaults. - Decide whether you need all calls, SNPs only, or indels only before conversion.
- Provide
-r ref.fawhenever indels may appear in the input. - Inspect the resulting header and a few representative records before mixing this legacy VCF into newer pipelines.
Guardrails
- This script expects legacy pileup text on stdin and emits VCFv3.3, not modern VCF4 output.
-r/--refseqis required when indels are present.--helpworks, but--versionis not implemented and exits as an unknown parameter.- Do not combine
-sand-i; treat them as mutually exclusive filters.