Пример #1
0
if argn == 1:
    print('Error: no argument', file=sys.stderr)
else:
    for i in range(argn - 1):
        with open(sys.argv[i + 1]) as counthap:
            name10x = sys.argv[i + 1].split('.')[1]
            line = counthap.readline().split()
            while line:
                if line[0] == 'rname':
                    line = counthap.readline().split()
                else:
                    pbname = line[1]
                    if pbname not in pbl:
                        pbl[pbname] = {}
                    wrongrate = crit.keisan(int(line[3]), int(line[2]),
                                            int(line[4]))
                    if int(line[3]) > int(line[2]):
                        pbl[pbname][name10x + '.right'] = wrongrate
                    if int(line[3]) < int(line[2]):
                        pbl[pbname][name10x + '.left'] = wrongrate

                    line = counthap.readline().split()

valued = {}
for i in pbl.keys():
    for j in list(itertools.combinations(pbl[i].keys(), 2)):
        values = math.log10(pbl[i][j[0]]) + math.log10(pbl[i][j[1]])
        if j not in valued:
            valued[j] = [values]
        else:
            valued[j].append(
Пример #2
0
grapha = {}
for i in con_blo.keys():
    loop = []
    for j in con_blo[i].keys():
        print(j)
        loop.append(j)
        for k in range(len(loop)):
            for l in range(k + 1, len(loop)):
                lef = con_blo[i][loop[k]][0]
                rig = con_blo[i][loop[k]][1]
                oth = con_blo[i][loop[k]][2]
                lefr = con_blo[i][loop[l]][0]
                rigr = con_blo[i][loop[l]][1]
                othr = con_blo[i][loop[l]][2]
                evall = crit.keisan(int(lef), int(rig), int(oth))
                evalr = crit.keisan(int(lefr), int(rigr), int(othr))
                if (loop[k], loop[l]) in grapha.keys():
                    grapha[loop[k],
                           loop[l]] = float(grapha[loop[k], loop[l]]) * (
                               float(evall) + float(evalr))
                elif (loop[l], loop[k]) in grapha.keys():
                    grapha[loop[l],
                           loop[k]] = float(grapha[loop[l], loop[k]]) * (
                               float(evall) + float(evalr))
                    # if float(grapha[loop[k], loop[l]]) < float(evall) + float(evalr):
                    #     pass
                    # else:
                    #     grapha[loop[k], loop[l]] = float(evall) + float(evalr)
                # if (loop[l], loop[k]) in grapha.keys():
                #     if float(grapha[loop[l], loop[k]]) < float(evall) + float(evalr):
Пример #3
0
        filen = pl.Path(i).read_text().split('\n')
        fastar = pl.Path(i + '.right.fasta')
        fastarl = []
        fastal = pl.Path(i + '.left.fasta')
        fastall = []

        for j in filen:
            rown = j.split('\t')

            if len(j) == 0:
                pass
            elif j[0] == 'rname':
                pass
            else:
                rname = j[0]
                evalue = crit.keisan(j[2], j[3], j[4])

                if evalue < valuea:
                    if int(j[2]) < int(j[3]):
                        sequen = samtofasta.get(rname)
                        fastarl.append(rname + '\n')
                        fastarl.append(sequen + '\n')
                    elif int(j[2]) > int(j[3]):
                        sequen = samtofasta.get(rname)
                        fastall.append(rname + '\n')
                        fastall.append(sequen + '\n')

        for k in fastarl:
            fastar.write_text(rname + '\n')
            fastar.write_text(sequen + '\n')
        for k in fastall: