open2c / coolpuppy

A versatile tool to perform pile-up analysis on Hi-C data in .cool format.
MIT License
78 stars 12 forks source link

[Q]Understanding rescaling #152

Closed zhaoyycrow closed 2 months ago

zhaoyycrow commented 3 months ago

I am looking at the rescaling example in the notebook and have the following questions:

  1. Where is the pile up plot centered? The example looks like it's centered at the middle of the rescaled compartment A.
  2. Is the flanking region taken before or after rescale? Is the flanking region different depends on the size of each region?

Ultimately, I want to make a pileup of scaled genes (TSS-TES) and centered at the TSS or TES, not the middle, and choose the number of bp/bins in flank. How do I do it?

Thank you!

efriman commented 3 months ago
  1. The region in your bed file will be in the center of the pileup, rescaled to a fraction of the total number of pixels. For example, with rescale_flank=1 it will be one third (i.e. [1, 1, 1] for [flank, region, flank]) and rescale_flank=3 it will be one seventh (i.e. [3, 1, 3])
  2. The size of the flank is a multiple of the size of each region, so if the regions are different sizes then the flanks in absolute terms are different, and then the pileups rescaled using
  3. This is not possible in the current implementation, it would always be centered at the center of region and rescaling is relative.
Phlya commented 2 months ago

Note that it can be achieved manually, if you create separate upstream/downstream regions and they combinations, and then pileup them without rescaling, and then assemble all together in one matrix (ensure matching shape of course).

I hope otherwise this was helpful, feel free to reopen if more help is needed.