|
from tname import * |
|
from Rfile import * |
|
|
|
|
|
def Sort_Sco_Kcat(file): |
|
dlkcats = [] |
|
contents = j_reads(file.name) |
|
|
|
|
|
name = Name() |
|
kcatname = name + r"mkcat_sort.fa" |
|
for i in range(2, len(contents)): |
|
content = contents[i].split() |
|
dlkcats.append(float(content[3])) |
|
s_dlkcat = [] |
|
s_dlkcat = sorted(range(len(dlkcats)), key=lambda k: dlkcats[k], reverse=True) |
|
|
|
|
|
with open(kcatname, "a") as f: |
|
f.write(contents[0]) |
|
|
|
f.write(contents[1]) |
|
|
|
|
|
for i in range(0, len(dlkcats)): |
|
with open(kcatname, "a") as f: |
|
f.write(contents[s_dlkcat[i]+2]) |
|
return kcatname |
|
|