distance_peak {FunChIP}R Documentation

Computing distance matrices among spline-smoothed peaks and among their derivatives.

Description

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.

Usage

distance_peak(object, p = 1, rescale = FALSE)

Arguments

object

GRanges object of length N. It has to contain the metadata columns spline, spline_der, width_spline.

p

integer. It must assume values in {0, 1, 2}. They correspond respectively to the L^{∞}, L^1 and L^2 norm. See details for the definition of the norms.

rescale

logical. If TRUE the distance among scaled peaks is computed. For the definition of scaled peaks see smooth_peak.

Details

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:

Value

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.

Author(s)

Alice Parodi, Marco J. Morelli, Laura M. Sangalli, Piercesare Secchi, Simone Vantini

Examples

# load the data
data(peaks)

# Compute the pairwise
# L2 distance between the peaks
dist_matrices <- distance_peak(peaks.data.summit, p = 2)


[Package FunChIP version 1.16.0 Index]