Calculates the Kullback–Leibler (KL) divergence between a mutational signature and a uniform distribution. KL divergence quantifies how much the observed mutation context distribution (the signature) deviates from an equal-weight, flat profile across all contexts.
Usage
sig_kl_divergence(signature, base = exp(1), pseudocount = 1e-12)
Details
A value of 0 indicates a perfectly uniform signature. Higher values indicate more peaked or biased signatures. KL divergence is commonly used as a measure of "non-uniformity" or "distinctiveness" of mutation profiles.
A small pseudocount
is added to avoid taking the log of zero when any context
has zero weight.