Skip to content

Commit

Permalink
postpone time measurement to the latest possible #243
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwengers committed Sep 26, 2023
1 parent b38f279 commit ff80f62
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions bakta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,11 @@ def main():
print(f"\toriCs/oriVs: {len([f for f in features if (f['type'] == bc.FEATURE_ORIC or f['type'] == bc.FEATURE_ORIV)])}")
print(f"\toriTs: {len([f for f in features if f['type'] == bc.FEATURE_ORIT])}")

cfg.run_end = datetime.now()
run_duration = (cfg.run_end - cfg.run_start).total_seconds()
genome['run'] = {
'start': cfg.run_start.strftime('%Y-%m-%d %H:%M:%S'),
'end': cfg.run_end.strftime('%Y-%m-%d %H:%M:%S'),
'duration': f'{(run_duration / 60):.2f} min'
}

############################################################################
# Write output files
# - write comprehensive annotation results as JSON
# - write optional output files in GFF3/GenBank/EMBL formats
# - measure runtime
# - write comprehensive annotation results as JSON
# - remove temp directory
############################################################################
print(f'\nexport annotation results to: {cfg.output_path}')
Expand Down Expand Up @@ -567,6 +560,15 @@ def main():
faa_path = cfg.output_path.joinpath(f'{cfg.prefix}.hypotheticals.faa')
fasta.write_faa(hypotheticals, faa_path)

# measure runtime at the latest possible
cfg.run_end = datetime.now()
run_duration = (cfg.run_end - cfg.run_start).total_seconds()
genome['run'] = {
'start': cfg.run_start.strftime('%Y-%m-%d %H:%M:%S'),
'end': cfg.run_end.strftime('%Y-%m-%d %H:%M:%S'),
'duration': f'{(run_duration / 60):.2f} min'
}

print('\tmachine readable JSON...')
json_path = cfg.output_path.joinpath(f'{cfg.prefix}.json')
json.write_json(genome, features, json_path)
Expand Down

0 comments on commit ff80f62

Please sign in to comment.