
motifKernel(motifs, r = 1, annSpec = FALSE, distWeight = numeric(0), normalized = TRUE, exact = TRUE, ignoreLower = TRUE, presence = FALSE)
"getFeatureSpaceDimension"(kernel, x)
annotationMetadata
).
Default=FALSEgaussWeight
). Default=NULLDNAStringSet
,
RNAStringSet
,
AAStringSet
(or as
BioVector
)MotifKernel
.of getDimFeatureSpace: dimension of the feature space as
numeric value
r
leads
to a transfomation of similarities by taking each element
of the similarity matrix to the power of r. For the
annotation specific variant of this kernel see
annotationMetadata, for the distance weighted
variants see positionMetadata. If
normalized=TRUE
, the feature vectors are scaled to
the unit sphere before computing the similarity value for
the kernel matrix. For two samples with the feature vectors
x
and y
the similarity is computed as:
exact=TRUE
the sequence characters are
interpreted according to an exact character set. If the
flag is not set ambigous characters from the IUPAC
characterset are also evaluated.The annotation specific variant (for details see annotationMetadata) and the position dependent variants (for details see positionMetadata) either in the form of a position specific or a distance weighted kernel are supported for the motif kernel. The generation of an explicit representation is not possible for the position dependent variants of this kernel.
Hint: For a normalized motif kernel with a feature subset
of a normalized spectrum kernel the explicit representation
will not be identical to the subset of an explicit
representation for the spectrum kernel because the motif
kernel is not aware of the other kmers which are used in
the spectrum kernel additionally for normalization.
Creation of kernel matrix The kernel matrix is
created with the function getKernelMatrix
or
via a direct call with the kernel object as shown in the
examples below.
kernelParameters-method
,
getKernelMatrix
, getExRep
,
spectrumKernel
, mismatchKernel
,
gappyPairKernel
## instead of user provided sequences in XStringSet format
## for this example a set of DNA sequences is created
## RNA- or AA-sequences can be used as well with the motif kernel
dnaseqs <- DNAStringSet(c("AGACTTAAGGGACCTGGTCACCACGCTCGGTGAGGGGGACGGGGTGT",
"ATAAAGGTTGCAGACATCATGTCCTTTTTGTCCCTAATTATTTCAGC",
"CAGGAATCAGCACAGGCAGGGGCACGGCATCCCAAGACATCTGGGCC",
"GGACATATACCCACCGTTACGTGTCATACAGGATAGTTCCACTGCCC",
"ATAAAGGTTGCAGACATCATGTCCTTTTTGTCCCTAATTATTTCAGC"))
names(dnaseqs) <- paste("S", 1:length(dnaseqs), sep="")
## create the kernel object with the motif patterns
mot <- motifKernel(c("A[CG]T","C.G","G[^A][AT]"), normalized=FALSE)
## show details of kernel object
mot
## generate the kernel matrix with the kernel object
km <- mot(dnaseqs)
dim(km)
km
## alternative way to generate the kernel matrix
km <- getKernelMatrix(mot, dnaseqs)
## Not run:
# ## plot heatmap of the kernel matrix
# heatmap(km, symm=TRUE)
#
# ## generate rectangular kernel matrix
# km <- mot(x=dnaseqs, selx=1:3, y=dnaseqs, sely=4:5)
# dim(km)
# km
# ## End(Not run)
Run the code above in your browser using DataLab