Align/rotate one embedding onto another

align_embedding(x, y, ...)

rotate_embedding(x, y, ...)

Arguments

x

a numeric matrix of unaligned embedding coordinates

y

a numeric matrix to align `x`` to

...

other arguments to pass BiocSingular::runSVD

Value

A matrix of dimension equal to x

Details

This is a (naive implementation) of Procuste's analysis, the goal is to find a rotation matrix that most closely aligns the matrix x to the matrix y by centering and rescaling. One method of solving this problem is to perform singular value decomposition on crossprod(y - colMeans(y), x - colMeans(x)).