Intervals.py -

Author:Andreas Heger
Release:$Id$
Date:December 09, 2013
Tags:Python

Code

Intervals.combine(intervals)

combine intervals.

Overlapping intervals are concatenated into larger intervals.

Intervals.prune(intervals, first=None, last=None)

truncates all intervals that are extending beyond first or last.

Empty intervals are deleted.

Intervals.complement(intervals, first=None, last=None)

complement a list of intervals with intervals not in list.

Intervals.addComplementIntervals(intervals, first=None, last=None)

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

Intervals.combineAtDistance(intervals, min_distance)

combine a list intervals and merge those that are less than a certain distance apart.

Intervals.DeleteSmallIntervals(intervals, min_length)

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

Intervals.getIntersections(intervals)

combine intervals.

Overlapping intervals are reduced to their intersection.

Intervals.RemoveIntervalsContained(intervals)

remove intervals 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)]

Intervals.RemoveIntervalsSpanning(intervals)

remove intervals 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)]

Intervals.ShortenIntervalsOverlap(intervals, to_remove)

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

assumption: intervals are not overlapping

Intervals.joined_iterator(intervals1, intervals2)

iterate over the combination of two intervals.

returns the truncated intervals delineating the ranges of overlap between intervals1 and intervals2.

Intervals.intersect(intervals1, intervals2)

intersect two interval sets.

Return a set of intervals that is spanned by intervals in both sets. Returns the union of the two intervals.

Intervals.getLength(intervals)

return sum of intervals.

Intervals.truncate(intervals1, intervals2)

truncate intervals in intervals1 by intervals2

Example: truncate( [(0,5)], [(0,3)] ) = [(3,5)]

Intervals.calculateOverlap(intervals1, intervals2)

calculate overlap between intervals.

The intervals within each set should not be overlapping.

Intervals.fromArray(a)

get intervals from a binary array.

Table Of Contents

Previous topic

<no title>

Next topic

Mali.py - Tools for multiple alignments

This Page