Learn R Programming

plinkFile (version 0.1.0)

readBED: Read BED file

Description

Read a BED file into a R matrix. This is meant for in-of-memory process of moderate to small sized genotype.

Usage

readBED(pfx, row = NULL, col = NULL, quiet = TRUE)

Value

genotype matrix with row individuals and column variants.

Arguments

pfx

prefix of PLINK file set, or the fullname of a BED file.

row

the row names: 1 = use individual ID, 2 = family and individual ID, def = NULL.

col

the column names: 1 = use variant ID (i.e., rsID), 2 = CHR:POS, 3 = CHR:POS_A1_A2

quiet

suppress screen printing? (def=TRUE)

Details

To scan a huge BED one varant at time without reading it into the memoty, see scanBED instead.

A BED (binary biallelic genotype table) is comprised of three files (usually) sharing identical prefix:

  • pfx.fam: table of N typed individuals

  • pfx.bim: table of P typed genomic variants (i.e., SNPs);

  • pfx.bed: genotype matrix of N rows and P columns stored in condensed binary format.

The three files are commonly referred by their common prefix, e.g.:

chrX.bed, chrX.fam, and chrX.bim, are jointly specified by "chrX".

See Also

readBED

Examples

Run this code
bed <- system.file("extdata", 'm20.bed', package="plinkFile")
pfx <- sub("[.]bed$", "", bed)
bed <- readBED(pfx, quiet=FALSE)

Run the code above in your browser using DataLab