MCPcopy Create free account
hub / github.com/chaimleib/intervaltree / __init__

Method __init__

intervaltree/intervaltree.py:252–270  ·  view source on GitHub ↗

Set up a tree. If intervals is provided, add all the intervals to the tree. Completes in O(n*log n) time.

(self, intervals=None)

Source from the content-addressed store, hash-verified

250 return IntervalTree(ivs)
251
252 def __init__(self, intervals=None):
253 """
254 Set up a tree. If intervals is provided, add all the intervals
255 to the tree.
256
257 Completes in O(n*log n) time.
258 """
259 intervals = set(intervals) if intervals is not None else set()
260 for iv in intervals:
261 if iv.is_null():
262 raise ValueError(
263 "IntervalTree: Null Interval objects not allowed in IntervalTree:"
264 " {0}".format(iv)
265 )
266 self.all_intervals = intervals
267 self.top_node = Node.from_intervals(self.all_intervals)
268 self.boundary_table = SortedDict()
269 for iv in self.all_intervals:
270 self._add_boundaries(iv)
271
272 def copy(self):
273 """

Callers 5

clearMethod · 0.95
split_overlapsMethod · 0.95
merge_overlapsMethod · 0.95
merge_equalsMethod · 0.95
merge_neighborsMethod · 0.95

Calls 4

_add_boundariesMethod · 0.95
is_nullMethod · 0.80
formatMethod · 0.80
from_intervalsMethod · 0.80

Tested by

no test coverage detected