I am trying to find the non-overlapping intervals for the start/end DNA coordinates (on the same chromosome). I am having a hard time developing a function that takes into account two rows on the same exon. The non-overlapping interval must be unique (not overlap with any other intervals). For ex, on the first row below, the non-overlapping interval would be 1-49, 61-100. But, if you look at the second row, the non-overlapping interval would be 1-69, 81,100. I want non-overlapping, non-overlapping intervals, so the true interval output I want is 1-49, 61-69, 81-100. Not sure if I should output as a separate column or df, but this is the ultimate output I want. starting DF chrom exon_start exon_end start1 end1 1 1 100 50 60 1 1 100 70 80 2 5 50 25 100 final DF chrom exon_start exon_end start1 end1 non_overlap_start non_overlap_end 1 1 100 50 60 [1, 61, 81] [49, 69, 100] 1 1 100 70 80 [1, 61, 81] [49, 69, 100] 2 5 50 25 100 [25] [50] Continue reading...