shz9 / magenpy

Modeling and Analysis of (Statistical) Genetics data in python
https://shz9.github.io/magenpy/
MIT License
16 stars 5 forks source link

Modify `LDMatrix` to allow for reordering/sorting LD matrices #11

Closed shz9 closed 5 months ago

shz9 commented 2 years ago

There are cases where we would like to re-order the LD matrix by shuffling its rows and columns to align with some external requirements. This task is challenging to implement, because it will likely mess up with the LD boundaries and affect the sparsity structure of the original matrix.

As a starting point, we can limit ourselves to solutions that do not necessarily re-order the matrix itself, but affect the order in which we iterate over its rows/columns. This may require that instead of storing LD boundaries (start and end point for each row), we can store the indices of all neighboring SNPs whose LD is non-zero. This is similar to the sparse matrix formats implemented by scipy and other libraries.

Will keep this issue open to explore various ideas for how we can go about implementing this.

shz9 commented 5 months ago

New interface should easily support this.