def hotspot(fileh, mutation):
    """ PTMs containing motifs in a close proximity are named hotspots (Beltrao et al. Cell 2012)"""
    with open('hotspot.txt', 'w') as hotspot:
        with open(fileh, 'rU') as f:
            for l in f:
                line = l.split()
                with open(mutation, 'r') as mu:
                    for m in mu:
                        m = m.split()
                        if len(line) > 6:
                            if m[0] == line[2] and m[1] == line[3]:
                                take = line[1] + '\t' + line[2] + '\t' + line[3
                                    ] + '\t' + line[5] + '\t' + line[6
                                    ] + '\t' + 'PTMfunc'
                                fi = take.split()
                                with open('yeastID.txt') as id:
                                    for di in id:
                                        di = di.split()
                                        if len(di) > 2 and di[2] == fi[1]:
                                            summary = open('summary.txt', 'a+')
                                            summary.write(di[0] + '\t' + di[2] +
                                                '\t' + fi[2] + '\t' + fi[3] + '\t' +
                                                'HotSpot' + '\t' + 'PTMFunc' + '\n')
                                            if take > str(0):
                                                with open('hotspot.txt', 'a') as hotspot:
                                                    hotspot.write(take + '\n')
