vcf2txt: Covert VCF File to A Data Frame

Description Usage Arguments Details Value Author(s) References Examples

View source: R/vcf2txt.R

Description

It parses a VCF file and extract necessary information for CNV analysis.

Usage

1
vcf2txt(vcf.file, normal.col = 10, tumor.col = 11, MQ.cutoff = 30)

Arguments

vcf.file

vcf file name.

normal.col

the number of the column in which the genotype and read depth information of normal tissue are located in the vcf file.

tumor.col

the number of the column in which the genotype and read depth information of tumor tissue are located in the vcf file.

MQ.cutoff

the minimum criterion of mapping quality.

Details

Note that the first 9 columns in vcf file are mandatory, followed by the information for called variant starting from the 10th column.

Value

A data frame of detailed information about each variant, including chrosome position, reference and alternative alleles, genotype and read depth carrying reference and alternative alleles for normal and tumor respectively.

Author(s)

Zhongyang Zhang <zhongyang.zhang@mssm.edu>

References

Danecek, P., Auton, A., Abecasis, G., Albers, C. A., Banks, E., DePristo, M. A., Handsaker, R. E., Lunter, G., Marth, G. T., Sherry, S. T., et al. (2011) The variant call format and VCFtools. Bioinformatics, 27:2156–2158.

http://www.1000genomes.org/node/101

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
## an example VCF file from WES
## download WES_example.vcf.gz
url <- "https://zhangz05.u.hpc.mssm.edu/saasCNV/data/WES_example.vcf.gz"
tryCatch({download.file(url=url, destfile="WES_example.vcf.gz")
         }, error = function(e) {
          download.file(url=url, destfile="WES_example.vcf.gz", method="curl")
         })
## If download.file fails to download the data, please manually download it from the url.

## convert VCf file to a data frame
vcf_table <- vcf2txt(vcf.file="WES_example.vcf.gz", normal.col=9+1, tumor.col=9+2)

## see how vcf_table looks like
## download vcf_table.txt.gz
url <- "https://zhangz05.u.hpc.mssm.edu/saasCNV/data/vcf_table.txt.gz"
tryCatch({download.file(url=url, destfile="vcf_table.txt.gz")
         }, error = function(e) {
          download.file(url=url, destfile="vcf_table.txt.gz", method="curl")
         })
## If download.file fails to download the data, please manually download it from the url.

vcf_table <- read.delim(file="vcf_table.txt.gz", as.is=TRUE)
head(vcf_table)

## End(Not run)

saasCNV documentation built on May 1, 2019, 7:49 p.m.