def __init__(self, interval_pairs):
        """
        :param interval_pairs: an ordered list of IntervalPair instances
        :type interval_pairs: list (of IntervalPair instances).
        :returns: an IntervalMapper instance
        """

        def _validate_intervals(ivs):
            for i in range(1, len(ivs)):
                # check for adjacency/non-overlap
                # This constraint, combined with the start_i <= end_i constraint
                # of Intervals, guarantees that intervals are ordered
                assert ivs[i - 1].end_i == ivs[i].start_i, "intervals must be adjacent"

        self.interval_pairs = interval_pairs
        self.ref_intervals = [ip.ref for ip in self.interval_pairs]
        self.tgt_intervals = [ip.tgt for ip in self.interval_pairs]
        _validate_intervals(self.ref_intervals)
        _validate_intervals(self.tgt_intervals)
        self.ref_len = sum([iv.len for iv in self.ref_intervals])
        self.tgt_len = sum([iv.len for iv in self.tgt_intervals])
def __init__ ( self , interval_pairs ) : def _validate_intervals ( ivs ) : for i in range ( 1 , len ( ivs ) ) : assert ivs [ i - 1 ] . end_i == ivs [ i ] . start_i , "intervals must be adjacent" self . interval_pairs = interval_pairs self . ref_intervals = [ ip . ref for ip in self . interval_pairs ] self . tgt_intervals = [ ip . tgt for ip in self . interval_pairs ] _validate_intervals ( self . ref_intervals ) _validate_intervals ( self . tgt_intervals ) self . ref_len = sum ( [ iv . len for iv in self . ref_intervals ] ) self . tgt_len = sum ( [ iv . len for iv in self . tgt_intervals ] )
:param interval_pairs: an ordered list of IntervalPair instances
        :type interval_pairs: list (of IntervalPair instances).
        :returns: an IntervalMapper instance