def pairedBEDIterator(inputStreams, mirror=False, mirrorScore=None,<EOL>ignoreStrand=False, ignoreScore=True, ignoreName=True,<EOL>sortedby=ITERATOR_SORTED_END, scoreType=float,<EOL>verbose=False):
<EOL>sortOrder = ["<STR_LIT>"]<EOL>if sortedby == ITERATOR_SORTED_START:<EOL><INDENT>sortOrder.append("<STR_LIT:start>")<EOL>sortOrder.append("<STR_LIT:end>")<EOL><DEDENT>elif sortedby == ITERATOR_SORTED_END:<EOL><INDENT>sortOrder.append("<STR_LIT:end>")<EOL>sortOrder.append("<STR_LIT:start>")<EOL><DEDENT>if not ignoreStrand:<EOL><INDENT>sortOrder.append("<STR_LIT>")<EOL><DEDENT>if not ignoreName:<EOL><INDENT>sortOrder.append("<STR_LIT:name>")<EOL><DEDENT>if not ignoreScore:<EOL><INDENT>sortOrder.append("<STR_LIT>")<EOL><DEDENT>keyFunc = attrgetter(*sortOrder)<EOL>def next_item(iterator):<EOL><INDENT>"""<STR_LIT>"""<EOL>try:<EOL><INDENT>return next(iterator)<EOL><DEDENT>except StopIteration:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>bIterators = [BEDIterator(bfh, verbose=verbose,<EOL>sortedby=sortedby,<EOL>scoreType=scoreType) for bfh in inputStreams]<EOL>elements = [next_item(it) for it in bIterators]<EOL>while True:<EOL><INDENT>assert(len(elements) >= <NUM_LIT:2>)<EOL>if None not in elements and len(set([keyFunc(x) for x in elements])) == <NUM_LIT:1>:<EOL><INDENT>yield [e for e in elements]<EOL>elements = [next_item(it) for it in bIterators]<EOL><DEDENT>else:<EOL><INDENT>minElement = min([x for x in elements if x is not None], key=keyFunc)<EOL>minIndices = [i for i in range(<NUM_LIT:0>, len(elements))<EOL>if elements[i] is not None and<EOL>keyFunc(elements[i]) == keyFunc(minElement)]<EOL>if mirror:<EOL><INDENT>score = minElement.score if mirrorScore is None else mirrorScore<EOL>yield [elements[i] if i in minIndices<EOL>else GenomicInterval(minElement.chrom, minElement.start,<EOL>minElement.end, minElement.name,<EOL>score, minElement.strand,<EOL>scoreType=scoreType)<EOL>for i in range(<NUM_LIT:0>, len(elements))]<EOL><DEDENT>for index in minIndices:<EOL><INDENT>elements[index] = next_item(bIterators[index])<EOL><DEDENT><DEDENT>if reduce(lambda x, y: x and y, [e is None for e in elements]):<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Iterate over multiple BED format files simultaneously and yield lists of
genomic intervals for each matching set of intervals found. By default,
regions which are not found in all files will be skipped (mirror = false).
Optionally (by setting mirror to true) if a file is missing an interval,
it can be added on-the-fly, and will have the same chrom, start and end and
name as in other files. The score will be taken from the first file in
inputStreams if mirrorScore is not set, otherwise that value will be used.

:param inputStreams: a list of input streams in BED format
:param mirror: if true, add missing elements so all streams contain the
               same elements. Inserted elements will have the same
:param ignoreStrand: ignore strand when comparing elements for equality?
:param ignoreScore: ignore score when comparing elements for equality?
:param ignoreScore: ignore name when comparing elements for equality?
:param sortedby: must be set to one of the sorting orders for BED streams;
                 we require the streams to be sorted in some fashion.
:param scoreType: interpret scores as what type? Defaults to float, which
                  is generally the most flexible.