Convert a VCF with FORMAT/AD into pileup-style SNP calls
Source:R/vcf_to_snp_calls.R
vcf_to_snp_calls.RdReverse of snp_calls_to_vcf(): emits one row per (specimen, SNP, observed allele) where allelic depth is at least min_reads. Only simple SNP alleles
(single-base REF and ALT in {A,C,G,T}) are kept. pos is 0-based. strand
is always +. target_name is included only when INFO carries TARGET=.
Usage
vcf_to_snp_calls(
vcf,
snp_calls_output = NULL,
biallelic = FALSE,
min_reads = 1L,
overwrite = FALSE,
verbose = FALSE
)Arguments
- vcf
Path to a VCF with
FORMAT/AD. See Inputs.- snp_calls_output
Optional output SNP calls TSV path.
- biallelic
If
TRUE, keep only sites with exactly one simple ALT.- min_reads
Minimum AD reads for an allele to be emitted.
- overwrite
If
FALSE(default), refuse to overwritesnp_calls_output.- verbose
If
TRUE, print a summary message when finished.
Details
Outputs
snp_calls_output(optional): SNP calls TSV; gzip-compressed if it ends in.gz. IfNULL, results are returned without writing.
Running
vcf_to_snp_calls(
vcf = "calls.vcf.gz",
snp_calls_output = "snp_calls.tsv"
)