From dfc3362eec1d5e6bbb07e10937be591c303f8c47 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 31 Jan 2024 16:19:20 +0100 Subject: [PATCH 1/2] [FIX] Code style --- scripts/plot.py | 92 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/scripts/plot.py b/scripts/plot.py index d54a96c..cdaf626 100644 --- a/scripts/plot.py +++ b/scripts/plot.py @@ -126,23 +126,23 @@ def create_plot(interactive=False): max_result_time, max_result_size = get_max_result(time_data_list[1:], 1.01), get_max_result( size_data_list[1:], 1.01 ) - p1 = figure( + plot1 = figure( y_range=convert_list_to_string(size_data[time_structure[0]]), x_range=(max_result_time, 0), x_axis_label="time in minutes", toolbar_location="left", tools="", ) - renderers1 = p1.hbar_stack( + renderers1 = plot1.hbar_stack( stackers=time_structure[1:], y=time_structure[0], height=0.4, source=(time_data), color=Set2_6 ) legend_items = [] - for r in renderers1: - key, tag = r.name, r.name - legend_items.append((key, [r])) + for renderer in renderers1: + key, tag = renderer.name, renderer.name + legend_items.append((key, [renderer])) if key == "wall_clock_time_in_seconds": tag = "time_left" - p1.add_tools( + plot1.add_tools( HoverTool( tooltips=[ (f"{file_name}", "@value"), @@ -150,35 +150,35 @@ def create_plot(interactive=False): (tag, "@$name{0.00} sek"), ("Percentage", f"@{key}_percentage{{0.00}}%"), ], - renderers=[r], + renderers=[renderer], ) ) - p1.toolbar_location = None - p1.toolbar.logo = None - p1.yaxis.visible = False - p1.extra_y_ranges = { + plot1.toolbar_location = None + plot1.toolbar.logo = None + plot1.yaxis.visible = False + plot1.extra_y_ranges = { "zusätzliche_achse": FactorRange(factors=convert_list_to_string(size_data[time_structure[0]])) } zweite_y_achse = LinearAxis(y_range_name="zusätzliche_achse") zweite_y_achse.major_label_text_font_size = "1pt" zweite_y_achse.major_label_text_color = "#15191c" - p1.add_layout(zweite_y_achse, "right") - p1.xaxis.ticker = AdaptiveTicker(base=60, mantissas=[1, 2, 5], min_interval=60, max_interval=600) - p1.xaxis.formatter = CustomJSTickFormatter( + plot1.add_layout(zweite_y_achse, "right") + plot1.xaxis.ticker = AdaptiveTicker(base=60, mantissas=[1, 2, 5], min_interval=60, max_interval=600) + plot1.xaxis.formatter = CustomJSTickFormatter( code=""" return (tick / 60); """ ) - p1.y_range.range_padding = 0.1 - p1.ygrid.grid_line_color = None - p1.axis.minor_tick_line_color = None + plot1.y_range.range_padding = 0.1 + plot1.ygrid.grid_line_color = None + plot1.axis.minor_tick_line_color = None - p1.yaxis.major_tick_line_color = None - p1.yaxis.minor_tick_line_color = None - p1.outline_line_color = None - p1.sizing_mode = "scale_both" - p1.title.text = "Double click on legend/plot to hide/show the legend" - p1.title.align = "right" + plot1.yaxis.major_tick_line_color = None + plot1.yaxis.minor_tick_line_color = None + plot1.outline_line_color = None + plot1.sizing_mode = "scale_both" + plot1.title.text = "Double click on legend/plot to hide/show the legend" + plot1.title.align = "right" legend = Legend(items=legend_items) legend.location = "center" @@ -189,16 +189,16 @@ def create_plot(interactive=False): # legend.nrows = 3 legend.title = "Default parameters:\n\t\t\tt_max = 192\n\t\tunion estimation (U) = yes\n\t\t\trearrangement (R) = yes\n\t\t\tk-mer size (k) = 32\n\t\t\tnumber of hash function (hash) = 2\n\t\t\talpha = 1.2\n\t\t\trelaxed false positive rate (r-fpr) = 0.5\n\t\t\tmaximum false positive rate (fpr) = 0.05" legend.title_text_color = "#e0e0e0" - p1.add_layout(legend, "left") + plot1.add_layout(legend, "left") toggle_legend_js = CustomJS( args={"legend": legend}, code=""" legend.visible = !legend.visible """, ) - p1.js_on_event(events.DoubleTap, toggle_legend_js) + plot1.js_on_event(events.DoubleTap, toggle_legend_js) - p2 = figure( + plot2 = figure( y_range=convert_list_to_string(size_data[size_structure[0]]), x_range=(0, max_result_size), x_axis_label="size in GB", @@ -206,13 +206,13 @@ def create_plot(interactive=False): tools="", ) legend_items = [] - renderers2 = p2.hbar_stack( + renderers2 = plot2.hbar_stack( size_structure[1:], y=size_structure[0], height=0.4, source=(size_data), color=Set2_4 ) - for r in renderers2: - key = r.name - legend_items.append((key, [r])) - p2.add_tools( + for renderer in renderers2: + key = renderer.name + legend_items.append((key, [renderer])) + plot2.add_tools( HoverTool( tooltips=[ (f"{file_name}", "@value"), @@ -221,36 +221,36 @@ def create_plot(interactive=False): ("Percentage", f"@{key}_percentage{{0.00}}%"), ("avg_load_factor", f"@{key}_avg_load_factor{{0.00}}"), ], - renderers=[r], + renderers=[renderer], ) ) - p2.toolbar.logo = None - p2.toolbar_location = None - p2.y_range.range_padding = 0.1 - p2.ygrid.grid_line_color = None - p2.axis.minor_tick_line_color = None - p2.outline_line_color = None - p2.title.text = "Click on legend entries to mute the corresponding bars" + plot2.toolbar.logo = None + plot2.toolbar_location = None + plot2.y_range.range_padding = 0.1 + plot2.ygrid.grid_line_color = None + plot2.axis.minor_tick_line_color = None + plot2.outline_line_color = None + plot2.title.text = "Click on legend entries to mute the corresponding bars" legend = Legend(items=legend_items) legend.location = "center" legend.glyph_height = 12 legend.glyph_width = 12 legend.click_policy = "mute" - p2.add_layout(legend, "right") + plot2.add_layout(legend, "right") toggle_legend_js = CustomJS( args={"legend": legend}, code=""" legend.visible = !legend.visible """, ) - p2.js_on_event(events.DoubleTap, toggle_legend_js) + plot2.js_on_event(events.DoubleTap, toggle_legend_js) - p2.yaxis.major_tick_line_color = None - p2.yaxis.minor_tick_line_color = None - p2.yaxis.major_label_standoff = 15 - p2.sizing_mode = "scale_both" - both_plots = row(p1, p2) + plot2.yaxis.major_tick_line_color = None + plot2.yaxis.minor_tick_line_color = None + plot2.yaxis.major_label_standoff = 15 + plot2.sizing_mode = "scale_both" + both_plots = row(plot1, plot2) both_plots.sizing_mode = "scale_both" vercel_logo = """ From bb48e69cb35ddaa5c3d67becc31093f7ce817ade Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 31 Jan 2024 19:06:00 +0100 Subject: [PATCH 2/2] [INFRA] Use miniforge and pin packages --- .github/workflows/lint.yml | 28 ++++++++-------------------- .github/workflows/pages.yml | 14 ++++---------- .github/workflows/test.yml | 14 ++++---------- environment.yml | 13 ++++++------- 4 files changed, 22 insertions(+), 47 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5697419..3d09bf9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,21 +29,15 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.SEQAN_ACTIONS_PAT }} - - name: Cache conda - uses: actions/cache@v4 - with: - path: ~/conda_pkgs_dir - save-always: true - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} - - name: Setup conda uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: false activate-environment: snakemake - environment-file: environment.yml auto-activate-base: false - use-only-tar-bz2: true + auto-update-conda: false + channel-priority: strict + environment-file: environment.yml + miniforge-version: latest - name: Run isort run: isort . @@ -84,21 +78,15 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} - - name: Cache conda - uses: actions/cache@v4 - with: - path: ~/conda_pkgs_dir - save-always: true - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} - - name: Setup conda uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: false activate-environment: snakemake - environment-file: environment.yml auto-activate-base: false - use-only-tar-bz2: true + auto-update-conda: false + channel-priority: strict + environment-file: environment.yml + miniforge-version: latest - name: Run pylint run: pylint . diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e91fd8a..21a41f3 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -26,21 +26,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Cache conda - uses: actions/cache@v4 - with: - path: ~/conda_pkgs_dir - save-always: true - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} - - name: Setup conda uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: false activate-environment: snakemake - environment-file: environment.yml auto-activate-base: false - use-only-tar-bz2: true + auto-update-conda: false + channel-priority: strict + environment-file: environment.yml + miniforge-version: latest - name: Build HTML run: python3 scripts/main.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0a32fe..2be3a11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,21 +23,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Cache conda - uses: actions/cache@v4 - with: - path: ~/conda_pkgs_dir - save-always: true - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} - - name: Setup conda uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: false activate-environment: snakemake - environment-file: environment.yml auto-activate-base: false - use-only-tar-bz2: true + auto-update-conda: false + channel-priority: strict + environment-file: environment.yml + miniforge-version: latest - name: Build HTML run: python3 scripts/main.py diff --git a/environment.yml b/environment.yml index 3c4988c..f2ffa70 100644 --- a/environment.yml +++ b/environment.yml @@ -1,12 +1,11 @@ name: snakemake channels: - conda-forge - - bioconda - defaults dependencies: - - black - - bokeh - - isort - - pylint - - snakemake - - snakefmt + - black=23.11.0 + - bokeh=3.3.4 + - isort=5.13.2 + - pylint=3.0.3 + - bioconda::snakemake=8.4.2 + - bioconda::snakefmt=0.9.0