GetRelMatrix: Estimate relationship matrix based on pedigree or genomic...

Description Usage Arguments Details Value Author(s) Examples

View source: R/GetRelMatrix.R

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

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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)

GreenwoodLab/RVPedigree documentation built on May 6, 2019, 6:33 p.m.