Learn R Programming

RVPedigree (version 0.0.3)

GetRelMatrix: Estimate relationship matrix based on pedigree or genomic data

Description

Estimate relationship matrix based on pedigree or genomic data. This function can use either Plink files as input (for both pedigree-based and genomic relationship matrix calculation), or genetic data in GenABEL format (for genomic relationships).

Usage

GetRelMatrix(datatype = NULL, plinkbasefile = NULL, is.binary = FALSE, transpose = FALSE, header = FALSE, path2Plink = "plink", weight = "freq", gwaa.data = NULL, pedigreefile = NULL)

Arguments

datatype
character, "pedigree" or "genomic". Estimate the relationship matrix using either pedigree information or genotype data
plinkbasefile
character, path to files in plink format. E.g. if you have files test.ped and test.map, plinkbasefile should be test. More details are also given in the vignette.
is.binary
logical, indicate whether the plink files are in binary format (.bed/.bim/.fam)
transpose
logical, indicate whether the plink text files are transposed or not (.tped and .tfam files)
header
logical, indicate whether the input text files have header or not
path2Plink
character, path to the binary (executable file) of plink_1.90 or later (the Plink_1.90 binary is used for efficient computation of the relationship matrix). More details are also given in the vignette.
weight
character, either "no" or "freq". We suggest to use weight="freq", which weighs by allelic frequency assuming HWE. See help for the ibs() function of the GenABEL package
gwaa.data
object, name of object gwaa.data-class, which is GenABEL genotype/phenotype data format
pedigreefile
reserved for future development

Value

matrix object which contains the estimated relationship matrix

Details

Note that, with respect to the input parameters it is important to distinguish the two options of datatype. If datatype is equal to "pedigree" the user should specify the options plinkbasefile, is.binary, transpose, header and path2Plink. In that case, the kinship will be estimated based on the pedigree data in the Plink files. If, however, datatype is equal to "genomic", there are two options: either one uses the parameter gwaa.data to tell this function to compute the genomics relationship matrix from a previously stored GenABEL data object. Or, if gwaa.data is empty, the Plink-related parameters have to be specified and the genomics relationship matrix will be computed based on the genetic data in the Plink file.

Examples

Run this code
system.file("extdata", "2012.csv", package = "testdat")
## Not run: 
# pedRel <- GetRelMatrix(datatype="pedigree",
#                        plinkbasefile=system.file("extdata",
#                                                  "data",
#                                          package="RVPedigree"),
#                        transpose=FALSE)
# pedRel <- GetRelMatrix(datatype="pedigree",
#                        plinkbasefile=system.file("extdata",
#                                                  "dataT",
#                                          package="RVPedigree"),
#                        transpose=TRUE)
# pedRel <- GetRelMatrix(datatype="pedigree",
#                        plinkbasefile=system.file("extdata",
#                                                  "dataB",
#                                          package="RVPedigree"),
#                        is.binary=TRUE)
# pedRel <- GetRelMatrix(datatype="pedigree",
#                        plinkbasefile=system.file("extdata",
#                                                  "OneFamilyExample",
#                                          package="RVPedigree"),
#                        transpose=FALSE, header=TRUE)
# pedRel <- GetRelMatrix(datatype="pedigree",
#                        plinkbasefile=system.file("extdata",
#                                                  "TwoFamilyExample",
#                                          package="RVPedigree"),
#                        transpose=FALSE, header=TRUE)
# 
# load(system.file("extdata", "gwaa.data.RData")
# genRel <- GetRelMatrix(datatype="genomic", gwaa.data=data1, weight="no")
# genRel <- GetRelMatrix(datatype="genomic", gwaa.data=data1, weight="freq")
# genRelError <- GetRelMatrix(datatype="genomic", gwaa.data=pedRel, weight="freq")
# 
# genPlinkRel <- GetRelMatrix(data="genomic",
#                             path2Plink="plink_1.90",
#                             system.file("extdata",
#                                         "data",
#                                          package="RVPedigree"),
# genPlinkRel[1:10, 1:10]
# 
# genPlinkRel <- GetRelMatrix(data="genomic",
#                             path2Plink="plink_1.90",
#                             system.file("extdata",
#                                         "dataT",
#                                          package="RVPedigree"),
#                             transpose=TRUE)
# genPlinkRel[1:10, 1:10]
# 
# genPlinkRel <- GetRelMatrix(data="genomic",
#                             path2Plink="plink_1.90",
#                             system.file("extdata",
#                                         "dataB",
#                                          package="RVPedigree"),
#                             is.binary=TRUE)
# genPlinkRel[1:10, 1:10]
# 
# # GetRelMatrix(file="OneFamilyExample.ped", datatype="genomic")
# # GetRelMatrix(file="OneFamilyExample.ped", datatype="pedasdfa")
# # GetRelMatrix(file="OneFamilyExaample", datatype="pedigree")
# ## End(Not run)

Run the code above in your browser using DataLab