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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/read.write.vcf.r

Description

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

Usage

1
2
3
4
5
6
7
read.vcf2matrix(
  file,
  FORMAT = "GT",
  coding = c("allele", "ref"),
  IDinRow = TRUE,
  cores = 1
)

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 alternative allele.

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.

cores

numeric. Specifies the number of cores for parallel computing.

Value

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

Author(s)

Hans-Juergen Auinger

See Also

write.vcf, read.vcf2list

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
library(synbreedData)
data(maize)
maize$info$map.unit <- "kb"
maize <- codeGeno(maize)
write.vcf(maize, "maize.vcf")
geno <- read.vcf2matrix("maize.vcf")

## End(Not run)

synbreed documentation built on March 12, 2021, 3:01 a.m.