computeKernel {podkat} | R Documentation

## Compute Kernel Matrix

### Description

Computes kernel matrix for a given genotype matrix

### Usage

    computeKernel(Z, kernel=c("linear.podkat", "quadratic.podkat",
                  "localsim.podkat", "linear.SKAT", "quadratic.SKAT",
                  "localsim.SKAT"), weights=NULL, pos=NULL, width=1000)

### Arguments

`Z` | a matrix or an object of class `Matrix` (note that the latter also includes objects of class `GenotypeMatrix`)
`kernel` | type of kernel to use
`weights` | numeric vector with variant weights; must be as long as the number of columns of `Z`. Use `NULL` for unweighted kernels.
`pos` | numeric vector with positions of variants; must be as long as the number of columns of `Z`. This argument is mandatory for the position-dependent kernels “linear.podkat”, “quadratic.podkat”, and “localsim.podkat”; ignored for kernels “linear.SKAT”, “quadratic.SKAT”, and “localsim.SKAT”.
`width` | tolerance radius parameter for position-dependent kernels “linear.podkat”, “quadratic.podkat”, and “localsim.podkat” (see details below); must be single positive numeric value. Ignored for kernels “linear.SKAT”, “quadratic.SKAT”, and “localsim.SKAT”.

### Details

This function computes a kernel matrix for a given genotype matrix `Z` and a given kernel. It supposes that `Z` is a matrix-like object (a numeric matrix, a sparse matrix, or an object of class `GenotypeMatrix`) in which rows correspond to samples and columns correspond to variants. There are six different kernels available: “linear.podkat”, “quadratic.podkat”, “localsim.podkat”, “linear.SKAT”, “quadratic.SKAT”, and “localsim.SKAT”. All of these kernels can be used with or without weights. The weights can be specified with the `weights` argument which must be a numeric vector with as many elements as the matrix `Z` has columns. If no weighting should be used, `weights` must be set to `NULL`.

The position-dependent kernels “linear.podkat”, “quadratic.podkat”, and “localsim.podkat” require the positions of the variants in `Z`. So, if any of these three kernels is selected, the argument `pos` is mandatory and must be a numeric vector with as many elements as the matrix `Z` has columns.

If the `pos` argument is `NULL` and `Z` is a `GenotypeMatrix` object, the positions in `variantInfo(Z)` are taken. In this case, all variants need to reside on the same chromosome. If the variants in `variantInfo(Z)` are from multiple chromosomes, `computeKernel` quits with an error. As said, this only happens if `pos` is `NULL`, otherwise the `pos` argument has priority over the information stored in `variantInfo(Z)`.

For details on how the kernels compute the pairwise similarities of genotypes, see Subsection 9.2 of the package vignette.

### Value

a positive semi-definite kernel matrix with as many rows and columns as `Z` has rows

### Author(s)

Ulrich Bodenhofer bodenhofer@bioinf.jku.at

### References

http://www.bioinf.jku.at/software/podkat

Wu, M. C., Lee, S., Cai, T., Li, Y., Boehnke, M., and Lin, X. (2011) Rare-variant association testing for sequencing data with the sequence kernel association test. Am. J. Hum. Genet. 89, 82-93. DOI: 10.1016/j.ajhg.2011.05.029.

### See Also

`GenotypeMatrix`

### Examples

    ## create a toy example
    A <- matrix(rbinom(50, 2, prob=0.2), 5, 10)
    pos <- sort(sample(1:10000, ncol(A)))

    ## compute some unweighted kernels
    computeKernel(A, kernel="linear.podkat", pos=pos, width=100)
    computeKernel(A, kernel="localsim.podkat", pos=pos, width=100)
    computeKernel(A, kernel="linear.SKAT")

    ## compute some weighted kernels
    MAF <- colSums(A) / (2 * nrow(A))
    weights <- betaWeights(MAF)
    computeKernel(A, kernel="linear.podkat", pos=pos, weights=weights)
    computeKernel(A, kernel="linear.SKAT", weights=weights)
    computeKernel(A, kernel="localsim.SKAT", weights=weights)

[Package podkat version 1.22.0 Index]