Description Usage Arguments Details Value Author(s) Examples
View source: R/distance.GRange.R
Given a metric (L^1, L^2 or L^∞), it computes the pairwise distance among the spline approximation of the peaks and among their derivatives. If summit is provided, peaks are centered around the summit to compute the distances.
1 | distance_peak(object, p = 1, rescale = FALSE)
|
object |
GRanges object of length N. It has to contain the metadata columns
|
p |
integer. It must assume values in |
rescale |
logical. If |
This function computes the pairwise distance of a set of N peaks.
Given the spline-smoothed peaks s_i and their derivatives s^{\prime}_i
(i = 1, …, N),
it returns two matrices dist_matrix_d0
and dist_matrix_d1
whose
elements (i,j), with i, j = 1, …, N, are
dist_matrix_d0 (i.j) = || s_i - s_j||_p dist_matrix_d1 (i.j) = || s'_i - s'_j||_p
.
In particular, in order to define the distance between two functions f and g:
define a common domain U, given by the union of the domains of f and g. If a function is not defined on the whole domain, it is extended with 0's on the missing parts. The value of 0 is chosen because the background of the peaks has been removed during the definition of the splines, and hence they can now be continuously extended with 0's.
choose the order of the norm p
. Given the function f defined on U
we have:
|| f ||_0 = || f ||_{L^∞} = max_{x in U} | f(x) |
,
|| f ||_1 = || f ||_{L^{1}} = int (|f(x)| dx)
,
|| f ||_2 = || f ||_{L^{2}} = sqrt(int (f(x))^2 dx)
.
list with two components
dist_matrix_d0 |
N x N matrix of the pairwise distances between the splines. |
dist_matrix_d2 |
N x N matrix of the pairwise distances between the derivatives of splines. |
Alice Parodi, Marco J. Morelli, Laura M. Sangalli, Piercesare Secchi, Simone Vantini
1 2 3 4 5 6 | # load the data
data(peaks)
# Compute the pairwise
# L2 distance between the peaks
dist_matrices <- distance_peak(peaks.data.summit, p = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.