HiCExplorer icon indicating copy to clipboard operation
HiCExplorer copied to clipboard

Again on insulation scores

Open dawe opened this issue 4 years ago • 3 comments

Hi all, I'm trying again to interpret insulation scores from hicFindTAD, which I understand is not the one described here or here. Looking at the code I found this should be the section in which score is actually calculated, isn't it?

https://github.com/deeptools/HiCExplorer/blob/b020f9b2a0590a0c0958692cce92710c1d802cd4/hicexplorer/hicFindTADs.py#L612-L614

I understand it is calculated as the difference between the average score upstream and downstream a boundary and the score at the boundary itself. The stronger the boundary, the more negative the score is (as @LeilyR pointed in #730). Is this correct? Looking at the matrix indexes above I cannot understand the rationale of the choice of intervals:

                min_idx + 3
 min_idx -      |
 window_len     |     
 |              |
 |      min_idx |
 >----------+---<
                 >------<
                 |      |
               min_idx  |
                 + 4    |
                        |
                        min_idx + window_len

shouldn't it be

local_tad_score = np.concatenate([matrix_avg[min_idx - window_len:min_idx - 3], 
                                   matrix_avg[min_idx + 4: min_idx + window_len]]) 

or

local_tad_score = np.concatenate([matrix_avg[min_idx - window_len:min_idx], 
                                   matrix_avg[min_idx + 1: min_idx + window_len]]) 

dawe avatar Aug 26 '21 08:08 dawe

It's this publication: https://www.nature.com/articles/s41467-017-02525-w

joachimwolff avatar Aug 26 '21 09:08 joachimwolff

@joachimwolff thanks, my bad, I missed it, sorry. And yet, what is the rationale behind the +3,+4 shifting of the min_idx when concatenating the matrices?

dawe avatar Aug 26 '21 09:08 dawe

Very good question. This is old legacy code from a developer not involved in HiCExplorer anymore.

@fidelram In case you read these messages, can you answer this?

joachimwolff avatar Sep 14 '21 09:09 joachimwolff