The reason why I have not integrated PCA computation into this
function is that pca takes too long for large matrices. That's why the
function looks quite inconvenient. I use gmodels::fast.prcomp
for PCA.
Similarly, users need to calculate the PC projected variance externally e.g.
proj_var <- solve (pc_pt$rotation^2, t(pred_list[2]), tol=1e-20)
Strictly speaking, projecting variance onto PCs require NNLS. I have implemented it in python but no time to do so in R. Fortunately, I did not need to use this function often.
1 2 3 4 5 6 7 8 9 10 | pca_with_pt_line(
pc_pt,
pt_mat,
metadata,
color.by,
branch_info = NULL,
proj_var = NULL,
num_dim = c(1, 2),
AP = AP
)
|
pc_pt |
a prcomp object |
pt_mat |
the matrix for pseudotime trajectory |
branch_info |
a vector for branch assignment |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.