- Data structure for performing intersect and neighbor queries on a

- set of intervals. Algorithm uses a segment/interval tree to perform

- >>> from bx.intervals.intersection import IntervalNode, Interval

- >>> tree = IntervalNode( 0, 10, Interval(0, 10))

- Add intervals, the only requirement is that the interval have integer

- start and end attributes. Optional arguments are strand, name, and info.

- >>> Interval(1, 22, value={'chr':12, 'anno': 'anything'})

- Interval(1, 22, value={'anno': 'anything', 'chr': 12})

- >>> tree = tree.insert( 3, 7, Interval(3, 7) )

- >>> tree = tree.insert( 3, 40, Interval(3, 40) )

- >>> tree = tree.insert( 13, 50, Interval(13, 50) )

- [Interval(0, 10), Interval(3, 7), Interval(3, 40)]

- [Interval(0, 10), Interval(3, 40)]

- [Interval(3, 40), Interval(13, 50)]

- >>> tree.find(100, 200)

- the left method finds features that are strictly to the left of

- the query feature. overlapping features are not considered:

+ A single node of an `IntervalTree`.

+ NOTE: Unless you really know what you are doing, you probably should us

+ `IntervalTree` rather than using this directly.

cpdef IntervalNode insert(IntervalNode self, int start, int end, object interval):

+ Insert a new IntervalNode into the tree of which this node is

+ currently the root. The return value is the new root of the tree (which

+ may or may not be this node!)

cdef IntervalNode croot = self

# If starts are the same, decide which to add interval to based on

# end, thus maintaining sortedness relative to start/end