Read and files in the *.vcf structured text format, as well as the compressed *.vcf.gz format. Write objects of class vcfR to *.vcf.gz.
read.vcfR(file, limit = 1e+07, nrows = -1, skip = 0, cols = NULL,
verbose = TRUE)write.vcf(x, file = "", mask = FALSE, APPEND = FALSE)
A filename for a variant call format (vcf) file.
amount of memory (in bytes) not to exceed when reading in a file.
integer specifying the maximum number of rows (variants) to read in.
integer specifying the number of rows (variants) to skip before beginning to read data.
vector of column numbers to extract from file.
report verbose progress.
An object of class vcfR or chromR.
logical vector indicating rows to use.
logical indicating whether to append to existing vcf file or write a new file.
read.vcfR returns an object of class vcfR-class
.
See the vignette: vignette('vcf_data')
The function read.vcfR reads in files in *.vcf (text) and *.vcf.gz (gzipped text) format and returns an object of class vcfR. The parameter 'limit' is an attempt to keep the user from trying to read in a file which contains more data than there is memory to hold. Based on the dimensions of the data matrix, an estimate of how much memory needed is made. If this estimate exceeds the value of 'limit' an error is thrown and execution stops. The user may increase this limit to any value, but is encourages to compare that value to the amout of available physical memory.
The function write.vcf takes an object of either class vcfR or chromR and writes the vcf data to a vcf.gz file (gzipped text). If the parameter 'mask' is set to FALSE, the entire object is written to file. If the parameter 'mask' is set to TRUE and the object is of class chromR (which has a mask slot), this mask is used to subset the data. If an index is supplied as 'mask', then this index is used, and recycled as necessary, to subset the data.
CRAN: pegas::read.vcf, PopGenome::readVCF, data.table::fread
Bioconductor: VariantAnnotation::readVcf
Use: browseVignettes('vcfR') to find examples.