Learn R Programming

macat (version 1.46.0)

kernelize: Smooth expression values or scores

Description

'kernelize' uses a kernel to smooth the data given in geneLocations by computing a weighted sum of the values vector. The weights for each position are given in the kernelweights matrix. A kernelweights matrix can be obtained by using the kernelmatrix function.

Usage

getsteps(geneLocations, step.width) kernelmatrix(steps, geneLocations, kernel, kernelparams) kernelize(values, kernelweights)

Arguments

geneLocations
a list of gene locations (length n)
step.width
the width of steps in basepairs
steps
a list of locations where the kernelization shall be computed
kernel
kernel function one of rbf, kNN or basePairDistance (or your own)
kernelparams
a list of named parameters for the kernel (default is fitted to the data)
values
vector of length n or matrix (m x n) of values that are to be smoothed
kernelweights
a matrix of (n x steps) where n is the length of the values vector and steps is the number of points where you wish to interpolate

Value

getsteps
a list of locations starting at min(genLocations) going to max(geneLocations) with steps of size step.width
kernelmatrix
a matrix of (n x steps) containing the kernel weights for each location in steps
kernelize
a vector of length steps or a matrix (m x steps) containing the smoothed values

See Also

compute.sliding, evalScoring

Examples

Run this code
  data(stjd)
  genes = seq(100)
  geneLocations = abs(stjd$geneLocation[genes])
  geneExpression = stjd$expr[genes,]
  step.width = 100000
  steps = getsteps(geneLocations, step.width)
  weights = kernelmatrix(steps, geneLocations, rbf, list(gamma=1/10^13))
  kernelized = kernelize(geneExpression, weights)
  plot(steps, kernelized[1,])

Run the code above in your browser using DataLab