From d7f42faadc7e507bbd61dfe333d31ef3fc481041 Mon Sep 17 00:00:00 2001 From: paulzierep Date: Thu, 2 Nov 2023 11:22:18 +0100 Subject: [PATCH 1/2] Update bin/create_interactive_table.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bérénice Batut --- bin/create_interactive_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/create_interactive_table.py b/bin/create_interactive_table.py index cafa610a..78fd8034 100644 --- a/bin/create_interactive_table.py +++ b/bin/create_interactive_table.py @@ -42,7 +42,7 @@ def generate_table( df = df.loc[:, columns] df = df.reindex(columns=columns) - df.to_html("temp_tools_table.html", border=0, table_id="dataframe", classes=["display", "nowrap"], index=False) + table_str = df.to_html(border=0, table_id="dataframe", classes=["display", "nowrap"], index=False) with open(template_path) as template_file: template = template_file.read() From f0eae200b72a0cadb6ad575908764a4b5740b88e Mon Sep 17 00:00:00 2001 From: paulzierep Date: Thu, 2 Nov 2023 11:29:57 +0100 Subject: [PATCH 2/2] no temp file, general usage of the template, more generic --- bin/create_interactive_table.py | 36 ++++--------------- bin/create_interactive_table.sh | 2 +- .../{microgalaxy => }/datatable_template.html | 0 3 files changed, 7 insertions(+), 31 deletions(-) rename data/{microgalaxy => }/datatable_template.html (100%) diff --git a/bin/create_interactive_table.py b/bin/create_interactive_table.py index 78fd8034..8d399181 100644 --- a/bin/create_interactive_table.py +++ b/bin/create_interactive_table.py @@ -15,42 +15,18 @@ def generate_table( df = df.fillna("") - # TODO maybe allow comunities to modify - columns = [ - "Expand", - "Galaxy wrapper id", - "Galaxy wrapper version", - "Conda version", - "Conda id", - "Status", - "bio.tool id", - "bio.tool name", - "EDAM operation", - "EDAM topic", - "Description", - "bio.tool description", - "Status", - "Source", - "ToolShed categories", - "ToolShed id", - "Galaxy wrapper owner", - "Galaxy wrapper source", - ] - + #we assume this column is here df = df[df["To keep"]] - df = df.loc[:, columns] - df = df.reindex(columns=columns) - - table_str = df.to_html(border=0, table_id="dataframe", classes=["display", "nowrap"], index=False) + table_str = df.to_html(border=0, + table_id="dataframe", + classes=["display", "nowrap"], + index=False) with open(template_path) as template_file: template = template_file.read() - with open("temp_tools_table.html") as table_file: - table = table_file.read() - - final_html_output = template.replace("COMMUNITY_TABLE", table) + final_html_output = template.replace("COMMUNITY_TABLE", table_str) with open(output_path, "w") as output: output.write(final_html_output) diff --git a/bin/create_interactive_table.sh b/bin/create_interactive_table.sh index 59869e58..39f6daed 100644 --- a/bin/create_interactive_table.sh +++ b/bin/create_interactive_table.sh @@ -4,5 +4,5 @@ mkdir -p 'results/microgalaxy' python bin/create_interactive_table.py \ --table 'results/microgalaxy/tools.tsv' \ - --template 'data/microgalaxy/datatable_template.html' \ + --template 'data/datatable_template.html' \ --output 'results/microgalaxy/index.html' diff --git a/data/microgalaxy/datatable_template.html b/data/datatable_template.html similarity index 100% rename from data/microgalaxy/datatable_template.html rename to data/datatable_template.html