def _group_coords(rs):
    """Organize coordinate regions into groups for each transcript.

    Avoids collapsing very large introns or repetitive genes spread across
    the chromosome by limiting the intron size to 100kb for creating a single transcript
    """
    max_intron_size = 1e5
    coords = []
    for r in rs:
        coords.append(r.start)
        coords.append(r.end)
    coord_groups = []
    cur_group = []
    for coord in sorted(coords):
        if not cur_group or coord - cur_group[-1] < max_intron_size:
            cur_group.append(coord)
        else:
            coord_groups.append(cur_group)
            cur_group = [coord]
    if cur_group:
        coord_groups.append(cur_group)
    return coord_groups
def _group_coords ( rs ) : max_intron_size = 1e5 coords = [ ] for r in rs : coords . append ( r . start ) coords . append ( r . end ) coord_groups = [ ] cur_group = [ ] for coord in sorted ( coords ) : if not cur_group or coord - cur_group [ - 1 ] < max_intron_size : cur_group . append ( coord ) else : coord_groups . append ( cur_group ) cur_group = [ coord ] if cur_group : coord_groups . append ( cur_group ) return coord_groups
Organize coordinate regions into groups for each transcript.

    Avoids collapsing very large introns or repetitive genes spread across
    the chromosome by limiting the intron size to 100kb for creating a single transcript