IntervallsWeigted.py - working with weigted intervals

Work with weighted invervalls. A weighted intervall is a tuple of the form (from,to,weight).

Funktions in this module take an optional function parameter object fct, that will give the weight if two intervalls are combined. The default is to add the weights of intervalls that are combined.

This module is work in progress. Finished are:

CombineIntervallsLarge RemoveIntervallsSpanning

IntervallsWeighted.CombineIntervallsLarge(intervalls, fct=<function <lambda> at 0x6a40230>)

combine intervalls. Overlapping intervalls are concatenated into larger intervalls.

IntervallsWeighted.ComplementIntervalls(intervalls, first=None, last=None)

complement a list of intervalls with intervalls not in list.

IntervallsWeighted.AddComplementIntervalls(intervalls, first=None, last=None)

complement a list of intervalls with intervalls not in list and return both.

IntervallsWeighted.CombineIntervallsDistance(intervalls, min_distance)

combine a list of non-overlapping intervalls, and merge those that are less than a certain distance apart.

IntervallsWeighted.DeleteSmallIntervalls(intervalls, min_length)

combine a list of non-overlapping intervalls, and delete those that are too small.

IntervallsWeighted.CombineIntervallsOverlap(intervalls)

combine intervalls. Overlapping intervalls are reduced to their intersection.

first_from, last_to contain region of current maximum overlapping segment. max_right is maximum extension of any sequence overlapping with current overlapping segment.

IntervallsWeighted.RemoveIntervallsContained(intervalls)

remove intervalls that are fully contained in another.

[(10, 100), (20, 50), (70, 120), (130, 200), (10, 50), (140, 210), (150, 200)]

results:

[(10, 100), (70, 120), (130, 200), (140, 210)]

IntervallsWeighted.RemoveIntervallsSpanning(intervalls, fct=<function <lambda> at 0x6a169b0>)

remove intervalls that are full covering another, i.e. always keep the smallest.

[(10, 100), (20, 50), (70, 120), (40,80), (130, 200), (10, 50), (140, 210), (150, 200)]

result:

[(20, 50), (40, 80), (70, 120), (150, 200)]

IntervallsWeighted.ShortenIntervallsOverlap(intervalls, to_remove)

shorten intervalls, so that there is no overlap with another set of intervalls.

assumption: intervalls are not overlapping

Previous topic

Intervalls.py -

Next topic

SaryFasta.py - index fasta files by suffix array

This Page