read.bed {KRIS} | R Documentation |
Require the complete set of 3 files in the binary PLINK format. It includes BED file, BIM file and BAM file. For more information about the binary PLINK format, please check in the manual of PLINK.
read.bed(bed, bim, fam, only.snp = FALSE)
bed |
A path of BED file |
bim |
A path of BIM file |
fam |
A path of FAM file |
only.snp |
If TRUE, the function to read only SNP matrix, otherwise all files are loaded. The default value is FALSE. |
For more details about the binary PLINK format, please check http://zzz.bwh.harvard.edu/plink/binary.shtml
The list containing the matrices of $snp
, $snp.info
,
and $ind.info
.
$snp
is a SNP matrix from BED file.
$snp.info
is a data.frame of SNP information from BIM file.
$ind.info
is a data.frame of individual information from FAM file.
#Use the example files embedded in the package.
bed <- system.file("extdata", "example_SNP.bed", package="KRIS")
bim <- system.file("extdata", "example_SNP.bim", package="KRIS")
fam <- system.file("extdata", "example_SNP.fam", package="KRIS")
snp <- read.bed(bed, bim, fam )
#Check the objects inside 'snp'
ls(snp)
#Preview $snp
print(snp$snp[1:10, 1:10])
#Preview $snp.info
head(snp$snp.info)
#Preview $ind.info
head(snp$ind.info)