read.bed.matrix: Read a 'bed.matrix'

View source: R/bm_files.r

read.bed.matrixR Documentation

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

A bed.matrix

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

write.bed.matrix, set.stats

Examples

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

gaston documentation built on May 29, 2024, 7:33 a.m.