| BGData-class {BGData} | R Documentation |
Container for Phenotype and Genotype Data
Description
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.
Details
There are several ways to create an instance of this class:
from arbitrary phenotype/genotype data using the
BGDataconstructor function.from a .bed file using
as.BGDataandBEDMatrix.from a previously saved
BGDataobject usingload.BGData.from multiple files (even a mixture of different file types) using
LinkedMatrix.from a .raw file (or a .ped-like file) using
readRAW,readRAW_matrix, orreadRAW_big.matrix.
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.
Accessors
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.
Examples
X <- matrix(data = rnorm(100), nrow = 10, ncol = 10)
Y <- data.frame(y = runif(10))
MAP <- data.frame(means = colMeans(X), freqNA = colMeans(is.na(X)))
DATA <- BGData(geno = X, pheno = Y, map = MAP)
dim(geno(DATA))
head(pheno(DATA))
head(map(DATA))