def toIntronIntervals(chunk):
    if len(chunk) == 0:
        return []
    contig, strand, transcript_id = (chunk[0].contig,
                                     chunk[0].strand,
                                     chunk[0].transcript_id)
    for gff in chunk:
        assert gff.strand == strand, "features on different strands."
        assert gff.contig == contig, "features on different contigs."
        assert gff.transcript_id == transcript_id, \
            "more than one transcript submitted"

    intervals = Intervals.combine([(x.start, x.end)
                                   for x in chunk if x.feature == "exon"])
    return Intervals.complement(intervals)
convert a set of gtf elements within a transcript to intron coordinates.
dataset/ETHPy150Open CGATOxford/cgat/CGAT/GTF.py/toIntronIntervals