satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.29k stars 915 forks source link

Questions about the definition of rPCA #5646

Closed HelloWorldLTY closed 2 years ago

HelloWorldLTY commented 2 years ago

Hi, I wonder for two matrices A_mxg, and B_nxg, how to calculate the rPCA based on math equation? I checked your code but I think it is a little confusing. For example, if I do svd based on A, like A=USV^t. Then, the query embeddings should be something like: VY?

I cannot find the real method to calculate it. Could you please help me? Thanks a lot.

yuhanH commented 2 years ago

Hi, you are right. After perform SVD on A, we can project B into feature loadings of A. Then we perform SVD on B and project A with feature loadings of B.

HelloWorldLTY commented 2 years ago

Hi, thanks for your explanation. So based on my understanding, V stores the feature loadings. And for A each line, we need to multiply the V to that line? Is this correct? It seems that the final value will be a vector.

yuhanH commented 2 years ago

for example, each row of A is a cell and each column is a feature, a_i 1 x d. V is a d x PCs matrix. ai V is a 1 x PCs vector. A V is a n_cell x PCs matrix.

HelloWorldLTY commented 2 years ago

Hi, I just have one last question. I think I need to use the same space to calculate the MNN pairs, is it correct? For example, if we have u1,v1 from S1, u2, v2 from S2, then we need to use: u1v2^T and u2v2^T to find the pairs in the same space, is it correct? Or we need to use u1v2^T and u2v1^T? Thanks a lot.