Learn R Programming

gaston (version 1.4.9)

read.bed.matrix: Read a bed.matrix

Description

Create a bed.matrix from a .bed file, and either a .rds file or a .bim and a .fam file.

Usage

read.bed.matrix(basename, bed = paste(basename, ".bed", sep=""), fam = paste(basename, ".fam", sep=""), bim = paste(basename, ".bim", sep=""), rds = paste(basename, ".rds", sep=""), verbose = getOption("gaston.verbose",TRUE))

Arguments

basename
Basename of all files
bed
Name of the .bed file
fam
Name of the .fam file
bim
Name of the .bim file
rds
Name of the .rds file (ignored if NULL)
verbose
If TRUE, display information on the function actions

Value

bed.matrix

Details

If the .rds file exists, the .fam and .bim files will be ignored. To ignore an existing .rds file, set rds = NULL.

The .bed, .fam and .bim files follow the PLINK specifications (http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#bed).

If the .bed file does not exist, and basename ends by ".bed", the function will try to generate a new basename by trimming the extension out. This allows to write read.bed.matrix("file.bed") instead of read.bed.matrix("file").

See Also

write.bed.matrix

Examples

Run this code
# Read RDS and bed files
x <- read.bed.matrix( system.file("extdata", "LCT.bed", package="gaston") )
x

Run the code above in your browser using DataLab