bandhic.compute_bin_bias#

bandhic.compute_bin_bias(hic_coo, verbose=False)[source]#

Compute bias values for Hi-C contact matrices using the Knight-Ruiz normalization algorithm.

Parameters:
  • hic_coo (scipy.sparse.coo_array) – A sparse COO matrix representing Hi-C contact data.

  • verbose (bool, optional) – If True, print detailed information during processing. Default is False.

Returns:

  • bias (numpy.ndarray) – A 1D array containing the bias values for each bin in the Hi-C matrix.

  • is_valid (bool) – A boolean indicating whether the bias vector is valid (mean and median within typical range).

Notes

This function removes a specified percentage of the most sparse bins from the Hi-C matrix before computing the bias values. The Knight-Ruiz normalization algorithm is applied to the modified matrix to compute the bias. The function iteratively removes bins with low interaction counts until a valid bias vector is obtained. The bias vector is expected to have a mean and median close to 1, indicating balanced interaction frequencies across bins.