readBSM {plinkFile} | R Documentation |
Read Binary Symmetric Matrix (BSM)
Description
Read BSM represented by a pair of files suffixed by ".bin" and ".id", usually produced by PLINK and GCTA.
Usage
readBSM(pfx, dgv = 1, fid = NULL, id = NULL, bin = NULL)
Arguments
pfx |
prefix of data files |
dgv |
diagonal value for matrix without a diagonal (def=1.0) |
fid |
separator between FID and IID (def=NULL, use IID only) |
id |
use id file instead of the default |
bin |
use bin file instead of the default |
Details
The ".bin" is a binary file storing the matrix entries, which can be
- SQR
the
N
xN
symmetric matrix in full- LWD
the lower triangle with diagonal
- LND
the lower triangle without diagonal
, saved as either single or double precision.
The ".id" is a text file of N
family ID (FID) and individual ID (IID) in
two columns. By default, IID is used as matix row and column names.
PLINK option --make-red bin
, --distance bin
, and GCTA option
--make-grm
all creats binary symmetric matrices, widely used in linear
mixed model or kernel based models for genetics.
Value
symmetric matrix loaded, with sample ID as both row and column names.
Examples
pfx <- file.path(system.file("extdata", package="plinkFile"), "m20.rel")
(readBSM(pfx, fid=":"))