def offset_range(self, start, end):
        """
        Database start/end entries are always ordered such that
        start < end. This makes computing a relative position (e.g. of a stop
        codon relative to its transcript) complicated since the "end"
        position of a backwards locus is actually earlir on the strand.
        This function correctly selects a start vs. end value depending
        on this locuses's strand and determines that position's offset from
        the earliest position in this locus.
        """
        assert start <= end, \
            "Locations should always have start < end, got start=%d, end=%d" % (
                start, end)

        if start < self.start or end > self.end:
            raise ValueError("Range (%d, %d) falls outside %s" % (
                start, end, self))

        if self.on_forward_strand:
            return (start - self.start, end - self.start)

        else:
            return (self.end - end, self.end - start)
def offset_range ( self , start , end ) : assert start <= end , "Locations should always have start < end, got start=%d, end=%d" % ( start , end ) if start < self . start or end > self . end : raise ValueError ( "Range (%d, %d) falls outside %s" % ( start , end , self ) ) if self . on_forward_strand : return ( start - self . start , end - self . start ) else : return ( self . end - end , self . end - start )
Database start/end entries are always ordered such that
        start < end. This makes computing a relative position (e.g. of a stop
        codon relative to its transcript) complicated since the "end"
        position of a backwards locus is actually earlir on the strand.
        This function correctly selects a start vs. end value depending
        on this locuses's strand and determines that position's offset from
        the earliest position in this locus.