readBED | R Documentation |
Read a PLINK BED file into a R matrix.
readBED(pfx, iid = 1, vid = 1, vfr = NULL, vto = NULL, quiet = TRUE)
pfx |
prefix of PLINK file set, or the fullname of a BED file. |
iid |
option to read |
vid |
option to read |
vfr |
variant-wise, from where to read? (number/proportion, def=1) |
vto |
varinat-wise, to where then stop? (number/proportion, def=P) |
quiet |
suppress screen printing? (def=TRUE) |
This is meant for genotype that can fit into system memory; the size of R
matrix is 16 times the BED file. To traverse a huge BED several varants at
time without loading it entirely into the memoty, see scanBED()
and
loopBED()
.
A PLINK1 binary fileset has three files,
pfx.fam
:text table of N
individuals.
pfx.bim
:text table of P
genomic variants (i.e., SNPs).
pfx.bed
:N
x P
genotype matrix in condensed binary format.
The three files comprising a genotype data are typically referred by their
common prefix, for example, the X chromosome genotype represented by
chrX.bed
, chrX.fam
, and chrX.bim
are jointly refered by chrX
.
genotype matrix with N
row individuals and P
column variants.
readBED
## read an entire small data
bed <- system.file("extdata", 'm20.bed', package="plinkFile")
gmx <- readBED(bed, quiet=FALSE)
## read part of a large data
bed <- system.file("extdata", '000.bed', package="plinkFile")
U <- readBED(bed, vfr=01, vto=10, quiet=FALSE)
V <- readBED(bed, vfr=11, vto=20, quiet=FALSE)
W <- cbind(U, V)
X <- readBED(bed, vfr=01, vto=20, quiet=FALSE)
all.equal(W, X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.