Skip to contents

VCFArrow 0.9.0

  • Initial CRAN submission.

Reading and storage

  • read_vcf() reads plain or gzip-compressed VCF files (including large DiscoSnp-RAD output) into a VCFArrow S4 object. Variant information is kept in memory; genotypes are written to disk as an ‘Apache Arrow’ dataset in chunks and read lazily, so datasets larger than memory can be processed.
  • set_vcf_groups() assigns samples to groups (populations); vcf_copy() makes an independent copy; vcf_gc() deletes the on-disk data of objects that are no longer referenced.
  • vcf_memory_estimate() estimates the memory an export needs, and vcf_suggest_chunk_size() suggests a chunk size for read_vcf() for the available memory.

Filtering, subsetting and merging

Statistics and plots

  • vcf_stats() computes per-sample statistics (heterozygosity, missing data, depth) and, optionally, Watterson’s theta and nucleotide diversity per group (vcf_theta()), accumulated chunk by chunk with little memory.
  • assess_vcf_missing_data() writes a table and plots of missing data per sample, and assess_vcf_coverage() plots of read depth per sample (PDF, PNG and SVG).

Writing and conversion

Performance

  • vcf_set_workers() runs the per-chunk work of reading, filtering, statistics, merging and exporting on background R processes. Results do not depend on the number of workers.
  • Performance-critical steps (VCF parsing, per-sample counts, theta and pi, writers of the exported formats) are implemented in C++.

Dependencies

  • ‘adegenet’ (for vcf2genlight()) and ‘svglite’ (for SVG plots) are suggested rather than imported; without ‘svglite’, SVG plots are written with R’s Cairo device.