Description Usage Arguments Value Examples
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.
1 | PCMS(Z, H)
|
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. |
A list containing the PCMS problem solution:
Theta
– the matrix of spline parameters.
X
– the resulting conformation reconstruction.
loss
– the resulting value of the PCMS loss.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.