Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(round red value to 5 decimal after the coma): #466

Merged
merged 1 commit into from Jan 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion gtdbtk/files/classify_summary.py
Expand Up @@ -124,11 +124,15 @@ def get_gid_taxonomy(self) -> Dict[str, List[str]]:
def write(self):
"""Writes the summary file to disk. None will be replaced with N/A"""
make_sure_path_exists(os.path.dirname(self.path))
print(self.path)
with open(self.path, 'w') as fh:
fh.write('\t'.join(self.get_col_order()[0]) + '\n')
for gid, row in sorted(self.rows.items()):
buf = list()
for data in self.get_col_order(row)[1]:
for idx,data in enumerate(self.get_col_order(row)[1]):
# for the red_value field, we want to round the data to 5 decimals after the comma if the value is not None
if idx==self.get_col_order()[0].index('red_value') and data is not None:
data = round(data,5)
buf.append(self.none_value if data is None else str(data))
fh.write('\t'.join(buf) + '\n')

Expand Down