koszullab / chromosight

Computer vision based program for pattern recognition in chromosome (Hi-C) contact maps
https://chromosight.readthedocs.io
Other
62 stars 9 forks source link

Can chromosight detect loops based on restriction fragments level (1f, 2f, etc) HI-C matrix. #55

Closed Linhua-Sun closed 2 years ago

Linhua-Sun commented 2 years ago

Hi: I am wondering whether chromosight can be used to detect chromatin loops based on restriction fragments level (1f, 2f, etc) HI-C matrix? Such as store Hi-C matrix in cooler format in restriction fragments level. I found using like 1-kb Hi-C matrix in cooler format to identify loops will make the Inaccurate anchors (if I am interested in small-scale loops). The Hi-C library was generated by MboI. Thanks! Best wishes! Linhua

cmdoret commented 2 years ago

Hi @Linhua-Sun,

Unfortunately, this is not feasible with chromosight CLI. We rely on uniform bin sizes at several places to speed up algorithms. For example, the matrix is trimmed to the Nth diagonal based on max_-dist, if bins had different size, we could not establish a constant relationship between a distance and number of pixels.

It is possible to use chromosight's API in a python script to do this, but would require some additional work. The way to do this would be to provide the sparse contact matrix and loop kernel directly to normxcorr2 to compute the convolution (i.e. loop-similarity) matrix,feed this matrix to pick_foci to segment loops and retrieve the list of foci (loops) coordinates in rows/cols. validate_patterns and remove_neighbours could also help for filtering those patterns afterwards.

Linhua-Sun commented 2 years ago

Thank you very much for your prompt reply, which answered my question very well!