Learn R Programming

GWASTools (version 1.18.0)

convertVcfGds: Conversion from VCF to GDS

Description

Extract SNP data from a VCF file. This function is deprecated, use snpgdsVCF2GDS instead.

Usage

convertVcfGds(vcf.filename, gds.filename, nblock=1024, compress="ZIP_RA", verbose=TRUE)

Arguments

vcf.filename
the file name of VCF format
gds.filename
the output gds file
nblock
the buffer lines
compress
The compression level for variables in a GDS file (see add.gdsn for options.
verbose
whether to show progress information

Details

convertVcfGds extracts bi-allelic SNP genotypes from a VCF file and stores them in a GDS file. All VCF rows which do not contain polymorphic, bi-allelic SNPs are ignored. Unique integer IDs are generated for all samples and SNPs. Sample name, SNP ID, reference and alternate alleles, chromosome, and position are stored in the GDS file as well. GDS -- Genomic Data Structures, the extended file name used for storing genetic data, and the file format used in the gdsfmt package.

VCF -- The Variant Call Format (VCF), which is a generic format for storing DNA polymorphism data such as SNPs, insertions, deletions and structural variants, together with rich annotations.

References

The variant call format and VCFtools. Danecek P, Auton A, Abecasis G, Albers CA, Banks E, DePristo MA, Handsaker RE, Lunter G, Marth GT, Sherry ST, McVean G, Durbin R; 1000 Genomes Project Analysis Group. Bioinformatics. 2011 Aug 1;27(15):2156-8. Epub 2011 Jun 7.

http://corearray.sourceforge.net/

See Also

GdsGenotypeReader

Examples

Run this code
# The VCF file
vcf.file <- system.file("extdata", "sequence.vcf", package="SNPRelate")
readLines(vcf.file)

gds.file <- tempfile() 
convertVcfGds(vcf.file, gds.file)

# open GDS file
(gds <- GdsGenotypeReader(gds.file))

getScanID(gds)
getSnpID(gds)
getChromosome(gds)
getPosition(gds)
getVariable(gds, "sample.name")
getVariable(gds, "snp.rs.id")
getVariable(gds, "snp.allele")
getGenotype(gds)

# close the genotype file
close(gds)
unlink(gds.file)

Run the code above in your browser using DataLab