diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-08-20 14:19:10 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-08-20 14:19:10 -0700 |
commit | 8b50c4516a6e53c9d6f06207a0c636f9348967e2 (patch) | |
tree | fefa08a80a3819b38d034d9395f0761434ee20cb | |
parent | 7e711b0d4693b301f7877d570198843238f90960 (diff) |
fix: reharmonize syntax of log file
-rw-r--r-- | pangraph/graph.py | 4 | ||||
-rwxr-xr-x | scripts/parse_log.py | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pangraph/graph.py b/pangraph/graph.py index 500df82..c4e3f83 100644 --- a/pangraph/graph.py +++ b/pangraph/graph.py @@ -495,7 +495,7 @@ class Graph(object): delta = len(blk_list)-len(shared_blks) if delta > 0 and num_seqs > 1: - print(f">LEN: {delta}", end=';') + print(f">LEN={delta}", end=';') fd = [None, None] path = [None, None] try: @@ -524,7 +524,7 @@ class Graph(object): shell=True) out, err = proc.communicate() tree = Phylo.read(io.StringIO(out.decode('utf-8')), format='newick') - print(f"{n} SCORE={tree.total_branch_length()/(2*num_seqs)}", end=";") + print(f"SCORE={tree.total_branch_length()/(2*num_seqs)}", end=";") make_tree(0) make_tree(1) diff --git a/scripts/parse_log.py b/scripts/parse_log.py index 82d5e0d..bbca0ea 100755 --- a/scripts/parse_log.py +++ b/scripts/parse_log.py @@ -28,16 +28,16 @@ def main(args): continue if line[1:].startswith("LEN="): offset = [line.find(";")] - offset.append(line.find(";", offset[0])) - score[0] = int(line[line.find(score_preset, offset[0])+1+score_offset:offset[1]]) - score[1] = int(line[line.find(score_preset, offset[1])+1+score_offset:]) + offset.append(line.find(";", offset[0]+1)) + offset.append(line.find(";", offset[1]+1)) + + score = [None, None] + score[0] = float(line[offset[0]+1+score_offset:offset[1]]) + score[1] = float(line[offset[1]+1+score_offset:offset[2]]) stats[level]['hits'].extend(score) continue - raise ValueError(f"invalid syntax: {line[1:]}") - print(stats) - parser = argparse.ArgumentParser(description='process our data log files on end repair') parser.add_argument('files', type=str, nargs='+') |