Skip to content

Commit

Permalink
Merge pull request #153 from luisas/minifix-shiny
Browse files Browse the repository at this point in the history
minifix shiny
  • Loading branch information
luisas authored Sep 19, 2024
2 parents 83b2cf2 + 619ed86 commit 6f3a465
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
11 changes: 6 additions & 5 deletions bin/shiny_app/shiny_app_merge_score_and_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@

def convert_time(time_str):
# Regular expression to match the time components
pattern = re.compile(r'((?P<hours>\d+)h)?\s*((?P<minutes>\d+)m)?\s*((?P<seconds>\d+)s)?\s*((?P<milliseconds>\d+)ms)?')
pattern = re.compile(r'((?P<hours>\d+(\.\d+)?)h)?\s*((?P<minutes>\d+(\.\d+)?)m)?\s*((?P<seconds>\d+(\.\d+)?)s)?\s*((?P<milliseconds>\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)
Expand Down

0 comments on commit 6f3a465

Please sign in to comment.