Last data update: 2014.03.03

R: Estimate relationship matrix based on pedigree or genomic...
GetRelMatrixR Documentation

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

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.

Value

matrix object which contains the estimated relationship matrix

Author(s)

Sodbo Sharapov

Examples

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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RVPedigree)
Loading required package: foreach
Loading required package: doParallel
Loading required package: iterators
Loading required package: parallel
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RVPedigree/GetRelMatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GetRelMatrix
> ### Title: Estimate relationship matrix based on pedigree or genomic data
> ### Aliases: GetRelMatrix
> 
> ### ** Examples
> 
> system.file("extdata", "2012.csv", package = "testdat")
[1] ""
> ## Not run: 
> ##D pedRel <- GetRelMatrix(datatype="pedigree",
> ##D                        plinkbasefile=system.file("extdata",
> ##D                                                  "data",
> ##D                                          package="RVPedigree"),
> ##D                        transpose=FALSE)
> ##D pedRel <- GetRelMatrix(datatype="pedigree",
> ##D                        plinkbasefile=system.file("extdata",
> ##D                                                  "dataT",
> ##D                                          package="RVPedigree"),
> ##D                        transpose=TRUE)
> ##D pedRel <- GetRelMatrix(datatype="pedigree",
> ##D                        plinkbasefile=system.file("extdata",
> ##D                                                  "dataB",
> ##D                                          package="RVPedigree"),
> ##D                        is.binary=TRUE)
> ##D pedRel <- GetRelMatrix(datatype="pedigree",
> ##D                        plinkbasefile=system.file("extdata",
> ##D                                                  "OneFamilyExample",
> ##D                                          package="RVPedigree"),
> ##D                        transpose=FALSE, header=TRUE)
> ##D pedRel <- GetRelMatrix(datatype="pedigree",
> ##D                        plinkbasefile=system.file("extdata",
> ##D                                                  "TwoFamilyExample",
> ##D                                          package="RVPedigree"),
> ##D                        transpose=FALSE, header=TRUE)
> ##D 
> ##D load(system.file("extdata", "gwaa.data.RData")
> ##D genRel <- GetRelMatrix(datatype="genomic", gwaa.data=data1, weight="no")
> ##D genRel <- GetRelMatrix(datatype="genomic", gwaa.data=data1, weight="freq")
> ##D genRelError <- GetRelMatrix(datatype="genomic", gwaa.data=pedRel, weight="freq")
> ##D 
> ##D genPlinkRel <- GetRelMatrix(data="genomic",
> ##D                             path2Plink="plink_1.90",
> ##D                             system.file("extdata",
> ##D                                         "data",
> ##D                                          package="RVPedigree"),
> ##D genPlinkRel[1:10, 1:10]
> ##D 
> ##D genPlinkRel <- GetRelMatrix(data="genomic",
> ##D                             path2Plink="plink_1.90",
> ##D                             system.file("extdata",
> ##D                                         "dataT",
> ##D                                          package="RVPedigree"),
> ##D                             transpose=TRUE)
> ##D genPlinkRel[1:10, 1:10]
> ##D 
> ##D genPlinkRel <- GetRelMatrix(data="genomic",
> ##D                             path2Plink="plink_1.90",
> ##D                             system.file("extdata",
> ##D                                         "dataB",
> ##D                                          package="RVPedigree"),
> ##D                             is.binary=TRUE)
> ##D genPlinkRel[1:10, 1:10]
> ##D 
> ##D # GetRelMatrix(file="OneFamilyExample.ped", datatype="genomic")
> ##D # GetRelMatrix(file="OneFamilyExample.ped", datatype="pedasdfa")
> ##D # GetRelMatrix(file="OneFamilyExaample", datatype="pedigree")
> ## End(Not run)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>