-
Notifications
You must be signed in to change notification settings - Fork 67
Update saltshaker reports #856
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
Open
ieduba
wants to merge
53
commits into
dev
Choose a base branch
from
saltshaker_reports
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 44 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
685dd90
reports as tabs and include customer ID in report
0e41aa0
update snaps
ieduba 1dd4f7f
update changelog
ieduba afc7740
update changelog
ieduba 829fc23
update tests
e709053
update snaps
ieduba 968bc03
change ID scheme
d2e3282
remove find/concatenate module
ieduba 46056a4
finish removing find/concat stuff
b3cebdd
update subworkflow snap
ieduba e6c0397
sort html inputs
16ef7f7
sort html inputs
3eaf01e
Merge branch 'dev' into saltshaker_reports
ieduba 4b4bc8a
update snaps
ieduba 8ced38b
merge
ieduba c8b23b0
suggestions from review
8365268
update snaps
ieduba cdde88e
add sample to test
1df42b4
Merge branch 'saltshaker_reports' of github.com:nf-core/raredisease i…
485fac3
add real tests
c946309
change sample map for proper joining
ieduba 05fbed2
Merge
c274f5b
remove real tests
ieduba c4411d2
fix sample map join logic
0a27ea2
updated snaps
ieduba f4a95a8
Merge branch 'dev' into saltshaker_reports
ieduba 1e78d9b
fix report prefix name
ieduba bfa6477
fix report prefix name
ieduba dc4b2ec
fix join logic and sample map order
c885635
Merge branch 'saltshaker_reports' of github.com:nf-core/raredisease i…
f9d47f5
add logic for missing saltshaker output
74c31b0
test new saltshaker version
a5dfbac
fix config
ieduba 7624396
merge
ieduba 7d05b2b
merge
ieduba 1f64587
test update saltshaker plot
d2672d8
update saltshaker modules for real
3a54651
Merge branch 'dev' into saltshaker_reports
ieduba 40218d7
fix some comments
f538661
update changelog
9b303de
Merge branch 'saltshaker_reports' of github.com:nf-core/raredisease i…
acc8c2c
merge
ieduba f8e0193
update pipeline snapshots
ieduba 9f88765
add back test config
ieduba c1d97b9
filter classify to avoid mismatched joins
ec8f4f7
add stub for local module
ae0e125
update snaps
ieduba 2d577e3
change subworkflow test
62801ff
Update bin/saltshaker_to_html.py
ieduba 32cbf9a
empty lines in python per suggestion
ieduba 6fe7f95
fix python linting
506da74
suggestions from review
596192c
move sorting to python script
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
peterpru marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| #!/usr/bin/env python3 | ||
| import re | ||
| import typer | ||
| from pathlib import Path | ||
| from typing import List, Optional | ||
|
|
||
| CSS = """.tabcontent { display: none; } | ||
| .tabcontent.active { display: block; } | ||
| .tablinks { padding: 12px 20px; cursor: pointer; background-color: #f1f1f1; border: 1px solid #ccc; } | ||
| .tablinks.active { background-color: #4CAF50; color: white; } | ||
| .tablinks:hover { background-color: #ddd; } | ||
| """ | ||
|
|
||
| JS = """ | ||
| function openTab(evt, tabName) { | ||
| var i, tabcontent, tablinks; | ||
| tabcontent = document.getElementsByClassName("tabcontent"); | ||
| for (i = 0; i < tabcontent.length; i++) { | ||
| tabcontent[i].classList.remove("active"); | ||
| } | ||
| tablinks = document.getElementsByClassName("tablinks"); | ||
| for (i = 0; i < tablinks.length; i++) { | ||
| tablinks[i].classList.remove("active"); | ||
| } | ||
| document.getElementById(tabName).classList.add("active"); | ||
| evt.currentTarget.classList.add("active"); | ||
| } | ||
| document.getElementsByClassName("tablinks")[0].click(); | ||
| """ | ||
|
|
||
|
ieduba marked this conversation as resolved.
|
||
| def txt_to_html(txt_file): | ||
| with open(txt_file) as tf: | ||
| content = tf.read() | ||
| html_content = re.sub(r'\\n', '<br>', content) | ||
| return html_content | ||
|
|
||
| def create_tab_button(sample_id): | ||
| return f'''<button class="tablinks" onclick="openTab(event, '{sample_id}')">{sample_id}</button>\n''' | ||
|
|
||
| def create_tab_content(sample_id, txt_file): | ||
| html_content = txt_to_html(txt_file) | ||
| return f'''<div id="{sample_id}" class="tabcontent"> | ||
| \t<h3>{sample_id}</h3> | ||
| \t<pre style="padding: 15px; border-radius: 5px; overflow-x: auto;">{html_content}</pre> | ||
| </div> | ||
| ''' | ||
|
|
||
| app = typer.Typer() | ||
|
|
||
| @app.command() | ||
| def main( | ||
| input: List[Path] = typer.Option( | ||
| ..., | ||
| "--input", | ||
| exists=True, | ||
| file_okay=True, | ||
| dir_okay=False, | ||
| help="Path to input .txt file (can be multiple)" | ||
| ), | ||
| sample: List[str] = typer.Option( | ||
| ..., | ||
| "--sample", | ||
| help="Sample ID(s) corresponding to the input .txt file(s)" | ||
| ), | ||
| output: Path = typer.Option( | ||
| ..., | ||
| "--output", | ||
| help="Path to output .html file" | ||
| ) | ||
| ): | ||
|
ieduba marked this conversation as resolved.
|
||
| tab_buttons = ''.join(create_tab_button(sid) for sid in sample) | ||
| tab_contents = ''.join(create_tab_content(sid, inp) for inp, sid in zip(input, sample)) | ||
|
|
||
| html = f"""<html> | ||
| <head> | ||
| <style> | ||
| {CSS} | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="tab"> | ||
| {tab_buttons} | ||
| </div> | ||
| {tab_contents} | ||
| <script> | ||
| {JS} | ||
| </script> | ||
| </body> | ||
| </html>""" | ||
|
|
||
| with open(output, 'w') as f: | ||
| f.write(html) | ||
|
|
||
| if __name__ == "__main__": | ||
| app() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - conda-forge::typer=0.25.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.