Distance between this interval and e -- number of nucleotides.

    We consider intervals that overlap to have a distance of 0 to each other.
    The distance between two intervals on different chromosomes is considered
    undefined, and causes an exception to be raised.

    :return: the distance from this GenomicInterval to e.
    :param e: the other genomic interval to find the distance to.
    :raise GenomicIntervalError: if self and e are on different chromosomes.

def distance(self, e):
    """
    Distance between this interval and e -- number of nucleotides.

    We consider intervals that overlap to have a distance of 0 to each other.
    The distance between two intervals on different chromosomes is considered
    undefined, and causes an exception to be raised.

    :return: the distance from this GenomicInterval to e.
    :param e: the other genomic interval to find the distance to.
    :raise GenomicIntervalError: if self and e are on different chromosomes.
    """
    if e.chrom != self.chrom:
      raise GenomicIntervalError("cannot get distance from " + str(self) +
                                 " to " + str(e) + " as they're on " +
                                 "different chromosomes")
    dist = 0
    if not e.intersects(self):
      dist = max(self.start, e.start) - min(self.end, e.end)
    return dist