|
import re |
|
from tname import * |
|
from Rfile import * |
|
|
|
|
|
def Merge_Dlsc(sc_file, dl_file): |
|
scontents = j_reads(sc_file.name) |
|
scores = [] |
|
|
|
|
|
content = re.match('.*score=(\d.\d+?),', scontents[0]) |
|
score = content.group(1) |
|
scores.append(float(score)) |
|
|
|
|
|
for i in range(2, len(scontents)): |
|
if i % 2 == 0: |
|
|
|
content = re.match('.*score=(\d.\d+?),', scontents[i]) |
|
score = content.group(1) |
|
scores.append(float(score)) |
|
|
|
dcontents = j_reads(dl_file.name) |
|
dcontents[0] = dcontents[0].strip() + "\t" + "scores value" + "\n" |
|
|
|
name = Name() |
|
name = name + r"kcat_scores.tsv" |
|
|
|
with open(name, "a") as f: |
|
f.write(dcontents[0]) |
|
|
|
|
|
for i in range(1, len(dcontents)): |
|
dcontents[i] = dcontents[i].strip() + "\t" + str(scores[i - 1]) + "\n" |
|
with open(name, "a") as f: |
|
f.write(dcontents[i]) |
|
|
|
return name |
|
|