From c67d1c76647795baf1696d8b8731678b6e8eb326 Mon Sep 17 00:00:00 2001 From: Rapsssito Date: Wed, 29 Nov 2023 16:56:28 +0100 Subject: [PATCH] feat(UI): Add harmonization text and style --- .../oncoliner_ui/src/ui/harmonization_tab.py | 8 ++- .../assesment_tab/metrics_panel.html | 12 +--- .../assesment_tab/metrics_plot.html | 9 +-- .../harmonization_panel.html | 58 +++++++++++------- .../improvement_tab/pipeline.html | 2 +- .../src/ui/html_templates/index/css/app.css | 20 +++---- .../index/harmonization_tab.html | 1 - .../index/js/charts/harmonizationChart.js | 60 ++++++++++++++----- .../model/harmonization/harmonization_dao.py | 13 +++- 9 files changed, 118 insertions(+), 65 deletions(-) diff --git a/modules/oncoliner_ui/src/ui/harmonization_tab.py b/modules/oncoliner_ui/src/ui/harmonization_tab.py index a210560..77e5e69 100644 --- a/modules/oncoliner_ui/src/ui/harmonization_tab.py +++ b/modules/oncoliner_ui/src/ui/harmonization_tab.py @@ -3,9 +3,10 @@ from .utils import flatten_dict, flatten_dict_keys from .plots.harmonization_plot import HarmonizationPlot +from .model.harmonization.harmonization_dao import HarmonizationDAO class HarmonizationTab(): - def __init__(self, env, dao): + def __init__(self, env, dao: HarmonizationDAO): self._env = env self._harmonization_dao = dao self._harmonization_tree_dict = self._harmonization_dao.get_tree() @@ -21,11 +22,14 @@ def render_panel(self): def render_table(self, id_, data): template = self._env.get_template(os.path.join("harmonization_tab", "harmonization_table.html")) # Build the default order of the columns - columns_order = [[data.columns.get_loc('h_score'), 'asc'], [data.columns.get_loc('gdr'), 'asc'], [data.columns.get_loc('f1_score_avg'), 'desc'], [data.columns.get_loc('added_callers_sum'), 'asc']] + columns_order = list(map(lambda x: [data.columns.get_loc(x[0]), x[1]], self._harmonization_dao.get_default_order())) # Get the index of the row with all names 'baseline' pipelines_names = self._harmonization_dao.get_pipelines_names() baseline_index = data[data[pipelines_names].apply(lambda x: all(x == 'baseline'), axis=1)].index[0] return template.render(ctrl=self, id=f'table_{id_}', data=data, fixed_index=baseline_index, default_order=columns_order) + + def get_best_harmonization_names(self, variant_type: str): + return self._harmonization_dao.get_best_harmonization_names(variant_type) def get_flatten_tree(self): return flatten_dict(self._harmonization_tree_dict, 'id') diff --git a/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_panel.html b/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_panel.html index ee1360f..26414ac 100644 --- a/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_panel.html +++ b/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_panel.html @@ -45,9 +45,7 @@ id="metricspaneltab_snv_indel_sv_{{id}}_" aria-labelledby="metricspaneltab_snv_indel_sv_{{id}}" > -
- {{ ctrl.render_metrics_plot(metrics_table, id, 'snv_indel_sv') }} -
+ {{ ctrl.render_metrics_plot(metrics_table, id, 'snv_indel_sv') }} {{ ctrl.render_metrics_table(metrics_table, id, 'snv_indel_sv', sample) }}
-
- {{ ctrl.render_metrics_plot(metrics_table, id, 'sv_subtypes') }} -
+ {{ ctrl.render_metrics_plot(metrics_table, id, 'sv_subtypes') }} {{ ctrl.render_metrics_table(metrics_table, id, 'sv_subtypes', sample) }}
-
- {{ ctrl.render_metrics_plot(metrics_table, id, 'sv_subtypes_sizes') }} -
+ {{ ctrl.render_metrics_plot(metrics_table, id, 'sv_subtypes_sizes') }} {{ ctrl.render_metrics_table(metrics_table, id, 'sv_subtypes_sizes', sample) }}
diff --git a/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_plot.html b/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_plot.html index 49f40c6..b44d10d 100644 --- a/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_plot.html +++ b/modules/oncoliner_ui/src/ui/html_templates/assesment_tab/metrics_plot.html @@ -1,9 +1,10 @@

Performance metrics ({{conf.names[plot_type]}})

-
- {{include_cooked('shared/export_chart.html', chart_js_var_name=id+'MetricsChart', filenames=[id+'_metrics_plot'], filename=id+'_metrics_plot')}} - +
+
+ {{include_cooked('shared/export_chart.html', chart_js_var_name=id+'MetricsChart', filenames=[id+'_metrics_plot'], filename=id+'_metrics_plot')}} + +
- {% block javascript %} {% endblock %} diff --git a/modules/oncoliner_ui/src/ui/html_templates/improvement_tab/pipeline.html b/modules/oncoliner_ui/src/ui/html_templates/improvement_tab/pipeline.html index 4b880d1..32c808e 100644 --- a/modules/oncoliner_ui/src/ui/html_templates/improvement_tab/pipeline.html +++ b/modules/oncoliner_ui/src/ui/html_templates/improvement_tab/pipeline.html @@ -73,7 +73,7 @@

Performance metrics (baseline vs

Explore the improvement possibilities of {{pipeline_name}} by selecting a variant caller or combination of variant callers from the table below. baseline represents the {{pipeline_name}} without any combination with other callers. Use the dropdown below to check the improvements possibilities for specific variant types and sizes. The selected improvement will be displayed in the plot above.

-