cluster module

class mavis.cluster.cluster.IntervalPair(start, end, **kwargs)[source]

Bases: object

Parameters:
  • start (Interval) – the first interval
  • end (Interval) – the second interval
static abs_dist(other)[source]
static center_dist(other)[source]

computes the distance between IntervalPairs by averaging the distance between the first Interval centers of each and the second Interval centers of each

Returns:the distance between interval pairs
Return type:int
classmethod cluster(pairs, r, k)[source]

clusters a list of IntervalPair objects

Parameters:
  • pairs (list of IntervalPair) – list of IntervalPair objects
  • r (int) – the distance for grouping clusters
  • k (int) – the clique size to look for
Returns:

a list of sets of interval pairs representing their clusters/groupings

Return type:

list of set of IntervalPair

classmethod merge(*interval_pairs)[source]

returns a new IntervalPair where the start interval is the weighted mean of the starts of all the input interval pairs, similar for the end

Parameters:interval_pairs (IntervalPair) – interval pairs
Returns:the new IntervalPair
Return type:IntervalPair
mavis.cluster.cluster.cluster_breakpoint_pairs(input_pairs, r, k)[source]
mavis.cluster.cluster.is_complete(G, N)[source]

for a given input graph and a set of nodes N in G checks if N is a complete subgraph of G

Parameters:
Returns:

True if N as a subgraph of G is complete False otherwise

Return type:

bool

mavis.cluster.cluster.merge_integer_intervals(*intervals)[source]

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

mavis.cluster.cluster.weighted_mean(values, weights=None)[source]