vcfWrite: Utility to write VCF file

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/vcfWrite.R

Description

vcfWrite creates a VCF file from a GenotypeData object.

Usage

1
2
3
4
5
6
7
vcfWrite(genoData, vcf.file="out.vcf", sample.col="scanID",
         id.col="snpID", qual.col=NULL, filter.cols=NULL,
         info.cols=NULL, scan.exclude=NULL, snp.exclude=NULL,
         scan.order=NULL, ref.allele=NULL, block.size=1000, verbose=TRUE)

vcfCheck(genoData, vcf.file, sample.col="scanID",
         id.col="snpID", block.size=1000, verbose=TRUE)

Arguments

genoData

A GenotypeData object with scan and SNP annotation.

vcf.file

Filename for the output VCF file.

sample.col

name of the column in the scan annotation to use as sample IDs in the VCF file

id.col

name of the column in the SNP annotation to use as "ID" column in the VCF file

qual.col

name of the column in the SNP annotation to use as "QUAL" column in the VCF file

filter.cols

vector of column names in the SNP annotation to use as "FILTER" column in the VCF file. These columns should be logical vectors, with TRUE for SNPs to be filtered. Any SNPs with a value of FALSE for all filter columns will be set to "PASS".

info.cols

vector of column names in the SNP annotation to concatenate for the "INFO" column in the VCF file.

scan.exclude

vector of scanIDs to exclude from VCF file

snp.exclude

vector of snpIDs to exclude from VCF file

scan.order

vector of scanIDs to include in VCF file, in the order in which they should be written

ref.allele

vector of "A" or "B" values indicating where allele A or allele B should be the reference allele for each SNP. Default is to use allele A as the reference allele.

block.size

Number of SNPs to read from genoData at a time

verbose

logical for whether to show progress information.

Details

REF will be alleleA and ALT will be alleleB.

vcfCheck compares the genotypes (diploid only) in a VCF file to the corresponding genotypes in genoData. It stops with an error when it detects a discordant genotype. It assumes that the "ID" column of the VCF file has unique values that can be matched with a column in the SNP annotation, and that all SNPs in the VCF file are present in genoData.

Author(s)

Stephanie Gogarten

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.

See Also

snpgdsVCF2GDS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(GWASdata)
library(VariantAnnotation)
gdsfile <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
data(illuminaSnpADF, illuminaScanADF)
genoData <- GenotypeData(GdsGenotypeReader(gdsfile),
  scanAnnot=illuminaScanADF, snpAnnot=illuminaSnpADF)
vcffile <- tempfile()
vcfWrite(genoData, vcffile, id.col="rsID", info.cols="IntensityOnly")
vcf <- readVcf(vcffile, "hg18")
vcf
vcfCheck(genoData, vcffile, id.col="rsID")
close(genoData)
unlink(vcffile)

GWASTools documentation built on May 31, 2017, 2:56 p.m.