Skip to content


class mavis.cluster.cluster.BreakpointPairGroupKey

inherits []


Merges a set of integer intervals into a single interval where the center is the weighted mean of the input intervals. The weight is inversely proportional to the length of each interval. The length of the final interval is the average of the lengths of the input intervals capped in size so that it never extends beyond the union of the input intervals

def merge_integer_intervals(*intervals, weight_adjustment=0):


for a given set of breakpoint pairs, merge the union of all pairs that are within the given distance (cluster_radius)

def merge_by_union(input_pairs, group_key, weight_adjustment=10, cluster_radius=200):


  • input_pairs
  • group_key
  • weight_adjustment
  • cluster_radius


two-step merging process

  1. merges all 'small' (see cluster_initial_size_limit) events as the union of all events that fall within the cluster_radius
  2. for all remaining events choose the 'best' merge for any event within cluster_radius of an existing node. Otherwise the node is added unmerged. The events in the second phase are done in order of smallest total breakpoint interval size to largest
def merge_breakpoint_pairs(
    input_pairs, cluster_radius=200, cluster_initial_size_limit=25, verbose=False


  • input_pairs (List[BreakpointPair]): the pairs to be merged
  • cluster_radius
  • cluster_initial_size_limit (int): maximum size of breakpoint intervals allowed in the first merging phase
  • verbose


  • Dict[BreakpointPair,List[BreakpointPair]]: mapping of merged breakpoint pairs to the input pairs used in the merge