vcf2sm {GGtools} | R Documentation

## 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

### 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.

### Value

an instance of `SnpMatrix-class`

### Author(s)

VJ Carey <stvjc@channing.harvard.edu>

### References

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

### Examples

    # 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)

[Package GGtools version 5.18.0 Index]