@@ -0,0 +1,1984 @@
+#! /usr/bin/env python%0A%0Aimport os%0Aimport os.path%0Aimport sys%0Aimport json%0A%0Adef getFileTable(path):%0A    tbl = None%0A    with open(path, 'r') as f:%0A        for line in f:%0A            j = json.loads(line)%0A            tbl = j%5B%22fasta_files%22%5D%0A%0A    return tbl%0A%0Adef getScore(path):%0A    max_f1 = 0%0A    max_f2 = 0%0A    with open(path, 'r') as f:%0A        for line in f:%0A            vv = line.split()%0A            ff = vv%5B0%5D.strip().split(%22-%22)%0A            f1 = int(ff%5B0%5D) + 1%0A            f2 = int(ff%5B1%5D) + 1%0A%0A            if max_f1 %3C f1:%0A                max_f1 = f1%0A%0A            if max_f2 %3C f2:%0A                max_f2 = f2%0A%0A    max_f = 0%0A    if max_f1 %3E max_f2:%0A        max_f = max_f1%0A    else:%0A        max_f = max_f2%0A%0A    matrix = %5B%5B0 for x in range(0, max_f)%5D for y in range(0, max_f)%5D%0A    with open(path, 'r') as f:%0A        for line in f:%0A            vv = line.split()%0A            ff = vv%5B0%5D.strip().split(%22-%22)%0A            f1 = int(ff%5B0%5D.strip())%0A            f2 = int(ff%5B1%5D.strip())%0A            score = float(vv%5B1%5D.strip())%0A            if score %3E 1:%0A                score = 1.0%0A            matrix%5Bf1%5D%5Bf2%5D = score%0A%0A    return matrix%0A%0Adef writeMatrix(out_matrix, file_table, score):%0A    with open(out_matrix, %22w%22) as f:%0A        for i in range(0, len(score)):%0A            if i != 0:%0A                f.write(%22%5Ct%22)%0A            f.write(file_table%5Bi%5D)%0A        f.write(%22%5Cn%22)%0A%0A        for i in range(0, len(score)):%0A            row = score%5Bi%5D%0A            f.write(file_table%5Bi%5D)%0A            for j in range(0, len(row)):%0A                f.write(%22%5Ct%22)%0A                f.write(str(row%5Bj%5D))%0A            f.write(%22%5Cn%22)%0A%0Adef main(argv):%0A    if len(argv) %3C 2:%0A        print %22command : ./gen_score_matrix.py result_score table_json out_matrix%22%0A    else:%0A        result_score = argv%5B0%5D%0A        table_json = argv%5B1%5D%0A        out_matrix = argv%5B2%5D%0A        farr = getFileTable(table_json)%0A        score = getScore(result_score)%0A        writeMatrix(out_matrix, farr, score)%0A%0Aif __name__ == %22__main__%22:%0A    main(sys.argv%5B1:%5D)%0A

Add matrix gen tool