Description Usage Arguments Value Examples
WPCMS function calculates the Weighted Principal Curve Metric Scaling solution for a contact 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 weighted Frobenius norm
|| W x (Z - D^2(X) + β) ||
w.r.t. Θ subject to the smooth curve constraint X = HΘ. Here D(X) refers to the matrix of pairwise distances. The spatial coordiantes of the resulting reconstruction are presented in X.
1 2 3 4 5 6 7 8 9 10 11 |
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. |
W |
a weights matrix, same dimension as |
Theta0 |
an initialization for spline basis coefficient matrix Theta. By defaul |
update_beta |
If |
eps |
a positive convergence tolerance. |
maxiter |
an integer giving the maximal number of iterations. |
verbose |
logical. If |
A list containing the WPCMS problem solution:
Theta
– the matrix of spline parameters.
X
– the resulting conformation reconstruction.
beta
– the resulting intercept value.
loss
– the resulting value of the WPCMS loss.
iter
– the total number of iterations.
plot
– the list of WPCMS plots: 'loss' corresponds to loss vs. iteration plot, 'intercept' represents beta vs. iteration plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(C)
#transform contact counts to distances
Z = 1/(C+1)
#create spline basis matrix
H = splines::bs(1:ncol(C), df = 5)
#orthogonalize H using QR decomposition
H = qr.Q(qr(H))
#run WPCMS with equal weights; optimize intercept
WPCMS(Z, H)$X
#run WPCMS with random weights; fixed intercept
W = matrix(runif(length(Z)), dim(Z))
WPCMS(Z, H, W, beta = 1)$X
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.