Scaling KR-balanced matrices in Cooler for comparisons #350
-
I'm seeking clarification on the need to scale matrices that have undergone KR balancing before comparison, such as log2-transformed division of one matrix by another. My understanding is that if matrices are scaled to have the same number of contacts per chromosome, including a transformation into contact probabilities, additional scaling is unnecessary. I know Juicer restores the original number of contacts, necessitating scaling. Could you inform me how Cooler handles this? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
By default, cooler rescales the target matrix (whole genome by default, or each chromosome for cis-only balancing) to make the marginal sums = 1. This can be turned off with the with clr.open("r") as f:
scale = f["bins/weight"].attrs["scale"] This scaling factor corresponds to the marginal sum of the target matrix at the end of balancing which is roughly corresponds to its average read coverage. If desired, you can restore this scale factor by multiplying a balanced matrix by |
Beta Was this translation helpful? Give feedback.
By default, cooler rescales the target matrix (whole genome by default, or each chromosome for cis-only balancing) to make the marginal sums = 1.
This can be turned off with the
rescale_marginals
option in balance_cooler; however, we also store the original scaling factor in the metadata attributes of the weight vector:This scaling factor corresponds to the marginal sum of the target matrix at the end of balancing which is roughly corresponds to its average read coverage. If desired, you can restore this scale factor by multiplying a balanced matrix by
scale
or equivalently by multiplying the balancing weight vector bys…