diff --git a/CHANGELOG.md b/CHANGELOG.md index 713e5849..07869228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Initial release of nf-core/multiplesequencealign, created with the [nf-core](htt - [[#134](https://github.com/nf-core/multiplesequencealign/pull/134)] - Code revision for release preparation. - [[#138](https://github.com/nf-core/multiplesequencealign/pull/138)] - MultiQC as nf-core module and fix visualization. - [[#152](https://github.com/nf-core/multiplesequencealign/pull/152)] - Ignore kalign error 132 and print a warning (incompatibility with some CPU types). +- [[#153](https://github.com/nf-core/multiplesequencealign/pull/153)] - Fix time parser in shiny app. ### `Dependencies` diff --git a/bin/shiny_app/shiny_app_merge_score_and_trace.py b/bin/shiny_app/shiny_app_merge_score_and_trace.py index e5e4fe79..aca55c0d 100644 --- a/bin/shiny_app/shiny_app_merge_score_and_trace.py +++ b/bin/shiny_app/shiny_app_merge_score_and_trace.py @@ -3,18 +3,19 @@ def convert_time(time_str): # Regular expression to match the time components - pattern = re.compile(r'((?P\d+)h)?\s*((?P\d+)m)?\s*((?P\d+)s)?\s*((?P\d+)ms)?') + pattern = re.compile(r'((?P\d+(\.\d+)?)h)?\s*((?P\d+(\.\d+)?)m)?\s*((?P\d+(\.\d+)?)s)?\s*((?P\d+(\.\d+)?)ms)?') match = pattern.fullmatch(time_str.strip()) if not match: + print(time_str) raise ValueError("Time string is not in the correct format") time_components = match.groupdict(default='0') - hours = int(time_components['hours']) - minutes = int(time_components['minutes']) - seconds = int(time_components['seconds']) - milliseconds = int(time_components['milliseconds']) + hours = float(time_components['hours']) + minutes = float(time_components['minutes']) + seconds = float(time_components['seconds']) + milliseconds = float(time_components['milliseconds']) # Convert everything to minutes total_minutes = (hours * 60) + minutes + (seconds / 60) + (milliseconds / 60000)