gData | R Documentation |
createGData
creates an object of S3 class gData with genotypic and
phenotypic data for usage in further analysis. All input to the function is
optional, however at least one input should be provided. It is possible to
provide an existing gData
object as additional input in which case
data is added to this object. Existing data will be overwritten with a
warning.
createGData( gData = NULL, geno = NULL, map = NULL, kin = NULL, pheno = NULL, covar = NULL )
gData |
An optional gData object to be modified. If |
geno |
A matrix or data.frame with genotypes in the rows and markers in
the columns. A matrix from the |
map |
A data.frame with columns |
kin |
A kinship matrix or list of kinship matrices with genotype in
rows and colums. These matrices can be from the |
pheno |
A data.frame or a list of data.frames with phenotypic data,
with genotypes in the first column |
covar |
A data.frame with extra covariates per genotype. Genotypes should be in the rows. |
An object of class gData
with the following components:
|
a data.frame containing map data. Map is sorted by chromosome and position. |
|
a matrix containing marker information. |
|
a list of data.frames containing phenotypic data. |
|
a kinship matrix. |
|
a data.frame with extra covariates. |
Bart-Jan van Rossum
summary.gData
set.seed(1234) ## Create genotypic data. geno <- matrix(sample(x = c(0, 1, 2), size = 15, replace = TRUE), nrow = 3) dimnames(geno) <- list(paste0("G", 1:3), paste0("M", 1:5)) ## Construct map. map <- data.frame(chr = c(1, 1, 2, 2, 2), pos = 1:5, row.names = paste0("M", 1:5)) ## Compute kinship matrix. kin <- kinship(X = geno, method = "IBS") ## Create phenotypic data. pheno <- data.frame(paste0("G", 1:3), matrix(rnorm(n = 12, mean = 50, sd = 5), nrow = 3), stringsAsFactors = FALSE) dimnames(pheno) = list(paste0("G", 1:3), c("genotype", paste0("T", 1:4))) ## Combine all data in gData object. gData <- createGData(geno = geno, map = map, kin = kin, pheno = pheno) summary(gData) ## Construct covariate. covar <- data.frame(C1 = c("a", "a", "b"), row.names = paste0("G", 1:3)) ## Compute alternative kinship matrix. kin2 <- kinship(X = geno, method = "astle") ## Add covariates to previously created gData object and overwrite ## current kinship matrix by newly computed one. gData2 <- createGData(gData = gData, kin = kin2, covar = covar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.