Learn R Programming

GGtools (version 5.8.0)

vcf2sm: generate a SnpMatrix instance on the basis of a VCF (4.0) file

Description

generate a SnpMatrix instance on the basis of a VCF (4.0) file.

Usage

vcf2sm(tbxfi, ..., gr, nmetacol)

Arguments

tbxfi
instance of TabixFile-class
...
not used
gr
instance of GRanges-class
nmetacol
numeric: tells number of columns used in each record as locus-level metadata

Value

an instance of SnpMatrix-class

Details

This function is relevant only for diallelic SNP. If any base call is denoted `.', the associated genotype is set to missing (raw 0), even if the nonmissing call is ALT, implying at least one ALT.

References

http://www.1000genomes.org/wiki/doku.php?id=1000_genomes:analysis:vcf4.0

Examples

Run this code
# SRC: ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/pilot_data/release/2010_07/exon/CEU.exon.2010_03.genotypes.vcf.gz
 vref = system.file("vcf/CEU.exon.2010_09.genotypes.vcf.gz", package="GGtools")
 gg = GenomicRanges::GRanges(seqnames="1", IRanges::IRanges(10e6,20e6))
 vcf2sm(Rsamtools::TabixFile(vref), gr=gg, nmetacol=9L)

Run the code above in your browser using DataLab