BGData-class {BGData}R Documentation

Container for Phenotype and Genotype Data


The BGData class is a container for genotypes, sample information, and variant information. The class is inspired by the .bed/.fam/.bim (binary) and .ped/.fam/.map (text) phenotype/genotype file formats of PLINK. It is used by several functions of this package such as GWAS for performing a Genome Wide Association Study or getG for calculating a genomic relationship matrix.


There are several ways to create an instance of this class:

A .ped file can be recoded to a .raw file in PLINK using plink --file myfile --recodeA, or converted to a .bed file using plink --file myfile --make-bed. Conversely, a .bed file can be transformed back to a .ped file using plink --bfile myfile --recode or to a .raw file using plink --bfile myfile --recodeA without losing information.


In the following code snippets, x is a BGData object.

geno(x), geno(x) <- value:

Get or set genotypes.

pheno(x), pheno(x) <- value:

Get or set sample information.

map(x), map(x) <- value:

Get or set variant information.

See Also

BGData, as.BGData, load.BGData, readRAW to create BGData objects.

LinkedMatrix-class and BEDMatrix-class for more information on the above mentioned classes.


X <- matrix(data = rnorm(100), nrow = 10, ncol = 10)
Y <- data.frame(y = runif(10))
MAP <- data.frame(means = colMeans(X), freqNA = colMeans(
DATA <- BGData(geno = X, pheno = Y, map = MAP)


[Package BGData version 2.4.0 Index]