getKinship: Get genetic kinship.

Description Usage Arguments Details Value Examples

View source: R/genotypeFunctions.R

Description

Estimate kinship from standardised genotypes or read pre-computed kinship file. Standardised genotypes can be obtained via standardiseGenotypes.

Usage

1
2
3
getKinship(N, sampleID = "ID_", X = NULL, kinshipfile = NULL,
  id_samples = NULL, standardise = FALSE, sep = ",", header = TRUE,
  verbose = TRUE)

Arguments

N

Number [integer] of samples to simulate.

sampleID

Prefix [string] for naming samples (will be followed by sample number from 1 to N when constructing id_samples).

X

[NrSamples x totalNrSNPs] Matrix of (standardised) genotypes.

kinshipfile

path/to/kinshipfile [string] to be read; either X or kinshipfile must be provided.

id_samples

Vector of [NrSamples] sample IDs [string]; if not provided constructed by paste(sampleID, 1:N, sep="").

standardise

[boolean] If TRUE genotypes will be standardised before kinship estimation.

sep

Field separator [string] of kinship file.

header

[boolean], If TRUE kinship file has header information.

verbose

[boolean]; If TRUE, progress info is printed to standard out

Details

The kinship is estimated as K = XX_T, with X the standardised genotypes of the samples. When estimating the kinship from the provided genotypes, the kinship is normalised by the mean of its diagonal elements and 1e-4 added to the diagonal for numerical stability.

Value

[NrSamples x NrSamples] Matrix of kinship estimate.

Examples

1
2
3
4
5
6
7
8
geno <- simulateGenotypes(N=10, NrSNP=50)
K_fromGenotypesNormalised <- getKinship(N=10, X=geno$genotypes, 
standardise=TRUE)

kinshipfile <- system.file("extdata/kinship", 
"kinship.csv",
package = "PhenotypeSimulator")
K_fromFile <- getKinship(N=50, kinshipfile=kinshipfile)

PhenotypeSimulator documentation built on May 14, 2018, 1:04 a.m.