Skip to content

Commit

Permalink
improved metadata comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
pchaumeil committed Feb 24, 2020
1 parent cdb325a commit 420e816
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gtdb_migration_tk/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,20 @@ def compare_selected_data(self, old_meta_file, new_meta_file, metafield, output_
new_nested_dict[line[0]] = str(
line[new_headers.index(metafield)])
else:
for raw_line in omf:
for raw_line in nmf:
line = raw_line.strip('\n').split('\t')
new_nested_dict[line[0]] = str(
line[new_headers.index(metafield)])
if line[0] in old_nested_dict:
new_nested_dict[line[0]] = str(
line[new_headers.index(metafield)])

results = []
outf = open(output_file, 'w')
outf.write('genome_id\told_value\tnew_value\tsimilarity\n')
for k, v in old_nested_dict.items():
for k, v in new_nested_dict.items():
similarity = 'Identical'
if v != new_nested_dict.get(k):
if v != old_nested_dict.get(k):
similarity = "Different"
outf.write('{}\n'.format(
'\t'.join([k, str(v), str(new_nested_dict.get(k)), similarity])))
'\t'.join([k, str(old_nested_dict.get(k)), str(v), similarity])))

self.logger.info('{} parsed'.format(old_meta_file))

0 comments on commit 420e816

Please sign in to comment.