PCMS: Principal Curve Metric Scaling

Description Usage Arguments Value Examples

View source: R/PCMS.R

Description

PCMS function calculates the Principal Curve Metric Scaling solution for some matrix Z (e.g. representing a Hi-C contact matrix after some proper transformation applied) and a spline basis matrix H. The optimal solution is found via minimizing the Frobenius norm

||Z - S(X)||

w.r.t. Θ subject to the smooth curve constraint X = HΘ. Here

S(X) = XX'

refers to the matrix of inner products. The spatial coordiantes of the resulting reconstruction are presented in X.

Usage

1
PCMS(Z, H)

Arguments

Z

a square symmetric matrix.

H

a spline basis matrix. By default assumed to have orthogonal columns. If not, orthogonalization should be done via QR decomposition.

Value

A list containing the PCMS problem solution:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(C)

#transform contact counts to similarities
D = 1/(C+1)
Z = -D^2/2
Z = scale(Z, scale = FALSE, center = TRUE)
Z = t(scale(t(Z), scale = FALSE, center = TRUE))

#create spline basis matrix
H = splines::bs(1:ncol(C), df = 5)

#orthogonalize H using QR decomposition
H = qr.Q(qr(H))

#compute the PCMS solution
PCMS(Z, H)$X

ElenaTuzhilina/PoisMS documentation built on Dec. 11, 2020, 1:29 a.m.