Learn R Programming

synbreed (version 0.11-2)

read.vcf2matrix: Read data of a vcf-file to a matrix

Description

To easily read genomic data in vcf-Format to a matrix. Function codeGeno uses read.vcf2matrix with imputing by beagle.

Usage

read.vcf2matrix(file, FORMAT = "GT", coding = c("allele", "ref"), IDinRow = TRUE)

Arguments

file
character. The name of the file which the data are to be read from.
FORMAT
character. The default is "GT". If there are more formats in your vcf-file you can decide which one you like to have in your output matrix.
coding
This option has only an effect with FORMAT="GT". allele gives you back the alles as defined as REF and ALT in your vcf-file. ref gives you back "0" for the reference allele and "1" for the
IDinRow
logical. Default is TRUE, this means the genotypes are in the rows and the markers in the column. For FALSE it is the other way round.

Value

  • A matrix (matrix) containing a representation of the data in the file.

See Also

write.vcf

Examples

Run this code
library(synbreedData)
data(maize)
maize$info$map.unit <- "kb"
maize <- codeGeno(maize)
write.vcf(maize, "maize.vcf")
geno <- read.vcf2matrix("maize.vcf")

Run the code above in your browser using DataLab