View source: R/computeKernel.R

computeKernel | R Documentation |

Computes kernel matrix for a given genotype matrix

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

`Z` |
a matrix or an object of class |

`kernel` |
type of kernel to use |

`weights` |
numeric vector with variant weights;
must be as long as the number of columns of |

`pos` |
numeric vector with positions of variants;
must be as long as the number of columns of |

`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”. |

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.

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

has rows

Ulrich Bodenhofer bodenhofer@bioinf.jku.at

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.

`GenotypeMatrix`

## 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)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.