Similar to the junction range but don't need to check for leftmost or rightmost
164741
def start_range(self):
      """"""
      if len(self._exons) == 0: return None
      return GenomicRange(self._exons[0].chr,
             min([x.start for x in self._exons]),# must be part of junction
             max([x.start for x in self._exons]))
698470
def limited_to(self, left: Set[TLeft], right: Set[TRight]) -> 'BipartiteGraph[TLeft, TRight, TEdgeValue]':
        """"""
        return BipartiteGraph(((n1, n2), v) for (n1, n2), v in self._edges.items() if n1 in left and n2 in right)
931201
def _select_phase_left_bound(self, epoch_number):
        
        idx = bisect.bisect_left(self.ladder, epoch_number)

        if idx >= len(self.ladder):
            return len(self.ladder) - 1
        elif self.ladder[idx] > epoch_number:
            return idx - 1
        else:
            return idx
182149
def intersect(self, other):
        
        if not self.overlap(other):
            return None

        newstart = max(self._start, other.start)
        newend = min(self._end, other.end)
        return Range(newstart, newend)
679372
def findLowest(self, symorders):
        """"""
        _range = range(len(symorders))
        stableSymorders = map(None, symorders, _range)

        # XXX FIX ME
        # Do I need to sort?
        stableSymorders.sort()
        lowest = None
        for index in _range:
            if stableSymorders[index][0] == lowest:
                return stableSymorders[index-1][1]
            lowest = stableSymorders[index][0]
        return -1
691648
def interval_intersection_width(a, b, c, d):
    """"""
    return max(0, min(b, d) - max(a, c))
102160
def iter_left_col_tcs(self):
        """"""
        col_idx = self._left
        for tr in self._tbl.tr_lst[self._top:self._bottom]:
            yield tr.tc_lst[col_idx]
766612
private void checkAtMost(int i) throws ContradictionException {
		ISet ker = target.getMandSet(g, i);
		ISet env = target.getPotSet(g, i);
		int size = ker.size();
		if (size > degrees[i]) {
			g.removeNode(i, this);
		} else if (size == degrees[i] && env.size() > size) {
			for (int other : env) {
				if (!ker.contains(other)) {
					target.remove(g, i, other, this);
				}
			}
		}
	}
424490
def get_left_right(seq):
    
    cseq = seq.strip(GAPS)
    leftjust = seq.index(cseq[0])
    rightjust = seq.rindex(cseq[-1])

    return leftjust, rightjust
316562
def _range_min(self, p, start, span, i, k):
        
        if start + span <= i or k <= start:        # disjoint intervals
            return self.INF
        if i <= start and start + span <= k:       # included intervals
            return self.s[p]
        left = self._range_min(2 * p, start, span // 2,
                               i, k)
        right = self._range_min(2 * p + 1, start + span // 2, span // 2,
                                i, k)
        return min(left, right)
58494
private static long end(Range<Long> range) {
        if (range.upperBoundType() == BoundType.OPEN) {
            return DiscreteDomain.longs().previous(range.upperEndpoint());
        } else {
            return range.upperEndpoint();
        }
    }
744923
def getAdjacentClone(self, i, south=True):
        
        rr = xrange(i + 1, len(self)) if south else xrange(i - 1, -1, -1)
        a = self[i]
        for ix in rr:
            x = self[ix]
            if x.object != a.object:
                break
            return x
        return None
678875
function equalOwnProperties(left, right, equalityComparer) {
        if (left === right)
            return true;
        if (!left || !right)
            return false;
        for (var key in left)
            if (hasOwnProperty.call(left, key)) {
                if (!hasOwnProperty.call(right, key) === undefined)
                    return false;
                if (equalityComparer ? !equalityComparer(left[key], right[key]) : left[key] !== right[key])
                    return false;
            }
        for (var key in right)
            if (hasOwnProperty.call(right, key)) {
                if (!hasOwnProperty.call(left, key))
                    return false;
            }
        return true;
    }
40092
def range_conflict(ranges, depth=1):
    
    overlap = set()
    active = set()
    endpoints = _make_endpoints(ranges)

    for seqid, ends in groupby(endpoints, lambda x: x[0]):
        active.clear()
        for seqid, pos, leftright, i, score in ends:
            if leftright == LEFT:
                active.add(i)
            else:
                active.remove(i)

            if len(active) > depth:
                overlap.add(tuple(sorted(active)))

    for ov in overlap:
        yield ov
1235096
private static <T extends Comparable<T>> Optional<Range<T>> smallestContainerForRange(
      Collection<Range<T>> ranges, Range<T> target) {
    Range<T> best = Range.all();
    for (final Range<T> r : ranges) {
      if (r.equals(target)) {
        continue;
      }
      // prefer a smaller range, always;
      if (r.encloses(target) && best.encloses(r)) {
        best = r;
      }
    }
    if (best.equals(Range.<T>all())) {
      return Optional.absent();
    }
    return Optional.of(best);
  }
1292941
def _getLowestSyncPoint(self, syncPointList, subs):
        """"""
        if syncPointList[0].subNo == 0:
            return syncPointList[0]
        return SyncPoint(0, subs[0].start, subs[0].end)
1134272
def iter_except_top_row_tcs(self):
        """"""
        for tr in self._tbl.tr_lst[self._top + 1:self._bottom]:
            for tc in tr.tc_lst[self._left:self._right]:
                yield tc