Issue #5 resolved

patch for simpler traverse on IntervalTree

Brent Pedersen
created an issue

this fixes the bug for alias of add_interval => insert_interval. also adds the traverse() function to the IntervalTree and it makes the interval public so that it can be accessed by (for example) a traversing function.

{{{

!python

diff --git a/lib/bx/intervals/intersection.pyx b/lib/bx/intervals/intersection.pyx --- a/lib/bx/intervals/intersection.pyx +++ b/lib/bx/intervals/intersection.pyx @@ -65,7 +65,7 @@ cdef class IntervalNode: IntervalTree rather than using this directly. """ cdef float priority - cdef object interval + cdef public object interval cdef public int start, end cdef int minend, maxend, minstart cdef IntervalNode cleft, cright, croot @@ -465,7 +465,13 @@ cdef class IntervalTree: """ Synonym for insert_interval. """ - self.insert( interval ) + self.insert_interval( interval )

  • def traverse(self, fn):
  • """
  • call fn for each element in the tree
  • """
  • return self.root.traverse(fn) + # For backward compatibility -Intersecter = IntervalTree \ No newline at end of file +Intersecter = IntervalTree

}}}

Comments (1)

  1. Log in to comment