read.vcf: Create a 'bed.matrix' from VCF files

View source: R/bm_vcf.r

read.vcfR Documentation

Create a bed.matrix from VCF files

Description

Create a bed.matrix from a .vcf file.

Usage

 read.vcf(file, max.snps, get.info = FALSE, convert.chr = TRUE, 
                 verbose = getOption("gaston.verbose",TRUE)) 

Arguments

file

The name of the VCF file to read

max.snps

The maximal number of SNPs to read

get.info

If TRUE, the INFO field from the VCF file will integrated in @ped$info

convert.chr

If TRUE, chromosomes ids "X", "Y" and "MT" will be converted in their numeric equivalents

verbose

If TRUE, display information on the function progress

Details

The vcf format is described in https://github.com/samtools/hts-specs

In addition to the usual data in the slot @snps, the bed.matrices produced by read.vcf have @snps$quality and @snps$filter columns corresponding to the QUAL and FILTER fields in the VCF file. If get.info = TRUE, an additionnal column @snps$info is added, corresponding to the INFO field.

The information about individuals in VCF files is incomplete: in the slot @ped, the columns @ped$famid and @ped$id will both contain the sample id; sex and phenotypes will be set to unknown.

The function currently assumes that the GT field is the first field in the genotypes format. If it is not the case, the variants are discarded.

Value

A bed.matrix

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

read.bed.matrix

Examples

## Read vcf file (from file name)
filepath <-system.file("extdata", "LCT.vcf.gz", package="gaston")
x1 <- read.vcf( filepath )
x1

gaston documentation built on May 29, 2024, 7:33 a.m.