Description Usage Arguments Value Author(s) References Examples
Create a dense or sparse kernel matrix from an explicit representation
1 2 |
x |
a dense or sparse explicit representation. |
y |
a dense or sparse explicit representation. If |
selx |
a numeric or character vector for defining a subset of
|
sely |
a numeric or character vector for defining a subset of
|
sparse |
boolean indicating whether returned kernel matrix
should be sparse or dense. For value |
triangular |
boolean indicating whether just the lower triangular or the full sparse matrix should be returned. This parameter is only relevant for a sparse symmetric kernel matrix. Default=TRUE |
diag |
boolean indicating whether the diagonal should be included
in a sparse triangular matrix. This parameter is only relevant when
parameter |
lowerLimit |
a numeric value for a similarity threshold. The parameter is relevant for sparse kernel matrices only. If set to a value larger than 0 only similarity values larger than this threshold will be included in the sparse kernel matrix. Default=0 |
linearKernel:
kernel matrix as class KernelMatrix
or sparse
kernel matrix of class dgCMatrix
dependent on parameter sparse
Johannes Palme <kebabs@bioinf.jku.at>
http://www.bioinf.jku.at/software/kebabs
J. Palme, S. Hochreiter, and U. Bodenhofer (2015) KeBABS: an R package
for kernel-based analysis of biological sequences.
Bioinformatics, 31(15):2574-2576, 2015.
DOI: 10.1093/bioinformatics/btv176.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## load sequence data and change sample names
data(TFBS)
names(enhancerFB) <- paste("S", 1:length(enhancerFB), sep="_")
## create the kernel object for dimers with normalization
speck <- spectrumKernel(k=5)
## generate sparse explicit representation
ers <- getExRep(enhancerFB, speck)
## compute dense kernel matrix (as currently used in SVM based learning)
km <- linearKernel(ers)
km[1:5, 1:5]
## compute sparse kernel matrix
## because it is symmetric just the lower diagonal
## is computed to save storage
km <- linearKernel(ers, sparse=TRUE)
km[1:5, 1:5]
## compute full sparse kernel matrix
km <- linearKernel(ers, sparse=TRUE, triangular=FALSE)
km[1:5, 1:5]
## compute triangular sparse kernel matrix without diagonal
km <- linearKernel(ers, sparse=TRUE, triangular=TRUE, diag=FALSE)
km[1:5, 1:5]
## plot histogram of similarity values
hist(as(km, "numeric"), breaks=30)
## compute sparse kernel matrix with similarities above 0.5 only
km <- linearKernel(ers, sparse=TRUE, lowerLimit=0.5)
km[1:5, 1:5]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.