def buildClusterSpliceGraph(c, alt5, alt3):
    """use exon/splice start and end positions to build splice graph
    for a cluster c. Also finds exons that share same start (but differ
    at end: alt5), or share the same end (but differ at start: alt3)."""
    start = {}
    end = {}
    none = []
    for e in c.exons:
        if e.genomic_start not in start:
            start[e.genomic_start] = []
        start[e.genomic_start].append(e)
        if e.genomic_end not in end:
            end[e.genomic_end] = []
        end[e.genomic_end].append(e)
    for s in c.splices:
        try:
            exons1 = end[s.ver_gen_start]
        except KeyError:
            exons1 = none
        try:
            exons2 = start[s.ver_gen_end]
        except __HOLE__:
            exons2 = none
        for e1 in exons1:
            for e2 in exons2:
                e1.next[e2] = s # SAVE SPLICE AS EDGE INFO...
                s.exons = (e1, e2) # SAVE EXONS DIRECTLY ON THE SPLICE OBJECT
    for exons in start.values():
        for e1 in exons:
            for e2 in exons:
                if e1 != e2:
                    alt5 += e1
                    alt5 += e2
                    e1.alt5 += e2
                    e2.alt5 += e1
    for exons in end.values():
        for e1 in exons:
            for e2 in exons:
                if e1 != e2:
                    alt3 += e1
                    alt3 += e2
                    e1.alt3 += e2
                    e2.alt3 += e1
dataset/ETHPy150Open cjlee112/pygr/pygr/apps/splicegraph.py/buildClusterSpliceGraph