Skip to content

Commit

Permalink
Merge branch 'dev' into fix/plot_all_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
MaGering committed Aug 31, 2023
2 parents 7ec0700 + 8bdc70c commit da8760c
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions snakemake_rules/visualization.smk
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,48 @@ rule report:
run:
import os
import shutil
import platform

os.makedirs(output[0])
shutil.copy(src=input[0], dst=output[0])
shutil.copy(src=input[1], dst=output[0])
# static pdf report
shell(
"""
pandoc -V geometry:a4paper,margin=2.5cm \
--lua-filter report/pandoc_filter.lua \
--resource-path={params.all_plots} \
--metadata title="Results for scenario {wildcards.scenario}" \
{output}/report.md -o {output}/report.pdf
"""
)
# static html report
shell(
"""
pandoc --resource-path={params.all_plots} \
--lua-filter report/pandoc_filter.lua \
--metadata title="Results for scenario {wildcards.scenario}" \
--self-contained -s --include-in-header=report/report.css \
{output}/report.md -o {output}/report.html
"""
)
# interactive html report
shell(
"""
pandoc --resource-path={params.all_plots} \
--lua-filter report/pandoc_filter.lua \
--metadata title="Results for scenario {wildcards.scenario}" \
--self-contained -s --include-in-header=report/report.css \
{output}/report_interactive.md -o {output}/report_interactive.html
"""
)
os.remove(os.path.join(output[0], "report.md"))
os.remove(os.path.join(output[0], "report_interactive.md"))

if platform.system() == "Linux" or platform.system() == "Darwin":
# static pdf report
shell(
"""
pandoc -V geometry:a4paper,margin=2.5cm \
--lua-filter report/pandoc_filter.lua \
--resource-path={params.all_plots} \
--metadata title="Results for scenario {wildcards.scenario}" \
{output}/report.md -o {output}/report.pdf
"""
)
# static html report
shell(
"""
pandoc --resource-path={params.all_plots} \
--lua-filter report/pandoc_filter.lua \
--metadata title="Results for scenario {wildcards.scenario}" \
--self-contained -s --include-in-header=report/report.css \
{output}/report.md -o {output}/report.html
"""
)
# interactive html report
shell(
"""
pandoc --resource-path={params.all_plots} \
--lua-filter report/pandoc_filter.lua \
--metadata title="Results for scenario {wildcards.scenario}" \
--self-contained -s --include-in-header=report/report.css \
{output}/report_interactive.md -o {output}/report_interactive.html
"""
)
os.remove(os.path.join(output[0], "report.md"))
os.remove(os.path.join(output[0], "report_interactive.md"))

elif platform.system() == "Windows":
raise UserWarning("Sorry, at the moment the report is not available for Windows users.")
else:
raise UserWarning("Sorry, the report is not supported for the system you are using. "
"Please use either a Linux or a Darwin System.")

0 comments on commit da8760c

Please sign in to comment.