Skip to content

Scaling KR-balanced matrices in Cooler for comparisons #350

Answered by nvictus
kalavattam asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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 scale or equivalently by multiplying the balancing weight vector by s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kalavattam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants