File size: 1,149 Bytes
af818c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from tname import *
from Rfile import *

def Sort_Dlkcat(file):
    contents = j_reads(file.name)
    dlkcats = []  # 存储kcat值
    # dlkcat sort
    for i in range(2, len(contents)):
        content = contents[i].split()
        dlkcats.append(float(content[3]))

    sorted_dlkcat = []  # 按kcat值从大到小对其索引进行排序
    sorted_dlkcat = sorted(range(len(dlkcats)), key=lambda k: dlkcats[k], reverse=True)

    name = Name()
    name = name + r"kcat_sort.fa"  # 结果文件名称

    # 第一条序列单独写入
    with open(name, "a") as f:
        content = contents[1].split()
        f.write(content[0])
        f.write("\t")
        f.write("Kcat value=")
        f.write(content[3])
        f.write("\n")
        f.write(content[2])
        f.write("\n")
    for i in range(0, len(dlkcats)):
        with open(name, "a") as f:
            content = contents[sorted_dlkcat[i] + 2].split()
            f.write(content[0])
            f.write("\t")
            f.write("Kcat value=")
            f.write(content[3])
            f.write("\n")
            f.write(content[2])
            f.write("\n")

    return name