dozmorovlab / HiCcompare

Joint normalization of two Hi-C matrices, visualization and detection of differential chromatin interactions. See multiHiCcompare for the analysis of multiple Hi-C matrices
https://dozmorovlab.github.io/HiCcompare/
Other
18 stars 3 forks source link

Inefficient matrix multiplication in KR norm #2

Closed jnasser3 closed 6 years ago

jnasser3 commented 6 years ago

Hello,

Thank you for making an R implementation of the KR normalization code.

I found it can take a long time to run for large matrices. It seems a bottleneck is line 88 at https://github.com/dozmorovlab/HiCcompare/blob/master/R/KRnormalization.R#L88.

If x is the KR normalization vector, it's unnecessary to form the dense matrix diag(x). Surely there are more efficient solutions, eg using sweep.

mdozmorov commented 6 years ago

Thanks, @jnasser3. We are not sure how to address your concern. Would you mind to suggest some code solution? Or, better yet, make a pull request? Thanks!

mdozmorov commented 6 years ago

Closing this issue due to lack of suggestions.