hic3defdr.util.apa module

hic3defdr.util.apa.make_apa_stack(matrix, clusters, width, min_dist=None)[source]

Creates a stack of square matrix slices centered on each cluster in a list.

Parameters:
  • matrix (scipy.spmatrix) – The matrix to take slices of.
  • clusters (list of clusters) – The clusters around which to take the slices. Each cluster should be a list of [x, y] pairs representing the points in that cluster.
  • width (int) – The width of the slice to take in bin units. Should be odd.
  • min_dist (int, optional) – Clusters with interaction distances shorter than this (in bin units) will be given an slice of all nan’s. Pass None to use a sane default.
Returns:

This array will have three dimensions. The first axis represents the clusters, the next two represent the square slice for each cluster. The array may contain nan’s.

Return type:

np.ndarray