lib5c.algorithms.filtering.util module

Module containing utility functions for filtering 5C interaction matrices.

lib5c.algorithms.filtering.util.filter_selector(array, nearby_x, nearby_y)[source]

Create a list of dicts that describes the “neighborhood” around a point given an array of values and lists of the nearby entities along both the x- and y-axes.

  • array (np.ndarray) – The array of values at each point in the region.

  • nearby_y (nearby_x,) –

    A list of nearby entities (bins or fragments) along the x- or y-axis, respectively, represented as dicts of the form:

        'index': int,
        'distance': int

    where ‘index’ is the index of the entity within the region, and ‘distance’ is the distance from this entity to the query point in base pairs. A list of this form can be created by functions like find_nearby_bins() or find_nearby_fragments().