|
import streamlit as st |
|
from tname import * |
|
|
|
|
|
def Sort_Scores(file): |
|
scores = [] |
|
|
|
|
|
|
|
with open(file.name, "r") as f: |
|
contents = f.readlines() |
|
|
|
for i in range(2, len(contents)): |
|
if i % 2 == 0: |
|
content = contents[i].split() |
|
scores.append(float(content[2][6:-1])) |
|
|
|
na = Name() |
|
na = na + r"scores_sort.tsv" |
|
|
|
|
|
sorted_id = [] |
|
sorted_id = sorted(range(len(scores)), key=lambda k: scores[k], reverse=True) |
|
|
|
|
|
with open(na, "a") as f1: |
|
|
|
content = contents[0].split() |
|
f1.write(content[0]) |
|
f1.write("\t") |
|
f1.write(content[1]) |
|
f1.write("\n") |
|
f1.write(contents[1]) |
|
|
|
for i in range(0, len(scores)): |
|
with open(na, "a") as f1: |
|
content = contents[sorted_id[i] * 2 + 2].split() |
|
f1.write(content[0]) |
|
f1.write("\t") |
|
f1.write(content[2]) |
|
f1.write("\t") |
|
f1.write(content[3]) |
|
f1.write("\n") |
|
|
|
f1.write(contents[sorted_id[i] * 2 + 2 + 1]) |
|
return na |
|
|