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