|
from tname import * |
|
from Rfile import * |
|
|
|
def Sort_Dlkcat(file): |
|
contents = j_reads(file.name) |
|
dlkcats = [] |
|
|
|
for i in range(2, len(contents)): |
|
content = contents[i].split() |
|
dlkcats.append(float(content[3])) |
|
|
|
sorted_dlkcat = [] |
|
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 |
|
|