Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Details

The .bed, .fam and .bim files follow the PLINK specifications (http://zzz.bwh.harvard.edu/plink/binary.shtml).

If a .rds file exists (created by write.bed.matrix), the .fam and .bim files will be ignored. To ignore an existing .rds file, set rds = NULL.

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").

If the option gaston.auto.set.stats is set to TRUE (the default), the function set.stats will be called before returning the bed.matrix, unless a .rds file is present: in this case, the bed.matrix obtained is identical to the bed.matrix saved with write.bed.matrix.

Value

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

Examples

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

gaston

Genetic Data Handling (QC, GRM, LD, PCA) & Linear Mixed Models

v1.5.7
GPL-3
Authors
Hervé Perdry [cre, aut, cph], Claire Dandine-Roulland [aut, cph], Deepak Bandyopadhyay [cph] (C++ gzstream class), Lutz Kettner [cph] (C++ gzstream class)
Initial release
2020-09-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.