open2c/coolpuppy

How does rescale work?

Qiuhai-Zeng opened this issue · 2 comments

Hi,

This may be a technical question. I couldn't understand how you do pileup plot for different sizes of regions. Can you explain the following example?

The data (under 5kb resolution) looks like this
image

The code is
image

As you can see, for example, the first two rows of the data have different lengths of intervals (150 pixels for row 1; 104 pixels for row 2). My question is how do you deal with such different lengths to get the following plot
image

I have read the Docs, but found it hard to understand how you rescale the regions.

I also got confused on local=True. Can you explain what it means by 'Create local pileups, i.e. along the diagonal'? I tried to look at the code, but failed to grasp it.

I really appreciate any explanations!

Best,
Qiuhai

Phlya commented

Thank you for your questions!

Rescaling works by applying this function from cooltools: https://github.com/open2c/cooltools/blob/918fe1c468c37a7eb54fc288dc0a929771b1eacf/cooltools/lib/numutils.py#L1134
Which is simply an interface to scipy.ndimage.zoom https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html

Local pileups always have the main diagonal of the matrix as their main diagonal. I.e. interactions at TAD boundaries, or interactions within a TAD, something like that. Pileups of chromatin loops, on the other hand, would be not local, e.g. could be called distal.

Phlya commented

Assuming this is clear, feel free to reopen!