Learn R Programming

plinkFile (version 0.2.1)

readBSM: 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)

Value

symmetric matrix loaded, with sample ID as both row and column names.

Arguments

pfx

prefix of data files pfx.id and pfx.bin

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 pfx.id

bin

use bin file instead of the default pfx.bin

Details

The ".bin" is a binary file storing the matrix entries, which can be

SQR

the N x N 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.

Examples

Run this code
pfx <- file.path(system.file("extdata", package="plinkFile"), "m20.rel")
(readBSM(pfx, fid=":"))

Run the code above in your browser using DataLab