#NEWLINE# def combineUnmergedIntervals( foreground , background ) : #NEWLINE# #INDENT# 'combine intervals in a collection of bed files.\n\n    Only intervals in the first track are reported.\n\n    Algorithm:\n\n    1. report all intervals in the first track that overlap with an\n    interval in every other track.\n\n    ' #NEWLINE# c = 0 #NEWLINE# for bed in foreground . fetch ( parser = pysam . asBed ( ) ) : #NEWLINE# #INDENT# c += 1 #NEWLINE# if isContainedInAll ( bed . contig , bed . start , bed . end , background ) : #NEWLINE# #INDENT# ( yield bed )