Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/computeKernel.R
Computes kernel matrix for a given genotype matrix
1 2 3 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.